Are these coercions valid only in Leopard?


set S to {"A", "B", missing value, "C"}'s strings --> {"A", "B", "C"}

-- or

set N to {"A", 2, "B", 3.4, "C"}'s numbers --> {2, 3.4}

-- or

set L to {{1, 2, 3}, 27, {"A", "B"}, {Moi:"Adam"}}'s lists --> {{1, 2, 3}, {"A", "B"}}
set R to {{1, 2, 3}, 27, {"A", "B"}, {Moi:"Adam"}}'s records --> {{Moi:"Adam"}}
set I to {{1, 2, 3}, 27, {"A", "B"}, {Moi:"Adam"}}'s integers --> {27}

works here as expected on 10.4.11 PPC

Thanks, Stefan; I’m having a problem with a script working perfectly for me on a G5 and an Intel machine but not at all for someone else – grasping at straws. :rolleyes:

Hi, Adam.

They’re not so much “coercions” as examples of the “every” reference form [ASLG (2008), p. 172], which should work with any version of AppleScript.

One thing that might catch you out is that, prior to Leopard, strings and Unicode texts are separate classes, so you need to specify the right one ” or get both and concatentate the results if in doubt. (‘Unicode text’ doesn’t have an AppleScript plural form; you have to use ‘every Unicode text’.)

Ahh – there’s light at the end of the tunnel that doesn’t appear to be a train! I’ll try a concatenation of both types; the lists, while many, are short, and the items to be eliminated are missing values inserted in a removal from the lists operation. :slight_smile: I’ve written the guy for whom it didn’t work, but as yet don’t know what system he’s running.