Jump to content
Macro Express Forums

N00B Help! how do i stop a macro once it cant press the control+N button?


yus786

Recommended Posts

I would have the macro look at the color of the button using the Get Pixel Color command and if it is grayed out run the Macro Stop command. Sonething like this:

Repeat Until %T1% <> %T1%
 Get Pixel: Screen Coords: 23,145 into %N1%
 If Variable %N1% = 153981133
Macro Return
 End If
Repeat End

Note that this example uses the Macro Return command instead of the Macro Stop command. Unless it is in a macro called by the Macro Run command, the Macro Return command does not generate a warning message. The Macro Stop command generates a warning message unless you have turned such warning messages off.

Link to comment
Share on other sites

You might also consider using If Not Control Enabled. And I would tend to use the Break instead of Macro Stop/Return.

 

Kevin: That’s an interesting trick! I’ll have to try that sometime.

Link to comment
Share on other sites

You might also consider using If Not Control Enabled. And I would tend to use the Break instead of Macro Stop/Return.

 

Kevin: That’s an interesting trick! I’ll have to try that sometime.

 

 

Actually, we use the "get pixel color" command quite a bit. I find that on a lot of our native applications as well as the web applications, the "boxes" are not built as controls... So, our workaround was to watch the application for color changes specific to that process.

 

Speaking of which... I may have posted this before... but I find that 'wait for webpage to load' does not work on many of our macros very well. The page will show loaded without the information appearing on the screen and causing the macro to continue prematurely. We use the "get pixel color" command twice in a repeat loop on the bottom status bar of the webpage. When you load a page, you get the little colored bar that fills out a section, then disappears again. We use get pixel to wait for the color to change once (showing the page loading) and then wait for it to go back to normal (finished loading). I find this to be more accurate than the 'wait for webpage" command. This DOES require the webpage to be maximized and you would have to modify the macro to match the color of your normal taskbar... but it works quite nicely...

 

    Repeat Until %T1% <> %T1%
     Get Pixel: Screen Coords: 726,703 into %N1%
     If Variable %N1% <> 13160660
       Repeat Until %T1% <> %T1%
         Get Pixel: Screen Coords: 726,703 into %N1%
         If Variable %N1% = 13160660
           Break
         End If
       Repeat End
       Break
     End If
   Repeat End

Link to comment
Share on other sites

In Opera, when I need a "wait for website" command, which doesn't exist for Opera, I use a combination of "Wait for Window Title" and "Wait for Not Mouse Cursor: App Start". I don't know if this will work for other browsers, but in Opera, "Wait for Not Mouse Cursor: App Start" after "Wait for (a website's) Window Title" does the trick very well. For me, at least. And I find it a lot easier than using the pixel colour commands. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...