AppleScripts don't always work

I am having a problem with scripts that I’ve written. They work great on my computer… but when I move them to my client’s computers, they often don’t run the same or don’t run at all. Sometimes opening the applescript on the client’s machine and resaving the script will cause the script to start working.

All of the machines should be set up identical with 10.4.8. All of the machines are loaded from the same image.

Any ideas as to what causes this issue? Any tips as to how I can avoid having this happen?

I appreciate the help!

Jeff

Hi,

scripts saved as application (not bundle) work only on PPC or Intel machines depending on which processor type
the script has been complied.
If you save the script as application bundle, you get an Universal Binary, which works on both architectures properly

You need to give more specifics or a sample script that has issues, mostly because I myself can think of at least two things that can cause scripts to work on one machine and not another, such as:

–Scripts that reference applications often need to be re-saved on a new machine or else they give the “locate application” dialog box. You can work around this, but it’s annoying.

–UI scripting will be affected by the speed of the machine it’s running on, so sometimes you need to use the Delay command and slow-down the script for the slowest machine it will be on

Frankly, I got really fed-up with the whole “needing to resave on every machine thing” and “solved” the problem by moving to FaceSpan or AppleScript Studio. For whatever reason, scripts that need to use other applications seem more bulletproof when wrapped-up as a “real” application this way.

Thanks, Stefan and Calvin!

All the machines involved are PPC machines. I’ll try resaving as application bundle and see what happens.

I don’t have an example script at the moment that I can post, but I’m anticipating running into this issue.

I spent about 5-6 years scripting mainly in Quark and OS 9 before my department migrated to OS X. I had moved most of my department’s script library into OS X compatibility about 6 months before I left that company. So I don’t have as much experience with OS X scripting as I would like. It’s been very much a crash course for me. When I ran into the issue I described, I just went with the workaround of resaving on the specific problematic machine.

I never had the “locate application” box come up on these machines. The script just simply wouldn’t run or would fail at unexpected points. If I run into this again, I’ll post the script. I believe I know the workaround that you mentioned and I agree – it is annoying.

I’ve tried to account for slower machines in my scripts as well. I’ll keep an eye out for that to see if that is part of the problem. But I’ve seen this happen on two identical G5s – mine and the client machine.

I have recently been hired to write AppleScripts for another group. I’m going to be working offsite and want to develop a much more robust set of scripts which don’t require my intervention just to run.

I had assumed that wrapping the scripts in an AppleScript Studio or FaceSpan created app would solve the problem. Having all of the resources that the script needs to run located within the app itself seems like a better route than having the script be machine-dependent.

Thanks for the help and advice.

I’ve visited this forum a lot in past years. I’m looking forward to participating more as I start this new position.

Jeff

Very interesting. The scripts I use work on PPC and Intel. Would affected scripts work under rosetta?