3

I am trying to create an Automator application which I will be distributing to other users on the network. The automator app will be accompanied by a ZIP file and a PKG installer file.

I need to run the PKG installer file the automator app. For this I'm trying to use the Run Shell Script using the following command:

open gdata.pkg

The problem I'm having is that Automator cannot find this file. I think it doesn't pick up the current path. I tried changing it to following ways:

Experiment #1:

cd $@; open gdata.pkg

Experiment #2:

open ./gdata.pkg

Both didn't work for me. Automator keeps giving error that it couldn't run the script. How do I accomplish this here?

My next step after this would be to decompress the accompanied ZIP file onto a new folder on user's desktop.

3

Use a Run AppleScript action with the following to get the path:

POSIX path of (path to me)

When run in the workflow, this provides the path to Automator.app, but when run by launching the saved application, this provides the path to the application.

  • 1
    Ok that was a good lead. I've managed to develop a code to make it happen: 'set pathToMe to POSIX path of (path to me as text)', and (set script1 to "dirname '" & pathToMe & "'"), and (set dirPath to do shell script script1), then finally (do shell script "open '" & dirPath & "/GData.pkg'"). I'm not sure if this is the best way to make this work. – Faraz Azhar Jan 17 '15 at 17:02
-2

I'd post the answer here, but this article already fully captures it, so shrug:

http://albertech.blogspot.com/2011/08/get-path-of-running-script-with.html

  • 1
    As apt as the article might be, sometimes they get taken offline, so we'd appreciate it if you quoted or paraphrased it here. – Timothy Mueller-Harder Nov 14 '16 at 4:36
  • The question already has an accepted answer and your link only answer provides the same thing (path to me) and therefore is needlessly redundant! – user3439894 Nov 14 '16 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .