Monday, October 20, 2014

#1 2005-10-13 04:04:07 pm

julifos
Administrator
From: MalasaƱa, Madrid
Registered: 2002-11-20
Posts: 2014

How can I get the path to my script, or the dir containing my script?

You can use the command path to, from Standard Additions, which will return, by default, the full path to the "guy who is running the script code".

If you have saved your script, and are running it as an application, you can get the path to your script, and the folder containing it using the following code:

Applescript:

set myPath to (path to me)
tell application "Finder" to set myFolder to folder of myPath

If you run this script from within the Script Editor application, you will get the path to the Script Editor.  Certain third-party script editing applications, such as Script Debugger offer settings, which may be modified so that the "path to me" term returns the path to the script application, rather than the editor.


Filed under: Finder

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.028 seconds, 8 queries executed ]

RSS (new topics) RSS (active topics)