• 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: osascript - path to me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: osascript - path to me


  • Subject: Re: osascript - path to me
  • From: Arthur J Knapp <email@hidden>
  • Date: Sun, 19 May 2002 12:35:52 -0400

> Date: Fri, 17 May 2002 18:01:18 -0700
> Subject: Re: osascript - path to me
> From: Christopher Nebel <email@hidden>


>> On Saturday, May 18, 2002, at 01:58 AM, Christopher Nebel wrote:

> A peculiarity of "path to me" is that it returns the path to the
> executing application, *not* the script being executed. The only way to
> get "path to me" to return the path to the script is to either make sure
> they're the same thing (i.e., make it an applet), or make the script
> runner handle "path to me" specially. (I think Smile does this; I'm not
> sure about Script Debugger.)

Script Debugger does, (in fact, there is a preference setting that allows
one to control this behavior).

> The meta-question here is "why does your script need to know where it
> is?" The typical answer to this is "so it can locate some related
> resources it needs", which leads to the counter-question "why aren't you
> using AppleScript Studio to create an application bundle?"

For those who have not yet had the supposed "pleasure" of moving to OSX
and AppleScript Studio, here is a very simple, (though hard-coded), system
for making the "path to" command return the script's path during editing:

-- For Apple's Script Editor:
--
on path to keywordConstant

if (keywordConstant = me) then

set aliasPath to continue path to me

set strPath to aliasPath as string

if strPath's text from word -2 to word -1 = "Script Editor" then

return alias "MacHD:myScripts:thisScript"
else
return aliasPath --> applet's path
end if

else
continue path to keywordConstant -- apple menu, startup disk,
etc
end if
end path to

path to me



{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
<mailto:email@hidden>
try
<http://www3.sympatico.ca/victor.yee/>
on error number -128
end try
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: osascript - path to me
      • From: Timothy Bates <email@hidden>
  • Prev by Date: Re: OS X: Coercing Finder's Item Reference into String
  • Next by Date: Re: osascript - path to me
  • Previous by thread: Re: osascript - path to me
  • Next by thread: Re: osascript - path to me
  • Index(es):
    • Date
    • Thread