Skip to content

Instantly share code, notes, and snippets.

@Koze
Last active August 29, 2015 14:16
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 Koze/b50d187fed615772b974 to your computer and use it in GitHub Desktop.
Save Koze/b50d187fed615772b974 to your computer and use it in GitHub Desktop.
JavaScript for Automation Objective-C bridge Sample
ObjC.import('Cocoa')
//var array = $.NSArray.arrayWithObjects($('jp'), $('us'), $('es'), $('ru'));
var array = $(['jp', 'us', 'es', 'ru']);
for (var i=0; i<array.count; i++) {
var string = array.objectAtIndex(i);
var URLString = $.NSString.stringWithFormat('http://store.apple.com/%@/product/MB110CH/B/', string);
var URL = $.NSURL.URLWithString(URLString)
$.NSWorkspace.sharedWorkspace.openURL(URL)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment