Hi, just for those who are interested, I translated John Grubers ‚open urls in safari tabs‘-script to pure MacRuby.
The rather complex regular expression for detecting URLs in text is working fine in MacRuby! (AOT-compilation does not work yet, see ticket #821) -- Bernd #!/usr/local/bin/macruby # MacRuby version of http://daringfireball.net/2010/08/open_urls_in_safari_tabs begin framework 'Cocoa' rescue NSUTF8StringEncoding = 4 # defining constants by hand for AOT-compiled version NSWorkspaceLaunchWithoutActivation = 512 end regexp = Regexp.new '(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))' urls = STDIN.read.scan(regexp).uniq.map do |m| NSURL.URLWithString(m.first.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)) end.compact NSWorkspace.sharedWorkspace.openURLs(urls, withAppBundleIdentifier:nil, options:NSWorkspaceLaunchWithoutActivation, additionalEventParamDescriptor:nil, launchIdentifiers:nil) _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel