Skip to content

Instantly share code, notes, and snippets.

@prashanthrajagopal
Last active March 14, 2025 03:35
Show Gist options
  • Save prashanthrajagopal/08ab39d62725c8a8716b to your computer and use it in GitHub Desktop.
Save prashanthrajagopal/08ab39d62725c8a8716b to your computer and use it in GitHub Desktop.

Revisions

  1. prashanthrajagopal renamed this gist Jun 20, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. prashanthrajagopal created this gist Jun 20, 2014.
    20 changes: 20 additions & 0 deletions get_url
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    display dialog "Name of the browser?" default answer "Safari"
    set inp to text returned of result

    tell application "System Events"
    if inp is "Google Chrome" then
    tell application "Google Chrome" to return URL of active tab of front window
    else if inp is "Safari" then
    tell application "Safari" to return URL of front document
    else if inp 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
    return the clipboard
    else
    return
    end if
    end tell