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

Re: "path to me" vs ":"


  • Subject: Re: "path to me" vs ":"
  • From: JJ <email@hidden>
  • Date: Sat, 08 Dec 2001 22:40:34 +0100

> A simple means of replacing the ":" trick with "path to me" when you want
> the path to the enclosing folder is:
>
> set myalias to (path to me)
> tell application "Finder"
> set mypath to folder of myalias
> end tell
> set mypath to mypath as string
>
> This is shorter than using Text Item Delimiters to lop off the end of the
> path, and has the advantage of not assuming the path delimiter.

So, in an old discussion, the problem was when the parent isn't the script
itself. For example, if you're using standard additions and 1 app, and you
define this app as the parent, "path to me" will never return the path to
the running app.

This stupid script demonstrates it:

property parent : application "URL Access Scripting"

set myalias_1 to (":" as alias)
display dialog myalias_1
-- returns path to container of the running app

set myalias_2 to (path to me)
tell app "Finder"
set mypath to folder of myalias_2
end tell
display dialog mypath
-- returns path to container of "URL Access Scripting"


  • Prev by Date: Re: Help needed - auto email
  • Next by Date: Re: Scripts no longer work in 9.2...
  • Previous by thread: Applescript or bust ... ?
  • Next by thread: Re: "path to me" vs ":"
  • Index(es):
    • Date
    • Thread