Re: Identifying the file types
Re: Identifying the file types
- Subject: Re: Identifying the file types
- From: Graff <email@hidden>
- Date: Mon, 26 Jan 2004 11:51:07 -0500
Try something like this:
---------
set theFile to choose file
tell application "Image Events"
set thisImage to open theFile
set imageType to file type of thisImage
end tell
---------
It should tell you if the image is one of the following formats:
PICT/Photoshop/BMP/QuickTime
Image/GIF/JPEG/MacPaint/JPEG2/SGI/PSD/TGA/Text/PDF/PNG/TIFF
Image Events is a standard application that comes with with MacOS 10.3.
Here's Apple's web site on it:
<
http://www.apple.com/applescript/imageevents/index.html>
- Ken
On Jan 26, 2004, at 10:33 AM, Takashi Yoshida wrote:
Hi all,
I'm writing a simple drag and drop application that will begin a
slideshow of the photographs.
User is supposed to drag a folder containing photos or selections of
photo files into the application and the application will launch
GraphicConverter to begin the slideshow.
It's simple enough and I've already got it to work. The thing is, is
there any reliable way to check whether the files dropped into the
application are pictures? File extension is not really a reliable way
to correctly identify the file types and I'm not sure if checking the
file types or creator type are reliable (do Mac OS X applications still
keep these information around?)
Anyway, here's a script that I've got so far.
on run
display dialog "Please drag and drop a folder that contains your
pictures." buttons {"OK"} default button 1 giving up after 10 with icon
note
end run
on open photos
-- there should some kind of error checking here before going into
slideshow mode.
tell application "GraphicConverter"
-- bring the GraphicConverter to the front and begin the slideshow
activate
slideshow photos
end tell
end open
Thanks,
--
Takashi Yoshida
e-mail: email@hidden
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.