Getting the directory the script is in

Hi there,

I am attempting to get the directory the script is in. Using ((path to me) as text) gets the scripts location and the script file itself. Does anyone know a way of either backtracking one level from this (so the directory is returned) or retriving the directory location directly?

Thanks

There are a couple of ways of doing this (namely, set the path to a string, change AppleScript’s text item delimiters to {“:”} then parse through the string’s text elements concatenating until you get to text item -2 then setting the delimiters back to what they were before and coercing the string to an alias). I, however, prefer:

Some people prefer not to invoke the Finder whenever possible because it is a performance hit to the script but sometimes, it’s just easier.

Jon

Thanks for that, it worked like a treat.

Cheers