Adding external scripts/files

Hi, all:

I’m trying to write a simple app in AS Studio that interfaces with a command line tool for Centrify Direct Control and Active Directory. My app has simply 4 text fields where the user fills out a username, password, an old computer name and a new computer name (it’s used in renaming a computer in the domain). I have a very small perl script that needs to be called in the AS with a parameter that’s from one of the text fields.

I have added the perl script ( to the project (with the Add>Existing Files… action in the project window) and it shows up in the scripts folder group with the AS itself. I chose to keep the reference type as “Default”.

I want to call this script with a “do shell script” command in my AS, but every time I try it out, I get an AS error that says the perl script can’t be found. It’s in the application package in the Resources folder after my app is built. Does anyone know how to access an external script file in this way? I tried simply:

do shell script "usr/bin/perl " & textField1


do shell script "usr/bin/perl …/ " & textField1 (thinking that the is simply in the root of Resources and the AS is in Resources/Scripts).

Both of these produce errors where cannot be found.

Any ideas?

Thanks in advance!


Hi Jason,

You need to provide the full path to the script.

Try this in your app.:

set myScriptPath to POSIX path of (path to me) & "Contents/Resources/"
do shell script "usr/bin/perl " & quoted form of myScriptPath & space & textField1

‘path to me’ should return the path to your application. You then need to add the relative path to the script. This includes the folder ‘Contents’.

Best wishes

John M

Great! I’ll give that a shot. Thanks for the info!


John, that worked like a champ… thanks again!