AMApplicationBuild 521 AMApplicationVersion 2.10 AMDocumentVersion 2 actions action AMAccepts Container List Optional Types com.apple.cocoa.string AMActionVersion 2.0.3 AMApplication Automator AMParameterProperties COMMAND_STRING CheckedForUserDefaultShell inputMethod shell source AMProvides Container List Types com.apple.cocoa.string ActionBundlePath /System/Library/Automator/Run Shell Script.action ActionName Run Shell Script ActionParameters COMMAND_STRING # md2pdf Quick Action — convert each selected Markdown file to PDF. # Files arrive as arguments ("$@") because inputMethod is set to 1. tool="$HOME/bin/md2pdf" [ -x "$tool" ] || tool="$HOME/dotfiles/bin/md2pdf" ok=0 fail=0 for f in "$@"; do case "$f" in *.md|*.markdown|*.mdown|*.mkd) if "$tool" "$f"; then ok=$((ok + 1)) else fail=$((fail + 1)) fi ;; *) # Skip anything that isn't Markdown. ;; esac done if [ "$fail" -gt 0 ]; then osascript -e "display notification \"$ok converted, $fail failed\" with title \"md2pdf\" sound name \"Basso\"" elif [ "$ok" -gt 0 ]; then noun="files" if [ "$ok" -eq 1 ]; then noun="file"; fi osascript -e "display notification \"$ok $noun converted to PDF\" with title \"md2pdf\"" fi CheckedForUserDefaultShell inputMethod 1 shell /bin/zsh source BundleIdentifier com.apple.RunShellScript CFBundleVersion 2.0.3 CanShowSelectedItemsWhenRun CanShowWhenRun Category AMCategoryUtilities Class Name RunShellScriptAction InputUUID 2A1B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5D Keywords Shell Script Command Run Unix OutputUUID 3B2C4D5E-6F7A-4B8C-9D0E-1F2A3B4C5D6E UUID 1A2B3C4D-5E6F-4A7B-8C9D-0E1F2A3B4C5E arguments 0 default value 0 name inputMethod required 0 type 0 uuid 0 1 default value name CheckedForUserDefaultShell required 0 type 0 uuid 1 2 default value name source required 0 type 0 uuid 2 3 default value /bin/sh name shell required 0 type 0 uuid 3 4 default value name COMMAND_STRING required 0 type 0 uuid 4 isViewVisible 1 location 309.000000:253.000000 nibPath /System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib isViewVisible 1 connectors workflowMetaData serviceInputTypeIdentifier com.apple.Automator.fileSystemObject serviceOutputTypeIdentifier com.apple.Automator.nothing serviceProcessesInput 0 workflowTypeIdentifier com.apple.Automator.servicesMenu