Speed Issue
Steve Mills
smills at multi-ad.com
Fri Sep 28 10:04:45 CDT 2007
On Sep 28, 2007, at 09:27:02, Rick Gaskin wrote:
> Interesting. I do not do anythings to the docs. but on open I have
> your script checking for gyphs.
>
> If I save or just close it takes the same amount of time whether I
> do anything to doc. In other words I can just open the doc. and do
> nothing. But the script still runs thru it check of every text
> block. I choose to save or not (i don't save if i am just looking
> at something or checking a date etc) again, takes the same amount
> of time.
>
> NOW, if i just open a new doc. and close it..the close is rapid. If
> I ad a text block, save then open and then close it takes the same
> amount of time...rapid.
>
> The docs in question contain many many many text blocks..I wonder
> if that has anything to do with it??
Like how many? 100? 1000? And how many hard spaces might there be? I
put your scripts into my Attached Scripts folder, made a doc with 100
text flows that contained "hardXspace" where X is a hard space,
saved, closed, then opened it. The script ran very quickly (I saw
about 3 updates as it replaced the spaces), and when I closed without
saving, it closed right away. At this point, my guesses are wild: If
there are thousands of hard spaces that get replaced when the doc is
opened, that will create thousands of commands on the undo stack,
which *might* take a little time to delete when the doc is closed,
but I've never seen this to be a problem, even on old slow OS9 on an
old slow Mac. That's the only thing I can think of.
> Maybe modify it to prompt the user (me : )) to run/check or
> not..becuase when its late in workflow..its just amtter of
> corrections and i am not adding new copy/cut text that might
> contain glyphers
Although I'm not a fan of showing UI in an attached script, this
should do it. You might have to fix the line wraps once this gets
through the mail.
using terms from application "MultiAd Creator Pro"
on opened theDoc
tell application "MultiAd Creator Pro"
activate
set num to number of text flows of document 1
if num > 0 then
try
display dialog "Replace hard spaces in all text flows?" buttons
{"Cancel","Replace"} default button "Replace"
on error
--Catch the Cancel button and return nicely, otherwise it
*might* cause Creator to stop running attached scripts.
return
end try
repeat with i from 1 to num
set (every text of text flow i of document 1 where it is " ") to
" "
end repeat
end if
end tell
end opened
end using terms from
_________________________________________________________
Steve Mills Me: 952-401-6255
Senior Software Architect MultiAd
smills at multiad.com www.multi-ad.com
More information about the Creator
mailing list