On 28/05/2013, at 11:04 AM, Alex Hall <email@hidden> wrote:
Bottom line: can I retrieve just the labels of a record as a list?
There are various hacks, usually involving trying to coerce the record to text, extracting the error string, and parsing it with text item delimiters.
If you're not averse to some outside help, there's always:
tell application "ASObjC Runner" to set theLables to all labels of {theFirst:1, theSecond:2, theThird:3} --> {"theFirst", "theSecond", "theThird"}
But I'm not sure why you need to get involved in records in the first place. Rather than sorting your list of keywords, you could make a list of keyword-replacement pairs, and sort them by their first item. So you would sort {{"$network", network}, {"$signalStrength", signalStrength}}, sorting on the first item of each sublist.
Again, with some outside help:
set network to "Linksys" set signalStrength to "-69" tell application "ASObjC Runner" set newList to modify list {{"$networklong", "$network", "$signalStrength"}, {network, network, signalStrength}} with cols to rows set newList to rearrange list of lists newList by indexes {1} end tell --> {{"$network", "Linksys"}, {"$networklong", "Linksys"}, {"$signalStrength", "-69"}}
But you should be able to modify your existing sort routine suitably anyway.
However...
Wouldn't it be a lot easier to just modify your use of str_replace so that the search strings had, say, your $ delimiter at each end, as in $network$, or perhaps something like <network>? It just strikes me as a good place for application of the KISS principle. |