Jump to content
Macro Express Forums

Little Question About Scripting


Recommended Posts

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

Link to comment
Share on other sites

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


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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 1 year later...



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.





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.

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.

  • Create New...