I have an AppleScript that I would like to be able to use from anywhere in the file system. Currently, it has some paths which are hardcoded, so it runs only from the Downloads folder. How should I go about getting the current path to the AppleScript and then appending a subdirectory to that path once obtained?

Setting the current path to the script as a variable would be preferable (perhaps current_path).

2 Answers 2


You can get the path of the current script with path to me. Extracting the path to the directory containing the script is slightly tricky:

tell application "Finder"
    set current_path to container of (path to me) as alias
end tell
  • 3
    If posix path is needed add the following command before end tell : set p to POSIX path of current_path
    – Marc_Alx
    Dec 6, 2017 at 10:27
  • 2
    This worked for me to get the app's path and append a subdirectory; set current_path to (POSIX path of (container of (path to me) as alias)) & "subdirectory/"
    – jgraup
    Jan 16, 2018 at 21:29

'alias' gave me an error. This worked for me

set my_POSIX_path to POSIX path of ((path to me as text) & "::")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .