Posted on 04-07-2016 02:44 PM
Hello,
I have a straight bash script that copies (rsyncs) one folder to another. Using it for OS X home folder for backup and restore.
I have so that it has menus. Essentially backup, restore, etc, options.
User has to select the "Source" and "Target" folders (drag and drop into terminal), and off it goes.
In my efforts to make this simple, our techs still are having issues with scripts / terminal. Would be better and easier as an app.
Have seen Platypus in conjunction with Cocoa Dialogue, in which Platypus will take the script and make it it an OS X app, and Cocoa Dialogue, should allow interaction.
http://sveinbjorn.org/platypus_cocoadialog
Following this, but not getting interaction dialogue windows, (probably has to be specifically scripted, I am guessing).
Or perhaps there is a way to do this is Xcode/Swift.
thx, john
Posted on 04-07-2016 07:37 PM
Platypus is a good way to do this. I've used it for a few solutions. Best thing to do is run one of their example scripts first, confirm all is well and work backwards from there.
Posted on 04-08-2016 08:53 AM
I've built several apps in Platypus that also use cocoaDialog as part of its UI elements. The tricks to getting this to work are:
Here's one way to do it:
## Get script working directory path
workingDir="$(pwd)"
## Set path to bundled cocoaDialog executable
cdPath="$workingDir/cocoaDialog.app/Contents/MacOS/cocoaDialog"
Then later in the script, whenever you need to use cocoaDialog, you do something like:
"$cdPath" msgbox --title "This is a title" --text "Hello" --button1 OK
Once you build the final app, cocoaDialog.app is copied into the MyApp.app/Contents/Resources/
folder.
Doing it this way it becomes a self contained double clickable app that doesn't require a separate dependency of having cocoaDialog installed somewhere else on the Mac.
Posted on 04-08-2016 10:28 AM
Using Xcode is easier than it may first seem. By using a basic Applescript program that calls shell functions, you can do quite a lot very easily.
I was hoping to write more, but I have just a very basic blog post that may get you started.
I learned from Shane Stanley's AppleScriptObjC