Bizarre Applescript Problem

Ok, so all of a sudden the scripts I use on a day-to-day basis look like they’ve been changed.

Where it used to say: key code 49
It now says: «event prcskcod» 49

I’m seeing other commands being replaced by weird events like…

key down to «event prcskeyF»
key up to «event prcskeyU»
Now when I run the scripts they don’t work.

I wrote a perfectly working script on my MacBook transfered it to the Mac with the problem and when I opened it all the key up, key down and key code commands were replaced by events. The script doesn’t work if I run it like this or if I restore the correct commands.

Please help!

Which OS’s are on each machine, and it might help to post the code.

Leopard on both machines…

I wrote a simple test script on my MacBook, all it does is write the letter “j” in Terminal:

tell application “System Events”
tell application “Terminal” to activate
key code 38
end tell

It worked fine when I ran it on the MacBook. I saved it and sent it to the Mac with the problem. When I opened the same script the code now looks like:

tell application “System Events”
tell application “Terminal” to activate
«event prcskcod» 38
end tell

It doesn’t work if I run it and it doesn’t work if I change “«event prcskcod»” back to “key code”

Sometimes it helps to add the line (first in the script):

activate application "System Events"

Hi,

avoid always nested application tell blocks


activate application "Terminal"
tell application "System Events"
	key code 38
end tell