Re: path to question?
Re: path to question?
- Subject: Re: path to question?
- From: Paul Skinner <email@hidden>
- Date: Tue, 17 Jul 2001 01:07:18 -0400
>
On 17/7/01 7:55 AM, "Admin nimlok.com" <email@hidden> wrote:
>
>
> Thanks Steve for your reply.
>
>
>
> Actually what I'm trying to do is get the path to the folder
>
> that an application is in?
>
>
>
> set filepath to path to creator "CDP3" as string
>
>
>
> returns
>
>
>
> file "HD I:Desktop Folder:VectorWorks:VectorWorks"
>
>
>
> I want
>
>
>
> file"HD I:Desktop Folder:VectorWorks:"
>
>
>
> I've tried delimiting the string but get errors.
>
> applescript acts like filepath is not a string,
>
> not sure why?
>
>
>
> any help would greatly be appreciated.
>
> thanks
>
> Dave
>
>
>
>
I like pure vanilla.
on getApplicationInfo(creatorCode)
tell application "Finder"
try
set applicationName to name of application file id creatorCode
set applicationFileContainer to (folder of application file id
creatorCode) as text
set applicationAlias to applicationFileContainer &
applicationName as alias
on error e number n
return e & return & n
end try
end tell
return {applicationName:applicationName,
applicationFileContainer:applicationFileContainer,
applicationAlias:applicationAlias}
end getApplicationInfo
set creatorCode to "MEme"
getApplicationInfo(creatorCode)
-->{applicationName:"Scripter.", applicationFileContainer:"dark
star:Applications (Mac OS 9):AppleScript:Scripter. 2.5:",
applicationAlias:alias "dark star:Applications (Mac OS
9):AppleScript:Scripter. 2.5:Scripter."}
caveat:
Use '(folder of application file id creatorCode) as text' with caution
if you have OS X installed. Testing this with "ToyS" the creator code for
Script Editor I received the error...
>
"Finder got an error: Can't get folder of application file id \"ToyS\".
>
-1728"
Removing the 'as text' I got...
>
folder "SystemFiles" of folder "English.lproj" of folder "Resources" of folder
>
"Contents" of package "Classic Startup.app" of folder "CoreServices" of folder
>
"Library" of folder "System" of startup disk of application "Finder"
But the line 'set applicationAlias to applicationFileContainer &
applicationName as alias' causes the error...
>
"Finder got an error: Can't get folder \"Contents\" of package \"Classic
>
Startup.app\" of folder \"CoreServices\" of folder \"Library\" of folder
>
\"System\" of startup disk.
>
-1728"
--
"AppleScript is digital duct tape."
Paul Skinner