Re: Creator Types in OS X...
Re: Creator Types in OS X...
- Subject: Re: Creator Types in OS X...
- From: Chris Espinosa <email@hidden>
- Date: Wed, 17 Jul 2002 15:54:40 -0700
On Wednesday, July 17, 2002, at 02:55 PM, Peter Bunn wrote:
>
I use a lot of calls to 'open this_item using application file id
>
"WXYZ"'... but haven't (in 48 hours on OS X) found a simple way to
>
determine the creator type of a file or an app.
A couple of things here. First, not all applications on X have creator
types, so depending on what you're doing and what apps you want to use,
this may not be a useful exercise at all. On Mac OS X, most
applications have a "bundle identifier" that you can use instead of the
creator type, e.g.
tell application "Finder"
get application file id "com.apple.mail"
end tell
--> application file "Mail.app" of folder "Applications" of startup
disk of application "Finder"
>
I've tried:
>
>
tell application "Finder"
>
creator type of application "OmniWeb"
>
end tell
>
>
and...
>
>
tell application "Finder"
>
file creator of application "OmniWeb"
>
end tell
>
>
... but on run, I get errors.
That's because 'application' isn't a Finder object that has a creator
type. 'application' is an AppleScript object, and it doesn't have a
creator type property. The Finder object you want is the same
'application file' object you used above:
tell application "Finder"
creator type of application file id "com.apple.mail"
end tell
--> "emal"
Of course, you probably want to look it up by name, but you have to be
specific about which application file you want, so you have to use the
full path:
tell application "Finder"
creator type of application file "Mac OS X:Applications:Mail.app"
end tell
--> "emal"
If you don't know where the application is, then you can let
AppleScript's 'path to' command find it for you, then use the Finder to
get the interesting information:
tell application "Finder"
creator type of application file ((path to application "Mail") as
Unicode text)
end tell
--> "emal"
>
I used the app id call technique mainly to avoid double-tell situations
>
in pre-OS X. I was just juggling 'responsibility' in situations where
>
the app's dictionary didn't come into play. Will I need to start using
>
tell blocks "using terms from" to achieve similar?
A Tell block requires an AppleScript 'application', not a Finder
'application file', so you'd need to make the latter from the former:
tell application "Finder"
set appPath to application file id "emal" as string
end tell
tell application appPath
name of every window
end tell
As you said, this works when you don't need an application's unique
terminology; to do so you need a double "tell" or "using terms from"
block.
Chris Espinosa
Apple
_______________________________________________
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.