I have been trying to follow a series of instructions posed on StackOverflow that show how the user was able to completely package their bash shell script inside of an ASOC application built with Xcode.
I have tried to follow these instructions and asked in a comment for a post that could help: http://stackoverflow.com/questions/18362914/is-there-a-way-to-package-bash-shell-scripts-with-applescriptobjc-app-on-macosx
I wasn’t able to get a reply from the original poster, so I started my own thread on StackOverflow too: http://stackoverflow.com/questions/19739287/embed-a-bash-shell-script-in-an-applescriptobjc-application-with-xcode/19754006?noredirect=1#comment29372277_19754006
I have a copy of a raw AppDelegate.applescript file below. Can anyone please show me, what changes are needed to be made, so that it can reference into itself, to link to a bash file so that I can link it to a button with:
onButtonHandlerBUTTONNAME_(sender)
do shell script "/path/to/shell/myScript.sh"
endButtonHandlerBUTTONNAME
This in turn would open up myScript, but using the code blow, how would I edit it, so it can reference to the myScript.sh file that I would package into my application with Xcode. I know how to add the file to the bundle etc etc, I just get lost around his step #4, and I’m getting lots of helpful answers, but nobody is giving me a clear and concise reply. I just need a template that works, and that way I can go back over all the answers and see how it works. It’s been quite a few weeks since I had set out to get this to work. What should be relevantly simple - has turned out to be quite difficult.
I’m very new to AppleScriptObjC. Bash scripting on the other hand, I would say well versed. I would like to be able to present my script solutions for people in nice simple packages and not entirely rely on rewriting everything into AppleScript code.
[code]script AppDelegate
property parent : class “NSObject”
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script[/code]