Location of current AppleScript

I know this should be really simple, but I’ve been applescripting for ages, and have never worked it out…

Is there a simple way to find the location of the applescript being executed? eg.
I have applescript “bob.app” in applications as a bundle, and xyz.txt is inside it…
If I want to copy xyz to somewhere, I need to know the location of it, or some way to execute things relative to the location of the script…

does that make sense?

If anyone could help, it’d be great, I’m actually trying to make an installer of sorts…

I think it is - try:

set pathToMyAppleScript to (path to me)

D.

I knew that :stuck_out_tongue: :wink:

Is there anyway to format it without the machd:applications:bob.app into a terminal compatible command? i.e. /applications/bob.app/ ?

Probably a bash script is the most likely way, or is there some other applescript command I should know but don’t? :wink:

of course:

set pathToMyAppleScript to POSIX path of (path to me)