The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniPlan Extras (http://forums.omnigroup.com/forumdisplay.php?f=45)
-   -   rb-appscript examples (http://forums.omnigroup.com/showthread.php?t=7202)

Carl Bourne 2008-02-17 02:37 PM

rb-appscript examples
 
Hi Guys,

I'm evaluating OP at the moment and need to automate pushing data in out. I need to use ruby for this since ultimately I want to hook it into a Rails app.

Could you provide some rb-appscript based examples as I'm struggling a bit at the moment. An example that first gets the % completed values then puts them back with a revised value would be wonderful. :) An example that adds new asks would also be useful.

Best Regards,

Carl

Tom Dibble 2008-03-05 04:33 PM

[QUOTE=Carl Bourne;33124]Hi Guys,

I'm evaluating OP at the moment and need to automate pushing data in out. I need to use ruby for this since ultimately I want to hook it into a Rails app.

Could you provide some rb-appscript based examples as I'm struggling a bit at the moment. An example that first gets the % completed values then puts them back with a revised value would be wonderful. :) An example that adds new asks would also be useful.

Best Regards,

Carl[/QUOTE]

I can't give rb-appscript code, but I can share a simple AppleScript to do something similar:

[CODE]
tell application "OmniPlan"
-- Note: Inspector has "" as its name, and is often the front!
set frontWindow to front window where name is not ""
set selTasks to selected tasks of frontWindow
repeat with curtask in selTasks
set completed of curtask to 1.0
end repeat
end tell
[/CODE]

This iterates across each selected task in the front window (excluding the Inspector window), setting the "completed" value to "1.0". In other words, it lets me mark a bunch of tasks as "done" with a single click instead of going into the inspector to change the % Completed field to "100".

Similarly, you could do more complicated math on the current value of "completed of curtask" before setting it back again.


All times are GMT -8. The time now is 03:26 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.