Don't load a file that is not an image

Klaus Major klaus at major-k.de
Mon Feb 27 06:35:56 CST 2006


Hi Reinhold,

you should check "the result" immediately after importing the image!

> Hi!
>
> I wrote a script to load an image, but when I select a file, that  
> is not an image, I get an error message.
>
> How can I avoid the selection of a wrong file.
> This script don't works:
>
> on mouseUp
>   answer file "Please select an image:"
>   put it into Importpicture
>   if Importpicture is empty then
>     answer "You did not select an image."
>     exit mouseup
>   end if
>   import paint from file Importpicture
      if the result <> empty
         ## no succes for whatever reason, maybe that was no image  
file...
         answer "This is not an image. It cannot be loaded."
> end mouseUp
>
> I did not find any help in help

Look for "result" in the index.

> Reinhold

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the metacard mailing list