Path to my action script from within "awake from nib" method?

I need to obtain the path to my script or action bundle from within the awake from nib method, because I need to execute a shell script that’s stored in the action bundle. Does anybody know how to do that?

When my main.applescript executes, I can use path to me, which returns the path to the executing script, and from that generate the path to the script. But when I’m in Automator’s “design mode” (configuring the action), that call returns the path to Automator.app.

I’ve experimented with bundle path and call method “bundleWithPath:”, but it all comes back to Automator.app.

Any ideas would be much appreciated.

Thanks,
Joachim

Same thing happens when running scripts in a Script Editor. I think this script by Kai might help:


set d to text item delimiters -- record how they were
set text item delimiters to ":"
set f to (path to me as string)'s text --1 thru text item -3 & ":"
set text item delimiters to d -- put them back as they were
display dialog f

Thank you very much for your suggestion, Adam.

Unfortunately, your method still only gives me the path to Automator.app. I need the path to my script in my action bundle.

As mentioned in my original post, I need to obtain the path to my bundle where I have a script stored. When configuring my action in Automator, path to me returns the path to Automator.app, but when the action is being executed, it returns the path to the script in my bundle, and this is what I need when configuring my action and composing my workflow in Automator.

Cheers