The basics might look something like this:
Code:
property pTitle : "Remaining task count for each context"
property pVer : "0.01"
property pPrefix : "@"
property pDelim : tab
property pblnToClipboard : true
set str to ""
tell application id "OFOC"
tell default document
set {lstName, lstCount} to {name, remaining task count} of flattened contexts
repeat with i from 1 to length of lstName
set str to (str & pPrefix & item i of lstName & pDelim & (item i of lstCount) as string) & linefeed
end repeat
if pblnToClipboard then set the clipboard to str
end tell
end tell
display dialog str buttons {"OK"} default button "OK" with title pTitle & " ver. " & pVer