Automator: Correct syntax for calling an AppleScript file

applescriptautomator

I'm attempting to write an Automator application that will mount an external disk. I have an AppleScript that does the job and I'm attempting to insert it into an Automator application. However, rather than paste in the script I want to call the file, I have the following in Automator:

on run {input, parameters}
    run script file "Macintosh HD:Users/username/Documents/Scripts and Automator/mountdrive.scpt"
end run

However, this produces a syntax error:

Can’t make some data into the expected type.

Any suggestions as to the source of the problem?

Best Answer

run script also accepts a "POSIX path", you don't need the explicit run handler:

run script "/Users/username/Scripts and Automator/mountdrive.scpt"

You could also add a Run Shell Script action where the content is osascript ~/Documents/Scripts\ and\ Automator/mountdrive.scpt.