Is it possible to call javascript from AppleScript?

nice!!! I’ve been scripting for a long time, but I haven’t seen some of the syntax that you’re using. is most of it NSString stuff?

95%+ of that script was written by @ShaneStanley. I wouldn’t call it “NSString stuff”, but “ASObjC” stuff. :wink:

My only real contribution was in combining the scripts with this section:

if (pGlobalBool) then ### FIND ALL MATCHES ###
     set theFinds to theRegEx's matchesInString:pSourceString options:0 range:{0, pSourceString's |length|()}
     
   else ### FIND FRIST MATCH ###
     set theFind to theRegEx's firstMatchInString:pSourceString options:0 range:{0, pSourceString's |length|()}
     set theFinds to current application's NSMutableArray's array()
     (theFinds's addObject:theFind)
end if

I was able to deduce using the NSMutableArray's array() from the statements here and elsewhere that Shane has written.

If you want to have a chance at learning ASObjC, then I’d recommend Everyday AppleScriptObjC, Third Edition, by Shane Stanley.

just bought it. nice to have access to the Cocoa libraries.

1 Like