Rookie AppleScripting: Moving Rows Around

Scott Bates scottcbates at hotmail.com
Wed Jul 20 21:24:01 PDT 2005


Hello again...

I wrote...

>In short, I'm either (a) outdenting the level three rows to level two and 
>deleting the in-between, ro (b) I'm MOVEing the level three rows up a level 
>and deleting the in-between. Simple, I know, but I've not accomplished 
>after an amount time trying that I'm afraid to speak aloud!

And then one person wrote back-channel and said "HUH?" so let me see if can 
be more specific

Here's my outline:

- [ ] Project 1
    - [ ] People
    - [ ] Places
    - [ ] Tasks
        - [ ] Task 1
        - [ ] Task 2
        - [ ] Task 3
        - [ ] Task 4
- [ ] Project 2
    - [ ] People
    - [ ] Places
    - [ ] Tasks
        - [ ] Task 5
        - [ ] Task 6
        - [ ] Task 7
        - [ ] Task 8

...and here's my attempt to make it do what I want:

tell application "OmniOutliner Professional"
	set RowTot to count of rows of front document
	set lag to -1
	repeat with i from 0 to RowTot
		set currentlevel to level of row i of front document
		set TasksPlace to level of row lag of front document
		if topic of row lag of front document is "Tasks" then
			outdent row i of front document
		end if
		set i to i + 1
		set lag to lag + 1
	end repeat
	delete (rows of front document whose topic is "People")
	delete (rows of front document whose topic is "Places")
	delete (rows of front document whose topic is "Tasks")
	i & lag & TasksPlace & currentlevel
end tell

My thought...there has to be another way to from my outline above to here:

- [ ] Project 1
    - [ ] Task 1
    - [ ] Task 2
    - [ ] Task 3
    - [ ] Task 4
- [ ] Project 2
    - [ ] Task 5
    - [ ] Task 6
    - [ ] Task 7
    - [ ] Task 8

Sorry for the confusion, thanks for any help (i'm sure that the direction 
that I was going was the "caveman" (cave-person?) way of writing the script 
so any insight would be appreciated!)

Scott





More information about the OmniOutliner-Users mailing list