Getting current label index of a file?

I’m familiar with the syntax for setting the label index of a file, in order to get a color label. I can’t figure out how to GET the existing label, which I need in order to process files with different labels using different methods. I’m using 10.3.9 and 10.4.5.

When I use this:

set myfile to file “Macintosh HD:Users:theUser:Documents:File1.jpg”
set labelIndex to label index of myfile

I get “Expected end of line, etc. but found property.” with the word “index” highlighted.

(BTW: can shell scripting, PERL, or anything besides Applescript be used for this?)

Don’t know about OS X 3, but in 4 this works for me:

tell application "Finder" to get label index of item (choose file)