Getting out of a infinite loop when using system events
Getting out of a infinite loop when using system events
- Subject: Getting out of a infinite loop when using system events
- From: "Patrik B." <email@hidden>
- Date: Fri, 27 May 2005 10:13:50 -0700
Hi,
I got a script below that uses a system event and a keystroke to activate a feature that I cannot directly access via a scripting method. The script runs fine but when I try to add another repeat so it runs untill no more overflow text exists it runs forever and locks my machine. It seems like the application does not refresh and therefore realize that text was made smaller therefore it the condition stays true and the repeat continues. Do I have to add some sort of script command that will give the machine time to react to the keystroke and refresh? If so how do I do that?
Here is my code just in case:
tell application "InDesign CS-US"
activate
set doc1 to document 1
tell doc1
try
set mylist to every text frame of every story where
overflows is true
log mylist
copy (count items in mylist) to mycount
log mycount
end try
end tell
end tell
tell application "InDesign CS-US"
activate
tell document 1
repeat with myitem in mylist
select myitem
set theFrame to myitem
set theStory to parent story of theFrame
-- checks if overflow exists. (myOver is a boolean here)
set myOver to overflows of theFrame
tell application "InDesign CS-US" --- this is the part that will make the text smaller proportionally but it loops forever if I add a repeat just before this. That depends on the myover to be false.
tell application "System Events"
tell application process "Indesign
CS-US"
keystroke "<" using {command
down, shift down}
end tell
end tell
end tell
tell application "InDesign CS-US"
activate
end tell
end repeat
end tell
end tell
end
Best, Patrik
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden