Skip to content

Instantly share code, notes, and snippets.

@kbrock
Created July 8, 2009 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbrock/142530 to your computer and use it in GitHub Desktop.
Save kbrock/142530 to your computer and use it in GitHub Desktop.
# Apple Script to open google in a new tab
# tell application "Safari"
# make new document
# set URL of first document to "http://www.google.com"
# end tell
# rb-appscript to do the same
# app("Safari").make(:new => :document)
# app("Safari").documents[1].URL.set("http://www.google.com")
# MacRuby code to use the ScriptingBridge to do the same
framework 'ScriptingBridge'
require 'hotcocoa'
include HotCocoa
safari = SBApplication.applicationWithBundleIdentifier('com.apple.Safari')
#safari.make(:new=> :document) # <-- FAIL
safari.documents.first.URL='http://www.google.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment