Error Message - class cdis & class docf ????

Hi Guys,

I’ve been working on my first script for a while now, and thought i’d got it close to being useable. Compiling it on my iMac at home (10.6.4) it seemed to work OK, then I tried it on a MacBook running 10.4, and I’m getting errors all over the place.

The latest being:

What the heck is happening here . . . and why doesn’t the script work the same on different OS’s ?

Thanks

Your question’s rhetorical rather than specific. :wink:

There are all sorts of possible reasons why a script compiled on one system might not work on another:

The script relies on a facility which hadn’t been invented when the earlier system was introduced.
The script relies on a facility which is obsolete on the later system.
One of the systems (or scripted applications on it) has a bug unique to that version.
The script relies on a third-party OSAX not installed on one of the systems.
A file, folder, disk, or path may not exist on one of the systems.
One of the systems is more tolerant of particular pieces of bad scripting than is the other.

etc.

Nigel,

Thanks for your response. However, as a newcomer to AS, I’m still confused.

If the script works on two other iMac machines both running OSX 10.6 (compiled initially on one of these), are you advising that it’s not simply a case of an older version of AS not being able to read a script compiled on the latest version AS?

If so, what would you suggest to ensure the script is backwardly compatible (if this is indeed possible)?

Thanks again!

Hi, steevg.

I don’t actually know why your scripts error on your Tiger machine as you haven’t given very much information. I’ve just listed some of the more common possible reasons.

«class docf» “30min.MPG” of «class cdis» “DRIVE_X” of application “Finder” is the Finder reference document file “30min.MPG” of disk “DRIVE_X” as reported by something which doesn’t know how to decompile the «class xxxx» codes back to the Finder keywords in the source code. The codes and the keywords are the same on both systems, so that’s not likely to be the cause of the problem in this case.

It looks as though the script’s trying to use this Finder-specific reference in a situation where Finder references aren’t understood, but I haven’t been able to contrive a situation which works on my 10.6 machine but not on my 10.4 one.

As an example, this fails on both machines:

tell application "Finder" to set x to document file "Save test list.scpt" of desktop

POSIX path of x
--> error "Can't make «class docf» \"Save test list.scpt\" of «class cfol» \"Desktop\" of «class cfol» \"username\" of «class cfol» \"Users\" of «class sdsk» of application \"Finder\" into the expected type."

You can’t get the POSIX path of a Finder reference. You have to coerce the reference to an alias and get the POSIX path of that:

tell application "Finder" to set x to document file "Save test list.scpt" of desktop

POSIX path of (x as alias)
--> "/Users/username/Desktop/Save test list.scpt"

I’ve tried passing a Finder file reference to other applications to open, but, surprisingly, this works on both machines. The coercion to something the other apps understand appears to be automatic. But I suppose it might fail with an application I haven’t tried.

Basically, your error message suggests that a Finder reference is being used in the wrong context.

Hi Nigel,

Having just re-read my ramblings, I can understand your confusion, however I’m unable to post the script at this time as I’m away on business for a short period!

I’d like to pursue this again if I may in a few days time, when I’ll be back in front of my 10.6 machine!

Appreciate your input and will try to be more informative next post!

Thanks
Steevg