Property Lists - Query in the same order as it is

I am trying to query and execute some logic but SenseTalk always returns the list items in alphabetical order.

repeat with each [key, val] of myPropList
 Log key & " - " & val
end repeat

How can I get the items in the same order that I have added in the property list as it is?

Internally, a property list doesn’t have any defined order. It’s stored in a hash table that locates values based on a hash of the key. The order you give when you supply the values has no relevance, whether you give them all at once or add properties one at a time or whatever. There is no inherent order.

So, rather than display the properties in an essentially random order (that also has no relation to the supplied order), SenseTalk uses alphabetical order so it is consistent and predictable.

Thanks.
I understand why you have designed like that but when it comes to UI automation and if I am validating some stuffs as in the screen, it would make it easier for me without doing additional stuffs like scroll up or down. If it’s API or files, that’s fine but especially when I am dealing with UI, it would make more time for me.

What UI things are in your property list?

If the order is very important, I would probably change the list type and just have a list of 2 items instead of a key:value pair. That way you can do everything in order.

So something like

put [] into myPropList
insert ["Field1", "Entry"] nested into myPropList
insert ["Field2", "Entry2"] nested into myPropList

repeat with each item myprop of myPropList
	put the first item of myprop into key
	put the last item of myprop into val
Log key & " - " & val
end repeat