0

I have an Applescript that opens the Safari developer tools. This saves me from the hassle of clicking Develop -> Inspect -> index.html every time I build a Cordova / Phonegap app.

I would now like to invoke this Applescript when I build the project and open it in the simulator.

I've tried adding a building phase and adding the script as instructed in https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaRunScriptBuildPhase.html.

However when I build the project in XCode I'm getting an error: "auto_opendevtools.applescript: bad interpreter: Permission denied". Seems all the permissions are fine.

How I entered the script in the build phase:

enter image description here

Leads to error:

enter image description here

1 Answer 1

6

The "Add Run Script Build Phase" need a shell command or a path of the shell script.

To run an AppleScript from a shell script, you must use the osascript command.

osascript "/the path of/auto_opendevtools.applescript"
Sign up to request clarification or add additional context in comments.

3 Comments

So should you put osascript "/the path of/auto_opendevtools.applescript Where it says "Shell:" or paste it in the field with that line of code above it?
@John Types the path or paste it in the field above the Shell's field
Or put #!/usr/bin/env osascript at the top of your script

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.