0

I tried to get an output of NSAppleScript execution in runtime, but I found the solution only where I can get the output after script's execution. I want to get output step by step like using NSTask with NSFileHandleDataAvailableNotification notifications and waitForDataInBackgroundAndNotify method.

I cannot use NSTask because I need a script execution with root privileges.

Maybe I can use default stdout with NSAppleScript for that purpose, but I don't know how.

chudin26
  • 1,153
  • 2
  • 7
  • 9
  • You could use Cocoa Scripting to make your script vend and update an NSProgress object. – matt Dec 22 '17 at 00:42
  • What do you mean by Cocoa Scripting? Can you show me an example of using that? – chudin26 Dec 22 '17 at 00:49
  • 1
    Perhaps you know it as AppleScriptObjC. The point is, you can use AppleScript to create an manage an Objective-C object, and now your Objective-C code can respond. For example: http://forum.latenightsw.com/t/applescriptobjc-nsprogress/300 – matt Dec 22 '17 at 00:49
  • 1
    Similarly here https://stackoverflow.com/questions/32010649/cocoa-applescript-determinate-progress-indicator – matt Dec 22 '17 at 00:52
  • Sounds interesting. Thank you. I will research for that – chudin26 Dec 22 '17 at 00:53

0 Answers0