4

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?

2

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.

| improve this answer | |
1

Try:

on run {input, parameters}
    set myScriptPath to (path to documents folder as text) & "Scripts and Automator:mountdrive.scpt"
    run script alias myScriptPath
end run
| improve this answer | |
  • Thx for the response. The issue has to do with the separators, they should be ':' – dorich Sep 24 '13 at 5:23
1

Apparently the problem with the syntax is that the path needs to be separated by ':' as opposed to '/'. Posix uses '/' and Apple uses ':'

| improve this answer | |

You must log in to answer this question.

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