fork Posted September 11, 2004 Report Share Posted September 11, 2004 hello there, im still new and my english is not very good so its a bit hard for me trying to figure out how to make a macro with what i have in mind. If someone can make me an example of something simple im pretty sure its will save me alot of time and will help me understand the concept. So thanks in advance and i hope you guys will have no problem to read and understand my post. I did a search with the word pixel and im kinda lost even after reading those posts so ill try to explain what im trying to do. I would like to do an action. lets say ctrl+1 in a loop over and over every 15secs and between those 15secs i would like macro express to scan my screen for a specific color and if its found then double click on it then start doing the first loop and so on. Ive read also the Macro Express Help and its not explaining how to find that color (exact coord) and drag it (double clicking). The specific item is *NOt* always at the same spot so pre-defined coord wont work. if someone can post a complete and working example of what i explained its will be really appreciated. PS: if 15secs is not enough that not a problem, i just want to understand the part about the pixels. Best Regards, Jeff. F Quote Link to comment Share on other sites More sharing options...
joe Posted September 13, 2004 Report Share Posted September 13, 2004 Hello and welcome to the forum! Here is a small example that scans the screen for the color red, moves the mouse to that pixel when found, and then stops. Repeat Start (Repeat 1024 times) Repeat Start (Repeat 1280 times) Get Pixel: Screen Coords: %N1%,%N2% into %N3% If Variable %N3% = 255 Mouse Move Screen %N1%, %N2% Macro Stop End If Repeat End Repeat End <REP3:01:000000:000001:01024:1:02:><REP3:01:000000:000001:01280:1:01:><GETPX:3:S:%N1%:%N2%><IFVAR2:2:03:1:255><MMS2:1N,2N><MSTOP><ENDIF><ENDREP><ENDREP> My screen is 1280x1024 so you will need to change the macro to your screen size. It takes about 45 seconds to scan the whole screen. There are things that you can do to speed this up. Scan every other pixel for example, or scan only certain sections of the screen. Quote Link to comment Share on other sites More sharing options...
Nicolas Posted September 13, 2004 Report Share Posted September 13, 2004 There are things that you can do to speed this up. Scan every other pixel for example, or scan only certain sections of the screen. .. or scan only one pixel every 5 (in X and Y coord) if you know the area you're looking for is at least 5x5 large : in this specific case, you would only check 1/25th pixels of your screen, thus increasing greatly your macro performances Quote Link to comment Share on other sites More sharing options...
fork Posted September 24, 2004 Author Report Share Posted September 24, 2004 Thanks alot for the answer, the code from your post work, however, im not able to add a double click once the cursor is moved on the target and i have no idea why. Left mouse double click, even tried to add a delay to see if that was the problem without any success. So if someone can explain me why double click with it doesnt work, or simply show me a way to make it work, that would be nice. Second question is how do i make a specific area rectangular to be scanned between x y z x. Quote Link to comment Share on other sites More sharing options...
jowensii Posted September 24, 2004 Report Share Posted September 24, 2004 Thanks alot for the answer, the code from your post work, however, im not able to add a double click once the cursor is moved on the target and i have no idea why. Are you placing the "Double-Click" command before the "Macro Stop" command? Quote Link to comment Share on other sites More sharing options...
fork Posted September 25, 2004 Author Report Share Posted September 25, 2004 yes Quote Link to comment Share on other sites More sharing options...
jmazor Posted January 26, 2006 Report Share Posted January 26, 2006 Joe, I was wracking my brain trying to figure out how to click a button that sat to the right of a data input field in my case management program. Problem was that nothing in the area was recognized as a Control. I was so lucky to happen upon your 2004 reply in this topic. Once I understood what you had done, it was relatively easy to write a script so that the mouse could move to the insertion point, drop down by the equivalent of 5 pixels (moving from the top of the insertion point to the middle), and then walk across the field one pixel at a time until it landed on a black pixel in the arrow symbol used in the button, and then edge over about another three pixels to center up on the button. Problem solved. Thanks, Jeff 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.