Currently, I am trying to open list of the URLs in the certain specified browser. I tried following without success. If anybody knows how to do it, please help.
-- script: Open list of URls in certain specified browser
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
-- get shared workspace object.
set sharedWorkspace to current application's NSWorkspace's sharedWorkspace()
-- get browser's NSURL
set appPath to POSIX path of (path to application id "com.google.Chrome")
set appURL to current application's |NSURL|'s fileURLWithPath:appPath
-- create array of URLs
set theURL to current application's |NSURL|'s URLWithString:"https://www.google.gr"
set URLArray to current application's NSMutableArray's new()
(URLArray's addObject:theURL)
-- FOLLOWING THROWS ERROR "unrecognized selector"
-- Trying to open list of URls in certain specified browser
sharedWorkspace's openURLs:URLArray withApplicationAt:appURL configuration:(missing value) completionHandler:(missing value)
I got help from the user @Shane Stanley. They helped me correct the syntax on the last code line. For those of you who are curious, the following code allows AsObjC to open multiple URLs in a non-default browser. You can of course indicate the default browser as well.
Cleaned version using handler: