"Merge Rows" applescript
Brian C.
dvorak at omnigroup.com
Thu Oct 20 14:40:57 PDT 2005
I actually didn't know this, but it turns out that it's a limitation of
the cocoa scripting interface. Basically, it hoses your text styles if
you use the "&" operator. A version that preserves text styles is
possible, but you have to jump through a few hoops to get it. Everyone
say "thanks Tim!" as I basically shoulder surfed while he wrote the
guts of this version, which I hacked into the previous script. =)
bwc
tell front document of application "OmniOutliner Professional"
set theCount to (count of selected rows)
if theCount < 2 then
display dialog "You need to select at least two rows to use this
script." buttons "Cancel" default button "Cancel"
end if
set theFirstSelected to first item of selected rows
-- run through the selected rows and add the newline characters in a
way that preserves the styles
-- thus we skip the last row, because we don't need a newline there
repeat with i from 1 to (theCount - 1)
if ((count of characters of (topic of (item i of selected rows))) >
0) then
duplicate last character of (topic of (item i of selected rows)) to
after last character of (topic of (item i of selected rows))
set text of last character of (topic of (item i of selected rows))
to "\n"
end if
end repeat
-- now move the text of each row up into the first selected row and
delete the row
repeat with j from 2 to (theCount)
duplicate topic of (item j of selected rows) to after last character
of topic of theFirstSelected
delete row id (id of (item j of selected rows))
end repeat
end tell
On Oct 19, 2005, at 6:49 PM, Michael Esveldt wrote:
> This script reveals a scripting limitation I often run up against,
> namely styled text in the rows you merge is lost in the merge. Is this
> a limitation of the applescript or of OO?
>
> Best,
> Michael
More information about the OmniOutliner-Users
mailing list