Hi
I have a script which loops through a series of company addresses in a Quark document, checking to see if any postcodes break over two lines and, if so, using a soft return to bring them back together.
It tackles each page line by line - there are around 420 lines on a page “ and works fine.
My problem is that it gets slower and slower as the pages go by. If, for example, the first page takes a minute to process then I’m now not surprised to see the eighth page take four minutes. It’s not the differing contents of the pages “ I have made a document with the same content on each page and the same slowing happens.
What’s happening? Is there anything I can do to maintain the speed of the script?
set numberlist to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
tell application "QuarkXPress"
tell front document
set page_count to count of (pages)
repeat with i from 1 to (count of pages)
tell page i
display dialog "Processing page " & i & " of " & page_count & "." buttons {"Cancel"} giving up after 1
tell text box "Main"
set penulcharnumerical to false
repeat with i from 1 to (count of lines)
tell line i
if last character is equal to " " then
count characters
set charcount to result as number
if charcount is greater than 1 then
if numberlist contains character (charcount - 1) then
set penulcharnumerical to true
end if
end if
if penulcharnumerical is true then
if character (charcount - 4) is equal to " " then
set character (charcount - 4) to (ASCII character 7)
else
if character (charcount - 5) is equal to " " then
set character (charcount - 5) to (ASCII character 7)
end if
end if
end if
end if
set penulcharnumerical to false
end tell
end repeat
end tell
end tell
end repeat
end tell
end tell
Thanks for any input / experience.
Mark
Quarks: 6.5
OS: 10.4.10