Skip to content

Instantly share code, notes, and snippets.

@Reflejo
Created March 13, 2014 21:24
Show Gist options
  • Save Reflejo/9537281 to your computer and use it in GitHub Desktop.
Save Reflejo/9537281 to your computer and use it in GitHub Desktop.
#!/usr/bin/env osascript
on run argv
if count of argv < 1 then
logEvent("Usage: ./changeVersion iOSVersion(7.1,7.0)")
error number -128
end
set iOSVersion to item 1 of argv
tell application "Xcode" to activate
try
tell application "System Events"
tell process "Xcode"
tell menu bar 1
tell menu bar item "Product"
tell menu 1
tell menu item "Destination"
tell menu 1
tell menu item "iPhone Retina (4-inch)"
tell menu 1
click menu item ("iOS " & iOSVersion)
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
on error errMsg
logEvent ("Error: " & errMsg)
end try
end run
to logEvent(themessage)
do shell script "echo '" & themessage & "' >> ~/Library/Logs/AppleScript-events.log"
end log_event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment