Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers 3

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
share|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
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.