Created
June 20, 2014 12:57
-
-
Save gotunandan/68f6a2e874c8670b6411 to your computer and use it in GitHub Desktop.
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
-- Run as : osascript browser_url.scpt "Browser Name" | |
on run argv | |
set browser_name to item 1 of argv | |
tell application "System Events" | |
if browser_name is "Google Chrome" then | |
tell application "Google Chrome" to set theURL to URL of active tab of front window | |
else if browser_name is "Safari" then | |
tell application "Safari" to set theURL to URL of front document | |
else if browser_name is "Firefox" then | |
tell application "Firefox" to activate | |
tell application "System Events" | |
keystroke "l" using command down | |
keystroke "c" using command down | |
end tell | |
delay 0.5 | |
set theURL to the clipboard | |
else | |
return "Wrong Browser" | |
end if | |
end tell | |
return theURL | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment