Created
July 16, 2011 21:09
-
-
Save digitalpardoe/1086795 to your computer and use it in GitHub Desktop.
'Merge All Windows' AppleScript
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
on gui_scripting_status() | |
tell application "System Events" | |
set ui_enabled to UI elements enabled | |
end tell | |
if ui_enabled is false then | |
tell application "System Preferences" | |
activate | |
set current pane to pane id "com.apple.preference.universalaccess" | |
display dialog "The GUI scripting architecture of Mac OS X is currently disabled." & return & return & "To activate GUI Scripting select the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Okay"} default button 1 | |
end tell | |
end if | |
return ui_enabled | |
end gui_scripting_status | |
on click_menu(app_name, menu_name, menu_item) | |
try | |
tell application app_name | |
activate | |
end tell | |
tell application "System Events" | |
click menu item menu_item of menu menu_name of menu bar 1 of process app_name | |
end tell | |
return true | |
on error error_message | |
return false | |
end try | |
end click_menu | |
if gui_scripting_status() then | |
click_menu("Safari", "Window", "Merge All Windows") | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment