Better way to work with results I think. ;)
Code:
tell application "OmniPlan"
activate
set xString to "Vorgang 1" -- uniqe name of my task
tell front document
set foundTask to (every task whose name is xString) -- many results possible
set lengthoutput to length of foundTask --for future :)
set xoutput to completed of item 1 of foundTask
-- set completed of foundTask to 1.0 --set to 100%
end tell
tell front window
set selected tasks to item 1 of foundTask
end tell
end tell
xoutput