hananana
hananana

Reputation: 23

run Xcode via applescript(osascript)

i'm developing iOS by vim or atom. but there is thing i don't like. must press command + tab and then switch to Xcode when wanna run.

i found this script that resolution this problem. but it doesn't work well.

tell application "Xcode"
    activate
    tell application "System Events"
        perform (keystroke "r" using command down)
    end tell
end tell

or another applescript. it doesn't work too.

tell application "Xcode"
    activate

    set targetProject to project of active workspace document
    if (build targetProject) is equal to "Build succeeded" then
        launch targetProject
    end if
end tell

PLZ HELP.

Upvotes: 1

Views: 602

Answers (1)

vadian
vadian

Reputation: 285240

The first script is almost correct, just perform is wrong syntax

activate application "Xcode"
tell application "System Events"
    tell process "Xcode"
        keystroke "r" using command down
    end tell
end tell

Upvotes: 2

Related Questions