• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting out of a infinite loop when using system events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Getting out of a infinite loop when using system events
      • From: Nigel Smith <email@hidden>
  • Prev by Date: Re: Where are good places to publish scripts
  • Next by Date: Re: About the System Information command
  • Previous by thread: Re: [OT] Amazed and amused...
  • Next by thread: Re: Getting out of a infinite loop when using system events
  • Index(es):
    • Date
    • Thread