Perhaps I wasn’t clear in my post. My question is can I run a binary file which I will copy into the project using NSTask. The reason is I need to use notification to display the output in a textView. Hope this helps.
I’m still not 100% sure what you mean, but if you’re asking if you can include a binary in your app’s bundle and run it form there via NSTask, the answer is yes.
Your last couple of messages seem to have disappeared, but your “set theResult to…” statement should be moved to after the waitUntilExit(), and probably to after you have checked that terminationStatus() is OK.
Shane my apologies, Safari went into the spinning ball and I tried to get out and I clicked every where. Not sure why this happened. I will post the code today.
The script works all now and I am able to get the return code. Thank you.
Shane, this app brought up another challenge and that is how to protect adobe’s prov.xml license file that is contained in the app bundle. Is there a way to make it inaccessible since I will distribute the app to all departments on campus. I thought of encrypting the file but don’t know how. Does Cocoa have its own way of accomplishing this?
on runApp:sender
set theBundle to current application's NSBundle's mainBundle()
set file1 to theBundle's pathForResource:"adobe_prtk" ofType:""
set file2 to theBundle's pathForResource:"prov" ofType:".xml"
set outPipe to current application's NSPipe's pipe()
set outFileHandle to outPipe's fileHandleForReading()
set theTask to current application's NSTask's alloc()'s init()
tell theTask
setLaunchPath_(file1)
setArguments_({"--tool=VolumeSerialize", "--provfile=" & file2})
setStandardOutput_(outPipe)
|launch|()
end tell
set theData to outFileHandle's readDataToEndOfFile()
set theResult to current application's NSString's alloc()'s initWithData:theData encoding:(current application's NSUTF8StringEncoding)
theTask's waitUntilExit()
set newResult to theResult
log theResult
if theTask's terminationStatus() as integer is 0 then
set theResult to "Failed."
log theResult
else
set theResult to "success"
log theResult
end if
end runApp: