Is "RD" a reserved word?

I’ve hit a stumper and don’t see anything in my off- and on-line references to Applescript. I’ve got a derivative of Hanaan Rosenthol’s make a record script. I need to make a record because I need to use the identifier value to make a one to one association with its attached value.

Here is his unaltered script:


set label_list to {"cat", "dog", "fish"}
set value_list to {"Furball", "Humper", "Smokey"}

set my_text to "{"
repeat with i from 1 to (count label_list)
	set the_label to item i of label_list
	set the_value to item i of value_list
	set my_text to my_text & the_label & ":"
	if class of the_value is string then
		set my_text to my_text & "\"" & the_value & "\""
	else
		set my_text to my_text & the_value
	end if
	if i < (count label_list) then
		set my_text to my_text & ", "
	end if
end repeat
set my_text to my_text & "}"

run script my_text

Works as advertised.

Here’s my issue. One of my identifier values is “RD”. Try replacing any one of his label_list with “RD” and you should get an error. “Expected expression, etc. but found “rd”.”

The value prior to this error is a text version of a record. I guess the “run script” is balking at the “RD”. Of course, RD is a required value for my application and it makes me think that it’s a reserved word, but it doesn’t show up in references. Do I have to make a kludge to get around this?

thanx, sam

Hi.

Yes. st, nd, rd, and th are ordinal suffices you can use, if you like, in constructions like these:

1st item of myList -- instead of item 1 or myList.
2nd item of myList -- instead of item 2 of myList.
3rd item of myList -- instead of item 3 of myList.
4th item of myList

The English ordinals from first to tenth are also available, if you like this sort of thing:

first item of myList
fifth item of myList
tenth item of myList

I don’t have a solution for you but I did run into something similar once before. rd is a ordinal for third so reserved.

set x to 1st item of {"Furball", "Humper", "Smokey"}
set y to 2nd item of {"Furball", "Humper", "Smokey"}
set z to 3rd item of {"Furball", "Humper", "Smokey"}

Im almost certain that it was you who pointed this out to me NG beat me to it

You can use arbitrary property labels but you have to quote them differently:

{|RD|:"upper", |rd|:"lower", |rD|:"mixed", |r D|:"space", |"rd"|:"dquote", |\||:"vbar", ||:"empty"}

As you will see, they are also case sensitive when used like this.
This enables use of strings that are otherwise reserved or “taken” by application or OSAX vocabulary. It even works for variable and script property names:

set |"my" record!| to {|name|:"user name", name:"system name («class pnam»)"}
{name of |"my" record!|, |name| of |"my" record!|} --> {"system name («class pnam»)", "user name"}