Running other scripts with AppleScript

March 22, 2016
Category: TIL

Today I learned:

Getting current folder in AppleScript

-- Getting path to this file
tell application "Finder" to get folder of (path to me) as Unicode text
set currentLocation to result
set currentPOSIX to POSIX path of currentLocation

Running other AppleScript files

run script file "HD:path:to:file.scpt"
-- How it is used with above file path
run script file (currentLocation & "reformat_with_textwrangler.scpt")

Running multiple shell commands

do shell script "command 1; command 2;"
-- How it is used with above file path to change directory and run a script
do shell script "cd " & quoted form of currentPOSIX & "; python " & "count_days.py"

Find this post useful?

Buy me a coffeeBuy me a coffee