Skip to content

Instantly share code, notes, and snippets.

@jgraup
Last active January 1, 2016 00:19
Show Gist options
  • Save jgraup/8066160 to your computer and use it in GitHub Desktop.
Save jgraup/8066160 to your computer and use it in GitHub Desktop.
Automator Workflow: Add service to right-click and run php file in Finder. Based on http://superuser.com/questions/373284/how-create-an-os-x-service-that-passes-a-files-path-to-a-shell-script
# Automator Service: Optimize Image files or folder
# Link: http://imageoptim.com/command-line.html
# Service receives selected (files or folders)
# in Finder.app
# Shell: /bin/sh
# Pass input: as arguments
open -a ImageOptim "$@"
# Automator Service: Right-click to open or run php file
# Service receives selected (files or folders)
# in Finder.app
# Shell: /bin/sh
# Pass input: as arguments
# If file ends with .php then run it,
# otherwise just open the file
if [[ "$@" == *.php ]]
then
/usr/bin/php "$@"
else
open "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment