Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > AppleScripting path to self

AppleScripting path to self
Thread Tools
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Jun 2, 2003, 02:10 PM
 
On Mac OS 9, how can one have an AppleScript detect the path to itself.

I have a script that users download, and place somewhere. It needs to find files that will be in the same directory as itself.

I remember there was a way... though can't find it.

Needs to work on OS 9 (until the guys up top can be convinced to go to OS X... in the works!)
I always use protection when fscking my Mac... Do you?
     
Senior User
Join Date: Oct 2000
Location: Midwest
Status: Offline
Reply With Quote
Jun 2, 2003, 04:38 PM
 
Robert,
Experiment with this- add this line to an empty script window in Script Editor and then save it as a compiled script. Open the Result window (cmd-L). Then click on Run.

The path alias will show up in the Result window. The variable someScriptPath will contain the current script location. Close it, move it, open and run again. Voila.
Code:
set someScriptPath to (path to me)
That's the quick how-to. Variables do not persist in Applescript, so each time the script is run, someScriptPath will be handed the current path to it. Will that do what you are needing to get done?

HTH
Craig
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:38 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2