4 ms·
The problem is the Javascript language requires you to import the Cocoa stuff ObjC.import('Cocoa') And then you get stuff like task = $.NSTask.alloc.init tas
by dubcanada 12y ago
The problem is the Javascript language requires you to import the Cocoa stuff
ObjC.import('Cocoa')
And then you get stuff like
task = $.NSTask.alloc.init
task.running == task.isRunning
The AppleScript version
if application "iTunes" is running then
--- Do stuff...
end if
It may just be me, but in some cases the AppleScript version is easier and better.
- linguafranca 12y agoI think you're misreading the document, I don't think you actually have to instantiate an NSTask in order to compare whether another application is running. You would just do something like this: Mail = Application('Mail') if (Mail.isRunning) { ... }
- oatmeal_coffee 12y agoThe Cocoa/Objective-C links are for building apps, not higher-level automation.