Create windows like shortcuts with parameters

Create a Windows like shortcut with parameters on the Mac.

Mac OSX doesn’t allow you to create shortcuts like Windows. The closest thing is to create an OSX alias but that doesn’t allow parameters (ex. create a Screen Sharing shortcut that connects to a specific computer). To create a Windows like shortcut with parameters on the Mac:

Creating the Application

  1. Create a new Automator application
  1. Add a “Run AppleScript” step with the following code:
on run {input, parameters}
	set command to ""
	set linefeed to ASCII character 13
	try
		try
			set scriptpath to POSIX path of (path to me)
			set this_file to (POSIX file scriptpath) as alias
			tell application "Finder"
				set command to the comment of this_file
			end tell
			do shell script command
		on error errStr number errorNumber
			display alert "Shortcut Error" message "Shortcut: " & linefeed & command & linefeed & linefeed & "Error:" & linefeed & "(" & errorNumber & ") " & errStr as critical buttons {"Done"} cancel button "Done"
		end try
	on error number -128
		set userCanceled to true
	end try
end run
  1. Save the application
    Now whenever you want to create a shortcut just make a copy of the saved application above (name it what you want, change its icon) and change its comments to the command you want to run.

Example Commands

Here are some example commands to get you started:

Launch an app

/Applications/Picasa.app/Contents/MacOS/Picasa
Note: To get the true path an an application, right click on it and then choose “Show package contents”. The app will be inside the /Contents/MacOS/ folder.
Tip: Use my “Copy File or Folder Path” for a quick and easy way to copy the full path of any file or folder.

Launch an app and have it open a file

exec “/Applications/iDentify.app/Contents/MacOS/iDentify” “/Users/johndoe/Documents/My Movie.m4v”

Screen share connect to a remote computer

open vnc://192.168.1.12

Open system preferences

open -a system\ preferences

Open a website

open https://jesseweb.com