View Single Post
Quote:
Originally Posted by tah View Post
The section:

set theContextID to id of item 1 of (complete ContextName as context)
set ContextName to first context whose id is theContextID

Not sure I totally understand the first line, what is the "item 1" referring to?
The first entry in the list of completions that is returned by (complete ContextName as context). You can specify a maximum number of matches, but the result still comes back as a list, even if you specified that you only want 1. Here's an example of what is given back:

Code:
tell application "OmniFocus"
	complete "Internet" as context
		{{xml:"<span class=\"match\">Internet</span>", name:"Internet", score:315, id:"i9xBJiBMtXH"}, {xml:"<span class=\"match\">Internet</span> : iBook G4", name:"Internet : iBook G4", score:210, id:"n6UfiqlB8WX"}, {xml:"<span class=\"match\">Internet</span> : iMac G5", name:"Internet : iMac G5", score:210, id:"bSidHmTsGvc"}, {xml:"<span class=\"match\">Internet</span> : Macbook", name:"Internet : Macbook", score:210, id:"o8ur1eeK1TQ"}, {xml:"<span class=\"match\">Internet</span> : PC", name:"Internet : PC", score:210, id:"m8gFTgpko7G"}}
	display dialog 5 buttons {"OK"}
		{button returned:"OK"}
end tell