Need to superscript each character from beginning of line up to the first space character. Every single line. File can contain up to 24k lines.
I’m running Mavericks and Pages 09 [4.3]
Model: iMac
Browser: Safari 537.36
Operating System: Mac OS X (10.8)
Well this has just taken two and a quarter hours to get through a 24033-line document on my Mavericks machine. :lol: It’s not guaranteed accurate if you have any styles set.
tell application "Pages"
activate
tell body text of document 1
set lineOffsets to character offset of paragraphs
set paras to paragraphs
end tell
end tell
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to space
considering case
repeat with i from 1 to (count paras)
set p to item i of my paras
if (p contains " ") then
set e to (count text item 1 of p)
set b to item i of my lineOffsets
tell application "Pages" to set superscript of characters b thru (b + e - 1) of body text of front document to true
end if
end repeat
end considering
set AppleScript's text item delimiters to astid
Perfect! Works great. (Ran against a file with no styles set, all “Normal” 12pt, helvetica) -
Thank you very, very, much.