Applescript Differences in PPC Vs Intel?

Howdy

FYI- I am on OS X 10.4.7, Powerbook G4
I emailed my script off to a friend for testing. He is on a MacBook Pro, OS X 10.4.7. The OS is the exact same as mine.

Well, anywho, he launches each script from the launcher, and it errors with “An unkown token can’t go here”. I am unable to reproduce this on my computer. All but 1 of the 4 scripts errors in this way

I then noticed that the one script that did work was an Application Bundle, while all of the others were applications. So I resaved them all as application bundles and sent it off. This produces an error on all 4 now. “Can’t make (app name here) into type constant”

I am, of course, unable to reproduce any of these errors myself. Does anyone know what might be causing this? Does the intel processor handle scripts differently that might be causing them to error?

The processor doesn’t know what a script is; AppleScript is much higher than the hardware.

I’d go back an investigate the script and your compilation process.

Edit: If you like, post the code here. Perhaps there’s something others can see that you’re missing.

If I were you, just save them as application bundles and try that. It dosen’t cahnge mutch does it?

I didn’t think so. The odd thing was that once I sent them all saved as application bundles, none of them worked. I can’t seem to pin down whatever is causing this, since they all work fine on my computer…

Is there anything in the script(s) that’s specific to your computer? A path? An alias? A third-party scripting addition? An application? Is your friend able to run the offending script in Script Editor to see where the error occurs?

It’s not possible for us to be of more help without seeing the code.

Again, posting the code is the only way we can tell you what’s going on.

Here’s one of them.

tell application "Finder"
	set instloc to (choose folder with prompt "Choose your devhook folder") as string
	try
		set e1 to (instloc & "PSP:GAME:%__SCE__DH_ENG") as alias
	on error
		display dialog "Some files are either missing, or not named correctly. Try running Homebrew Renamer on the Devhook files, and try again."
		return
	end try
	set e2 to (instloc & "PSP:GAME:__SCE__DH_ENG") as alias
	set dh to (instloc & "dh") as alias
	display dialog "Please be sure your PSP is plugged in to the computer, and in USB mode before continuing" buttons {"Cancel", "OK"} default button 2
	if button returned of the result is "Cancel" then
		quit
	else
		if button returned of the result is "OK" then
			set disklist to list disks
			set pspstick to (choose from list disklist with title "Choose your PSP Memory Stick")
			if pspstick is false then return
			set gameloc to ((pspstick as string) & ":PSP:GAME:") as alias
			set psploc to (pspstick as string) as alias
			duplicate folder e1 to gameloc with replacing
			duplicate folder e2 to gameloc with replacing
			duplicate folder dh to psploc with replacing
		end if
	end if
	display dialog "Installation Successful!" buttons {"OK"}
end tell

Once again, this works fine for me, but errors with the errors I mentioned above on my friends computer.

Have you tried using Unicode text instead of string?

The application part of a script saved as an application by a PPC machine is compiled for a PPC processor, whereas application bundles are compiled (in Tiger) in “Universal” format. That might explain why the original bundle script worked on the Intel machine when the application ones didn’t ” though I don’t know if Intel Macs have a PPC interpreter or not. It doesn’t explain, of course, why all of the scripts error ” even the one that used not to ” when they’re all resaved as bundles.

The script you posted could be written better, but I can’t see any reason why it shouldn’t actually work, unless your friend’s memory stick doesn’t have a folder called “PSP” and another folder in that called “GAME”.

Bullet points regarding AppleScript and Intel Macs:

  • PowerPC binaries run under the Rosetta translation layer on Intel machines. This does not affect raw scripts. (They’re not compiled binaries, and are interpreted at runtime by the Universal Binary AppleScript engine.)

  • If a script is saved, via Script Editor, as an “application bundle” on Intel, the resulting application is compiled as a Universal Binary and will run just the same on 10.3.9 and later for PowerPC machines.

  • If a script is saved, via Script Editor, as an “application” on Intel, the resulting application is PowerPC, not Universal. This application runs under the Rosetta environment.

  • If you’re using AppleScript Studio and have built your project as Intel-only, it won’t run at all on PowerPC–you won’t get script errors like “unknown token”, it simply will refuse to run.

  • Studio apps built in Xcode using the Mac OS X 10.4 (Universal) SDK will run on PowerPC Macs running 10.3.9 or later unless you’ve specified some wacky compiler commands or are using non-AppleScript code that doesn’t compile as UB.

What do you mean? What is this “launcher”?

Could your friend using File Vault.
I ran in to a problem in the past, I can not remember all the details
But File Vault has problems with Alias or Posix paths which work normally in none File Vault Accounts.

If that is not the problem,

Try sending the script to your friend as text and let them compile it to see if it works.

Also what is the Unknown Token ??

Thanks for the information, Mikey-San. I’ve only been following the Intel Mac stuff superficially as I’m not likely to be getting one for a while!

One simple thing to try if you haven’t done it already:

I have had scripts not work that I have e-mailed to people. Have you been stuffing the scripts into an archive to e-mail them? That can help to keep them from getting corrupted in the e-mail process.

Model: Mac G5 OS 10.3.9
Browser: Safari 312.3.1
Operating System: Mac OS X (10.3.9)

I believe there is a standard error message for applications that can’t run on the current architecture.

I think what Matt-Boy said could be right. Because i’ve sent little games I made to people over iChat and they said they couldn’t open them. Maybe the same thing happens with email sometimes.

I have also seen issues with application bundle scripts having the permissions of the contents of the the bundle get out of wack when they are transfered from computer to computer. You can avoid this by putting your scripts on a small disk image and sending him the disk image.