How to get the application folder from Automator application?
5 июня 2013
I’ve got a complex Automator workflow that currently has to launch my Psi+. Currently these directories live in a specific location that’s hard coded into the workflow. What I’d like to do is have the workflow be able to reference it’s own package and launch the Psi+ from the same folder.
I’m thinking the most likely way to do it at this point is with AppleScript, and I’ve looked into that a little, and I can find a way to get the location of the workflow itself.
I create new instance of Run AppleScript with this code:
tell application "Finder"
set thePath to (POSIX path of (path to application "psiPort"))
set AppleScript's text item delimiters to "psiPort.app"
text item 1 of thePath
And create instance of Run Shell Script with this:
open -a $1application/Psi+.app/Contents/MacOS/psi-plus
Turn Pass input of Run Shell Script to «as arguments»
Here is screenshot of my workflow: