yus786 Posted October 4, 2007 Report Share Posted October 4, 2007 right, ive assigned the macro to loop successfully but i need it to stop once it cant press the control+n (the programme it presses it on has the control+n button greyed out once the work has finished) any help would be appreciated regards yus786 Quote Link to comment Share on other sites More sharing options...
kevin Posted October 4, 2007 Report Share Posted October 4, 2007 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. Quote Link to comment Share on other sites More sharing options...
Cory Posted October 5, 2007 Report Share Posted October 5, 2007 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. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted October 5, 2007 Report Share Posted October 5, 2007 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 Quote Link to comment Share on other sites More sharing options...
Phonemes Posted October 5, 2007 Report Share Posted October 5, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.