Problems with version 1.8.3

I have a dual boot Mac that is currently mounting in OS9.2 with Applescript 1.8.3. When I try the script:

set x to (version as text)

My Applescript editor crashes with

Every Mac I have tried with this configuration fails to run the script but it runs on a Mac with OS 9.1 and Applescript 1.6 and also one running OS 10.2.8 with Applescript 1.9.1. The error is in the coercion to text; “version” returns a result of class version. I’m trying to bullet proof a script to mount volumes and I need to identify the Applescript version since “mount volume” behaves differently on earlier versions.

Does this work?

set x to (version as string)

– Rob

No, I did give that a try. We have over 200 Macs here and most are the “mirror drive” model and booting in OS 9.2. Each one that I have tried fails to run this dumb thing. I guess I’ll have to throw a try block around this and check the Finder version on error. If the Finder is 9.2, I’ll assume Applescript 1.8.3 but I hate doing things that way. At the very least, I’d like to know why this is happening.

Good grief Rob, I feel like you should be on the payroll here. You just answered my “do shell script” question last week! I guess I need to say thanks again for the help. :smiley:

Okay, I ran around to other areas and only half of the Macs in 9.2 show this problem. Must be something in my immediate area. Guess I have to start with the basics; rebuild desktop, corrupt extensions … Thanks again Rob.

I’m always glad to try to help and once my post count gets to 2,000, I’ll ask for pay. :wink:

I’m sorry that I wasn’t able to help on this one (I don’t have a system with OS 9.2) but hopefully someone with a similar setup can offer an explanation.

Good luck!

– Rob

I don’t use OS 9 very often myself but as a pre-press house we are stuck with it until all our customers move on to OS10. My problem is that I often need a script to run in anything from 9.1 to 10.3. So far, it appears to be an extension problem. The script runs on just the 9.2 extensions. Now, I need to identify which one it is. I’ll post it here when I track it down just in case someone else stumbles onto the same oddball situation.

AHA! Its the Wacom tablet driver extension (4.7.6-2). Oh well, since most work stations have Wacom tablets here, I’m back to the work around.

It strikes me that if you have an extension clashing with AppleScript itself, you need to sort that out before relying on any of your scripts. On the other hand, if the only problem caused is an inability to coerce from version to string, you could try this alternative, which returns a string anyway:

set x to short version of (info for file ((path to extensions as string) & "AppleScript"))

My hands are tied with respect to the extension. I posted a notice to Wacom, but I’m guessing on a scale of 1 to 10, this ranks about .5 to them. I agree that it is troubling that a system extension will interfere with Applescript. There is also only a small chance that this script will ever see a system with a Wacom tablet on it. However, I have a handler that I have been using for years to mount our server volumes and it seemed like a good time to update that handler. That handler will inevitably be used on stations with a Wacom tablet. Who knew that I’d end up spending half a day troubleshooting extensions on an operating system that should only be around less than 6 months.

Ideally, I’d like a nice clean solution that will work on anything from OS 8.6 to 10.3. I think I’m going to use:

set ascrpt_ver to system attribute "ascv"

This will work on all the operating systems. Although much of this thread has been written by me, I’m hoping it may help someone else. Thanks to both Nigel and Rob for their help and to Bill Cheeseman whose web page has also helped me.

OK. Don’t forget that ‘system attribute’ used to be the Finder’s ‘computer’ command, so it has to be in a Finder ‘tell’ block if it’s to work on all those systems. If you’re compiling the script on a pre-X system, write ‘computer’ instead of ‘system attribute’.

On my 9.2.2 system, which has AppleScript 1.8.3, the result parses out as AppleScript 1.8.2. But I get the right results in 8.6 and 10.2.8.

tell application "Finder" to get computer "ascv"
tell the result
  set v1 to it div 256 mod 256
  set v2 to it mod 256 div 16
  set v3 to it mod 16
end tell
set ascrpt_ver to ((v1 as string) & "." & v2 & "." & v3)