Path of current AppleScript file

I’m sure this has been answered here before, but I’m not sure how to search for it. What I need to know is if there is a way to get hold of the path of the currently-running AppleScript. So, for example, if there is a script called MyScript.scpt (or .app, for that matter) which lives at the following disk location:
myDisk:myFolder:myCode:MyScript.scpt

I would like, at runtime, to be able to get hold of the path myDisk:myFolder:myCode:

Is there a way to do that?

Hi,

it’s just

path to me

which returns an alias or

path to me as text

to get the HFS path

Way cool, thank you very much StefanK :slight_smile:

Path to me has been changed in Panther, Tiger and Leopard. So when searching MacScripter you would see different answers. A good question, even if it’s been asked dozen of times.

Oh OK, thanks for that. As I said I asked because I really couldn’t figure out what to search for. It’s like the time I asked how to unpack a container because the only word I could think of googling was “of”!!!:confused: At least this time the answer is “yes, you can do that and here’s how”. Thanks again, guys.