answer file of type "JPEG"
klaus at major-k.de
Sun Oct 5 07:56:00 EDT 2003
> Hi listers,
> has anyone successfully used e.g.:
> answer file "yadda" of type "JPEG"
> on OS X?
> Does not work, not ALL jpgs are shown in the open-dialog...
> Some are dimmed...
> Looks like the ones (coming from win or a digital camera!) without a
> "filetype" are dimmed.
> Their last item is empty in the "long files"...
> Is it a bug?
> Is it already bugzilla'd?
> Are there (not too ugly ;-) workarounds?
> I reported this yesterday:
> [Bug 762] result is empty when setting the filename of an image to a
> non-image file!
> So checking the result does not work in this context/case...
I found a workaround by myself, maybe its helpful to others, too...
Since the open dialog on OS X does not work as it should***, i needed a
check for a valid image file (BMP,JPG,GIF and PNG) before setting the
an image to that file after the user chose one...
(*** with "ask file "yadda" of type "JPEG" etc...
Not all files are accessible, some jpgs are dimmed...)
Otherwise you will end with anugly and empty image-object...
Anyway, here's my little function :-)
Works fine here with all my image files on OS X (X only!)
##function rrimage what
function rrbild was
### was = absolute path to the file...
if there is not a file was then return false
open file was for read
read from file was for 15
close file was
if char 1 to 2 of it = "BM" then return true
### is a BMP file
repeat for each item i in "GIF,JFIF,PNG"
### you guessed
if i is in it then return true
(Takes about 1 to 20 millisecs :-)
And then i use it right after the user selected a file:
answer file ...
if rrbild(it) then set the filename of img ...
Have nice sunday...
Best from germany
klaus at major-k.de
Get you free "Memory"-game for little and not so little kids today :-)
On my site -> Download
I can make a basic "memory-RR-source-code" available, too, if you
Surprisingly simple ;-)
More information about the Use-livecode