Skip to content

Instantly share code, notes, and snippets.

@rociiu
Created February 22, 2010 15:07
Show Gist options
  • Save rociiu/311135 to your computer and use it in GitHub Desktop.
Save rociiu/311135 to your computer and use it in GitHub Desktop.
macruby script that get the current browsing web url from safari
# macruby script that get the current browsing web url from safari
apple_script = <<-APPLESCRIPT
tell application "Safari"
set a to URL of front document as string
return a
end tell
APPLESCRIPT
script = NSAppleScript.alloc.initWithSource(apple_script)
result = script.executeAndReturnError(nil)
result.stringValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment