The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniPlan General (http://forums.omnigroup.com/forumdisplay.php?f=37)
-   -   Export to WBS preserving hierarchical task numbering (http://forums.omnigroup.com/showthread.php?t=28019)

aseidlitz 2013-01-28 09:38 PM

Export to WBS preserving hierarchical task numbering
 
Is it possible to preserve the task numbering during WBS export either using standard export or custom AppleScript. Any help is appreciated!

Thanks,

Alex

whpalmer4 2013-01-28 10:25 PM

Make a duplicate copy of your document, then run the following trivial Applescript against the duplicate before doing your export.

[code]
tell application "OmniPlan"
tell front document
repeat with MyTask in tasks
tell MyTask
set name to outline number & ") " & name
end tell
end repeat
end tell
end tell
[/code]

Worth every penny you paid for it, no doubt :-)

aseidlitz 2013-01-29 12:09 AM

Thanks!
 
Works like a charm!

aseidlitz 2013-01-29 10:55 PM

Removing WBS package numbers prior to export
 
I tried to write a similar script, but which will remove the numbers added in the previously. It works with the test string, but when I run it against the OmniPlan document it generates the error message:

[CODE]error "OmniPlan got an error:
Can’t get every text item of name of item 1 of every task of document 1." number -1728 from every text item of name of item 1 of every task of document 1[/CODE]

Here's the script:

[CODE]
tell application "OmniPlan"
tell front document
repeat with MyTask in tasks
tell MyTask
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ") "
if (count name's text items) > 1 then set name to name's text items
set name to items 2 thru -1 of name
set AppleScript's text item delimiters to ") "
set name to name as string
set AppleScript's text item delimiters to tid
end tell
end repeat
end tell
end tell
[/CODE]

Here's the version which uses test string instead of OmniPlan document:

[CODE]
set t to "1.2.3.4) sample containing bracket(s) and other text"

set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ") "
if (count t's text items) > 1 then set t to t's text items
set t to items 2 thru -1 of t
set AppleScript's text item delimiters to ") "
set t to t as string
set AppleScript's text item delimiters to tid
t
[/CODE]

Any ideas what's wrong with the first script?

aseidlitz 2013-01-29 11:46 PM

Got it working: this version removes the WBS numbers e.g. if you need to renumber the tasks or after exporting to WBS.

[CODE]
tell application "OmniPlan"
tell front document
repeat with MyTask in tasks
tell MyTask
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ") "
set t to name as string
if (count t's text items) > 1 then
set t to t's text items
set t to items 2 thru -1 of t
set name to t as string
end if
set AppleScript's text item delimiters to tid
end tell
end repeat
end tell
end tell

[/CODE]

whpalmer4 2013-01-30 12:53 AM

I certainly could have written such a script for you, but I didn't. The reason I suggested you run my script against a duplicate copy of your document is that if you are publishing changes, your round trip caused 2n changes to be made, where n is the number of tasks in the document. I don't think you want to have that going on unless you are interested in stress-testing the application with your data :-)


All times are GMT -8. The time now is 06:36 AM.

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