Thursday, October 6, 2022

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

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:


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



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)