javascript - NSTask completion -
how provide callback know when task has completed? need set nsrunloop or something?
objc.import('cocoa'); exec("/usr/bin/say",["hello"]) function done(notification) { $.nslog('application done'); $.nslog(notification); } function exec(cmd,args){ var task = $.nstask.alloc.init task.launchpath=cmd task.arguments=args task.terminationhandler = $(done) // not work! task.launch $.nslog("running: "+task.running) homecoming task }
ps language javascript automaton, new osascript language yosemite os x 10.10
i'm not sure if have tried this, maybe worth give shot , see if works you..
i think, seek using 1 of these 2 functions.. $.performselector...
, see if works you..
[self performselectoronmainthread:@selector(mytask) withobject:nil waituntildone:yes]; [self performselector:@selector(mytask) onthread:[nsthread mainthread] withobject:nil waituntildone:yes];
i hope helps..
javascript objective-c automation osx-yosemite osascript
No comments:
Post a Comment