• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Relative path (Jolly Roger)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Relative path (Jolly Roger)


  • Subject: Re: Relative path (Jolly Roger)
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 20 Dec 2000 16:23:33 -0800

On 12/20/00 3:52 PM, "Nir Soffer" <email@hidden> wrote:

> open container of (path to me)
> works for an application. but it does not work for compiled script.
>
> I am triying to write a generic "open enclosing folder" script, which is
> activated by tscript menu of application like Powermail
>
> when I use this script, it opens the container of Powermail instead of
> the containr of the script, because me is Powermail.
>
> How can you get the path to a compiled script run from another application?
>
>
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




--
Paul Berkowitz


References: 
 >Re: Relative path (Jolly Roger) (From: Nir Soffer <email@hidden>)

  • Prev by Date: Print selected pdf files from html form automatically
  • Next by Date: Re: [Becoming Off Topic) Re: Run Only
  • Previous by thread: Re: Relative path (Jolly Roger)
  • Next by thread: Re: Relative path (Jolly Roger)
  • Index(es):
    • Date
    • Thread