Skip to content

Instantly share code, notes, and snippets.

@revolunet
Last active August 29, 2015 14:26
Show Gist options
  • Save revolunet/bed17b9809fffa77b4b8 to your computer and use it in GitHub Desktop.
Save revolunet/bed17b9809fffa77b4b8 to your computer and use it in GitHub Desktop.
Applescript : open safari-console-simulator
tell application "Safari"
activate
tell application "System Events"
tell process "Safari"
set frontmost to true
set DevMenuIndex to (count menu bar items of menu bar 1) - 3
set MainMenu to menu 1 of menu bar item DevMenuIndex of menu bar 1
if menu item "iOS Simulator" of MainMenu exists then
set Simulator to menu item "iOS Simulator" of MainMenu
set SimulatorApp to menu 1 of Simulator
set LastMenuEntryIndex to (count menu items of SimulatorApp)
click menu item LastMenuEntryIndex of SimulatorApp
else if menu item "iPad" of MainMenu exists then
set Device to menu item "iPad" of MainMenu
set DeviceApp to menu 1 of Device
set LastMenuEntryIndex to (count menu items of DeviceApp)
click menu item LastMenuEntryIndex of DeviceApp
end if
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment