A template for creating Droplets for Mac OS X that will pass dropped files to an embedded script
- Drop an executable script or binary onto the "script2droplet-droplet" icon in Finder
- There is no step 2
- Replace the
main
file in "Show Package Contents" Contents/Resources/Scripts with the script you want run - There is no step 2
The only "drag-and-droppable" save option for AppleScript is "File Format: Application". This has the side effect of not allowing you to right click the app in Finder and choose "Open with...". To edit, you have to either drag this app on top of the AppleScript Editor app, or from the command line do:
open -b com.apple.ScriptEditor2 script2droplet-droplet.app
Editing the AppleScript will allow you to change 3 options:
## Set use_terminal to true to run the script in a terminal
set use_terminal to true
## Set exit_terminal to false to leave the terminal session open after script runs
set exit_terminal to true
## Set log_file to a file path to have the output captured
set log_file to "/tmp/droplet.log"
Because AppleScript stores its code in a binary format, it is difficult to use with version control. The included .gitconfig
can be added to your .git/config to allow text conversion before diffing. It complements the included .gitattributes file
Add it to your .git/config like so:
cat .gitconfig >> .git/config
Alternatively, you can use a git 1.7.10+ style include by adding these lines to your .git/config
[include]
path = ../.gitconfig
Just uses the BSD command "file" to return info about each of the dropped files.
This is a script that, when placed in a droplet, will create a droplet from the dragged script. Yo dawg!
A copy of this is used as the default main
in AppleScript-droplet.app/Contents/Resources/Scripts/
Uploads each of the dropped files to a configurable folder in Dropbox and returns (and copies) the public URL (assuming you have configured it to use a public folder). Requires Dropbox-Uploader be installed and configured in advance.
Uploads each of the dropped files to imgur and returns (and copies) the public URL. Currently these are anonymous. (patches welcome)
Create a new Dropbox Droplet like so:
cp -r AppleScript-droplet.app Dropbox-droplet.app
cp scripts/dropbox.sh Dropbox-droplet.app/Contents/Resources/Scripts/main
Create a new Imgur Droplet like so:
cp -r AppleScript-droplet.app Imgur-droplet.app
cp scripts/imgur.sh Imgur-droplet.app/Contents/Resources/Scripts/main