Find and get/set completed of Task with AppleScript
Hi folks,
I'm new to AppleScript and I want to get/set the completed value of specified tasks. I tried many ways but it does not work. I'm only able to get the overall Percentage of the Project. Any idea? Here is my try. Thank you verry much. Olbea [CODE]tell application "OmniPlan" activate set xString to "Vorgang 1" tell front document set xoutput to title of it set foundTask to (every task whose name is xString) set xoutput to completed of it --gets project percentage -- I tried this: (1) -- set xoutput to completed of first task of foundTask -- But it does not work end tell tell front window set selected tasks to foundTask end tell end tell xoutput [/CODE] [B]Error (1):[/B] error "„task 1 of {task id 1 of scenario 1 of project of document \"Ohne Titel.oplx\" of application \"OmniPlan\"}“ kann nicht gelesen werden." number -1728 from «class Optk» 1 of {«class Optk» id 1 of «class OPso» 1 of «class OPpj» of document "Ohne Titel.oplx"} |
Got a solution :)
Hope it helps anybody. [CODE]tell application "OmniPlan" activate set xString to "Neuer Task 2" -- uniqe name of my task tell front document -- set xoutput to title of it -- set foundTask to (every task whose name is xString) -- many results possible set foundTask to (first task whose name is xString) -- only one result set xoutput to completed of foundTask -- set completed of foundTask to 1.0 --set to 100% end tell --set xoutput to completed of document 1 tell front window set selected tasks to foundTask end tell end tell xoutput[/CODE] |
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[/CODE] |
All times are GMT -8. The time now is 01:15 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.