I am querying DEVONthink via AppleScript, and in trying to read - among other things - the UUID of the group, I get several resulting entries for the same group with varying UUIDs.
Here’s my AppleScript:
tell application id "DNtp"
set resultList to search "name:vagrant* kind:group" -- Searching for groups named "vagrant"
set results to {}
repeat with result in resultList
set rName to get name of result
set rUUID to uuid of result
set rPath to path of result
set rParent to name of parent of result
set rDBName to name of database of result
set results to results & [{title:rName, mydb:rDBName, myparent:rParent, myuuid:rUUID}]
end repeat
return results
end tell
Some of the results have different UUIDs for the same group in the same database:
Do the search in DEVONthink’s toolbar search. Do you have multiple groups named the same?
PS: result by itself is a reserved word in AppleScript. Though it works here, I’d suggest renaming it, for example…
tell application id "DNtp"
set the_resultList to search "name:osticket* kind:group" -- Searching for groups named "vagrant"
set the_results to {}
repeat with the_result in the_resultList
set rName to get name of the_result
set rUUID to uuid of the_result
set rPath to path of the_result
set rParent to name of parent of the_result
set rDBName to name of database of the_result
set the_results to the_results & [{title:rName, mydb:rDBName, myparent:rParent, myuuid:rUUID}]
end repeat
return the_results
end tell
Out of curiosity: Why does one use set rName to get name of ...
but set rUUID to uuid of ...
Put differently: Why does one have to use get with one property and not with another one? The only difference I can see in the documentation is that name is r/w whereas uuid is r/o. Both are of type Text.
Off-topic: Any Objective-C references for a complete beginner with no coding background? Would propably be very helpful in learning AppleScriptObjC. Bonus points if it’s in german.