0

I have an AppleScript file that I'm passing two values to and it is giving me this error:

execution error: {"file2"} doesn’t match the parameters {fileName, fileName2} for run. (-1721)

Here is the AppleScript:

on run {fileName, fileName2}

    set output to fileName & "|" & fileName2

end run

UPDATE:
On further testing if I add more parameters it seems to work. Is there an arguments array or parameters array that I can use instead?

2 Answers 2

1

Your handlers requires two parameters and you are only passing one. Post your handler call.

Sign up to request clarification or add additional context in comments.

Comments

1

You can use

on run argv
    repeat with aParameter in argv
        display dialog aParameter as string
    end repeat
end run

The on run-argument (here called argv) is an Applescript list that contains the parameters.

Enjoy, Michael / Hamburg

3 Comments

Is there a way to get the first and second parameter similar to how JavaScript works, such as argv[0] and argv[1]?
Try first item of argvand second item of argv etc.
Or you use on run {fileName, fileName2} but then you have to give exactly the given amount of parameters to your handler!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.