On Oct 4, 2006, at 2:11 PM, Christopher Nebel wrote: On Oct 4, 2006, at 9:45 AM, Jaime Magiera wrote:
Ok, this is an easy one. Applescript treats my variable in a "get" as a literal. I thought the lack of pipes would prevent this. However, there's something else I must be missing. I searched the archives, but he suggestion of using (| & variable & |) doesn't work either. thanks for any help.
on verifyUniqueIDs(newPreferencesArray, currentPreferencesArray, uniqueKey)
if (currentPreferencesArray is not equal to {}) then set currentUniqueKeys to {}
-- How can I get the "get" to read the value of uniqueKey, not as a literal
repeat with aPreferenceObject in currentPreferencesArray copy (get ( uniqueKey) of aPreferenceObject) to end of currentUniqueKeys end repeat
else set currentUniqueKeys to {} end if
return currentUniqueKeys end
You omitted the context about exactly what currentPreferencesArray and uniqueKey are, but I'm guessing from your question that they're a record and a string, respectively. Record keys are not strings and cannot be put into variables. Strings are not record keys, and cannot be used to access record values. [1] Assuming my guess was correct, the solution to your problem will vary depending on where currentPreferencesArray is coming from and how much control you have over it.
- currentPreferencesArray is an array of preferences from PLIST Suite (in other words, an array of arrays of records)
{{|displayName|:"black", |hostName|:"not applicable", protocol:"Local Folder", |baseURL|:"http://fakeurl.com", |remotePath|:"not applicable", |userName|:"not applicable", |uniqueServerID|:99.763908842249, |memberName|:"not applicable"}, {|displayName|:"yellow", |hostName|:"not applicable", protocol:"Local Folder", |baseURL|:"http://anotherfakeurl.com", |remotePath|:"not applicable", |userName|:"not applicable", |uniqueServerID|:109.45973, |memberName|:"not applicable"} }
-- I'm trying to create a general method that will, given an array of plist preferences and a uniqueKey, determine if any new preference objects conflict with old ones. In the case above, uniqueServerID would be the unique key. I previously hard coded the method for the objects above. However, I'd like the flexibility of a general method.
Does that help paint the picture? Thanks everyone.
Jaime Magiera Sensory Research Network
|