• 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 Caveat
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Path to me Caveat


  • Subject: Re: Path to me Caveat
  • From: JJ <email@hidden>
  • Date: Fri, 12 Oct 2001 11:09:09 +0200

> --begin script
> --running in an editor or an an applet.
> property parent : application "Finder"
> display dialog ((path to me) as text)
> -->"OS9:System Folder:Finder"
> --end script
>
> In these cases, I have no idea how to find the script's location from
> within itself. Maybe somebody here will show me how.

property parent : application "Finder"
set MeScript to ":" & "TestScript" as alias

(":" as alias) always returns the folder containing the running script: the
Script Editor (parent: script editor/debugger/...), if the script is running
inside it, or the applet/droplet's folder (parent: script Applescript).

If you need some parents, you can "define" it into "child objects":

--- s t a r t s s c r i p t ---
tell ParentFinder to DisplayDialog()
display dialog (path to me)

script ParentFinder
property parent : application "Finder"
on DisplayDialog()
display dialog (path to me) as text
end displaydialog
end script
--- e n d s s c r i p t ---
--> "HD:System Folder:Finder"
--> "HD:Desktop Folder:TestScript"

The child object "ParentFinder" defines its own parent. So, if you delente
the "property parent..." line, it returns its "default" parent: the script.
--> "HD:Desktop Folder:TestScript"

JJ


  • Follow-Ups:
    • Re: Path to me Caveat
      • From: Paul Skinner <email@hidden>
References: 
 >Path to me Caveat (From: Paul Skinner <email@hidden>)

  • Prev by Date: Re: Path to me Caveat
  • Next by Date: Re: Simple question
  • Previous by thread: Re: Path to me Caveat [OFF]
  • Next by thread: Re: Path to me Caveat
  • Index(es):
    • Date
    • Thread