View Single Post
  #9  
Old 10-25-2011, 08:49 PM
schferk schferk is online now
Registered User
 
Join Date: 11-02-2010
Posts: 151
How to export UR items / subtrees into ActionOutline
(May it be for better printing or better exporting.)

(Understood that AO has NO importing feature BUT allows for importing tab-indented (don't try with spaces) tree importing into its tree (which can also consist of just the root item of course).)

1)

Select root item of tree (or parent item of subtree you want to export)
Do Tree-Expand all.
Do File-Export and there csv with title and indent level, then check child items/recursive.
You'll get a list in the format

"first item",1
"second of your items",2

with perhaps thousands of entries.

2)

Open that list with a programmable text editor, e.g. TSE. Run a macro on the file, in TSE it would be the following macro :

proc main()
string urlevel[1] //1-digit
integer aolevel = 0

begfile()
lreplace('"','','gn^') //g=whole text, n=no confirmation, ^=beginning of line
begfile()

nextline:
endline()
left()
urlevel = chr(currchar()) //gets the 1-digit number at last position of line
aolevel = val(urlevel) //as you see, TSE's variables are typed
begline()

do aolevel times
inserttext('£') //direct insertion of tab doesn't work ; English must use another special char
enddo


if down() //means : if down is possible, and goes down then
goto nextline //= to the label called nextline, and don't say goto is bad style even if used with caution
endif
//else :

begfile()
lreplace(',[0-9]','','gn$x') //$=end of line, x=regex
lreplace('"','','gn$') //in 2 steps since 1-word titles in UR are NOT within ""...
lreplace('£','\t','gnx') //from £ to tab, regex in search/replace only, not in inserttext...

begfile()
msgbox('DONE') //not really necessary in a program like TSE that processes, on a slow comp, 10,000 such items within a second
end

3)

Here or then in AO, you could manually check for (double) "" since my macro does not take into account cases in which you had included some titles or words within titles within "" ; you can refine the macro for that, of course. The same goes for any 2-digit indent levels, of course.

4)

Do control-a, control-c, then in AO's tree control-v (Exclude the UR tree root element from your tree you're going to paste under AO's root element though) : You've got a perfect double of your UR tree in AO. Expand that AO tree as well and go, in each tree, to the root item. (Make a double of your AO file in case your macro's going to demolish your original AO file.)

5)

Then, put a macro program / script program onto both programs, going back and forth in both programs between tree and text pane, and between the progs. This is so basic I won't dare presenting a script for this but beware of response times, allow for generous macro pauses / delays after your clipboard commands, if you have longer text items and / or items with pictures, allow for 5 sec or more after those commands if you don't want to restart again and again after your macro running amok in various places.

Make sure you insert a backspace after each pasting, since AO inserts an unwanted blank end line ; run the macro on your second comp, day and night, since it'll only process 200-250 items per hour ; AO is so stable that you it'll be sufficient to have the macro save your AO file every new 500 items or so; if you want to be sure, export both the UR and the AO trees, with contents, into text files you then compare with BeyondCompare or whatever ; only work on copies of your UR files but compare with the originals ; you can combine various UR files into a big one, then taking advantage, after export, of AO's command "save this subtree as a new file" for breaking the files up again.


P.S. The tree position attribute restarts with 0/1 on every subtree, there doesn't seem to be an overall such attribute, i.e. "this item is the xth of / line x in the tree as a whole". (There's File - Properties - Items, of course... and which is not reliable. If you select your tree items manually, by shift-down, you'll get the real items number of your tree, which is also taken into account when exporting your tree (incl. templates, recycle bin, inbox, etc. if you selected them) - the item count in File - Properties indicates some 10 items more than that - as said before, UR's a black box for me I don't understand since it almost never behaves as you'd expect.)

Last edited by schferk; 10-26-2011 at 08:12 AM.
Reply With Quote