Skip to content

Instantly share code, notes, and snippets.

@acoomans
Created March 12, 2013 23:53
Show Gist options
  • Save acoomans/5148179 to your computer and use it in GitHub Desktop.
Save acoomans/5148179 to your computer and use it in GitHub Desktop.
Simulator version and device change scripts
#!/bin/sh
exec <"$0" || exit; read v; read v; exec /usr/bin/osascript - "$@"; exit
-- Your AppleScript here
on run argv
if (count argv) is 0 then
set DeviceName to "iPad"
else
set DeviceName to item 1 of argv
if DeviceName is "ipad" then
set DeviceName to "iPad"
end if
if DeviceName is "ipad-retina" then
set DeviceName to "iPad (Retina)"
end if
if DeviceName is "iphone" then
set DeviceName to "iPhone"
end if
if DeviceName is "iphone-retina" then
set DeviceName to "iPhone (Retina 3.5-inch)"
end if
if DeviceName is "iphone5" or DeviceName is "iphone5-retina" then
set DeviceName to "iPhone (Retina 4-inch)"
end if
end if
log "Changing simulator device to " & DeviceName
tell application "iPhone Simulator"
activate
end tell
tell application "System Events"
tell process "iOS Simulator"
tell menu bar 1
tell menu bar item "Hardware"
tell menu "Hardware"
tell menu item "Device"
tell menu "Device"
click menu item DeviceName
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end run
#!/bin/sh
exec <"$0" || exit; read v; read v; exec /usr/bin/osascript - "$@"; exit
-- Your AppleScript here
on run argv
if (count argv) is 0 then
set VersionName to "6.1 (10B141)"
else
set VersionName to item 1 of argv
if VersionName is "6.1" then
set VersionName to "6.1 (10B141)"
end if
if VersionName is "6.0" then
set VersionName to "6.0 (10A403)"
end if
if VersionName is "5.1" then
set VersionName to "5.1 (9B176)"
end if
if VersionName is "5.0" then
set VersionName to "5.0 (9A334)"
end if
if VersionName is "iphone5" or VersionName is "iphone5-retina" then
set VersionName to "iPhone (Retina 4-inch)"
end if
end if
log "Changing simulator version to " & VersionName
tell application "iPhone Simulator"
activate
end tell
tell application "System Events"
tell process "iOS Simulator"
tell menu bar 1
tell menu bar item "Hardware"
tell menu "Hardware"
tell menu item "Version"
tell menu "Version"
click menu item VersionName
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment