Re: Relative path (Jolly Roger)
Re: Relative path (Jolly Roger)
- Subject: Re: Relative path (Jolly Roger)
- From: Nir Soffer <email@hidden>
- Date: Thu, 21 Dec 2000 11:29:19 +0200
I can not have the problem of a missing script, because a missing script
would not show up in the script menu of applications like Powermail or
BBEdit. These application show in the menu the script that exists in the
scripts folder.
The problem is how to make a generic script thats know the path to itself
when you run it as compiled script using these applications script menu.
thanks for the help
Nir Soffer
--
Email: email@hidden
ICQ: 98571424
>
You have to tell the user where to put it, or better, get them to show where
>
it is, then save location in a property (as an alias, so they can move it
>
around). Then test for it, using what we learned yesterday about OS 9's
>
resolution of non-existent aliases, but still be able to get the name of it
>
in earlier OS's if the script has disappeared. Like this:
>
>
>
property theScript : ""
>
property scriptName : ""
>
>
if theScript = "" then
>
set theScript to choose file of type "osas" with prompt "Where is that
>
script you're supposed to have?"
>
set {ods, AppleScript's text item delimiters} to {AppleScript's text
>
item delimiters, {":"}}
>
set scriptName to last text item of (theScript as string)
>
set AppleScript's text item delimiters to ods
>
else
>
try
>
get alias (theScript as string)
>
on error
>
beep 2
>
display dialog "You seem to have trashed the " & scriptName & "
>
script." & return & return & "Bye!" buttons {"OK"} default button "OK" with
>
icon 0
>
set {theScript, scriptName} to {""}
>
return
>
end try
>
>
end if
>
>
tell application "Finder"
>
set theFolder to container of theScript as alias
>
end tell
>
>
--carry on