Jump to content
Macro Express Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Community Answers

  1. rberq's post in If two minutes passes, then click refresh icon, but then keep going.... was marked as the answer   
    Increment an integer counter each time through the Repeat loop. Then test the counter value. For example, if your delay command specifies 1 second delay after checking pixel value, then when the counter reaches 120 the macro has been waiting about two minutes. If you use a half-second delay, check counter for 240 rather than 120; etc.
    When the counter reaches 120, click on the refresh button and reset the counter to zero to wait some more. You may be able to press the F5 key to refresh rather than using the mouse.
    Get pixel color
    Set counter = 0
    Repeat until pixel color
    Wait 1 second
    Increment counter
    If counter >= 120
    Click refresh
    Set counter = 0
    End if
    Get pixel color
    Repeat End
  2. rberq's post in Wait for blank window title was marked as the answer   
    If Alan's idea doesn't work, pick out one or a few unique color spots on the screen you are waiting for (or just uniquely different from the screen you are starting from), then write a loop to check pixel colors in those spots until they all match. For example, the code below is checking a single location waiting for a signon screen to appear so i can check whether I have won the lottery. The macro makes it quick and easy to get my weekly bad news. Note the 100ms delay built into the loop -- one tenth of a second. You don't want the loop to run as fast as the processor will go -- the delays leave some CPU power for the browser and operating system.
    // Delay briefly for page to finish loading -- based on yellow "Submit" button appearing
    Mouse Move Screen 519, 553
    Repeat Start (Repeat 3000 times)
    Get Pixel: Under Mouse into %N1%
    If Variable %N1% = 52479
    Repeat Exit
    End If
    Delay 100 Milliseconds
    Repeat End
  3. rberq's post in Modify Text String in Variable was marked as the answer   
    Variable Set String %T1% "abcdef-ghi" sample text for testing
    Variable Set Integer %N1% from Position of Text in Variable %T1% locate position of first hyphen within the text
    Variable Modify Integer: Dec (%N1%) set position back by one so hyphen won't be copied
    Variable Modify String: Copy Part of %T1% to %T2% copy desired text to another variable, length N1
  4. rberq's post in Time out a Pixel Color search was marked as the answer   
    I generally write a repeat loop with a short delay within the loop. Delay time multiplied by number of repeats equals the (nominal) total time to wait, but if the expected color appears the wait is ended immediately. Here's a wait of zero to ten seconds.
    IF n3 = 1234567
    DELAY100ms (one tenth of a second)
    END IF
    * We may exit from the loop when the color is found, or after the maximum repetitions. Therefore the check below
    * figures out whether the color was found or not.
    IF n3 NOT = 1234567
    TEXT BOX DISPLAY not-found message
    END IF
    Maybe no "better" than your method, just another way of doing it. I'm not sure what you are asking for -- a way to end the wait early without killing the macro???
  5. rberq's post in simple loop with "OR" doesn't work was marked as the answer   
    Change the OR to AND. You will be not unhappy.
  • Create New...