Last active
December 15, 2016 12:28
-
-
Save qkdreyer/14ea36ce3bc9cc5632b78252fe35ec76 to your computer and use it in GitHub Desktop.
Automatically open Safari Web Inspector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
# Automatically open Safari Web Inspector | |
set _browser to "Safari" | |
set _develop to "Développement" | |
set _inspector to "Inspecteur web" | |
set _phone to "iPhone" | |
set _ignore to "about:" | |
tell application _browser to activate | |
tell application "System Events" | |
repeat with _window in every window of process _browser | |
if title of _window contains _inspector then | |
return | |
end if | |
end repeat | |
set _winCount to count windows of process _browser | |
repeat with developMenuItem in menu items of menu _develop of menu bar item _develop of menu bar 1 of process _browser | |
if _phone is in name of developMenuItem then | |
set apps to entire contents of developMenuItem | |
repeat with _app in apps | |
if (_ignore is not in name of _app) and (count (name) of _app) is greater than 0 then | |
click _app | |
if (_winCount is less than (count windows of process _browser)) then | |
return | |
end if | |
end if | |
end repeat | |
exit repeat | |
end if | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment