Jump to content
Macro Express Forums
terrypin

Sluggish Mouse Move?

Recommended Posts

Anyone here experiencing very slow operation of Mouse Moves please? I'm running Win 10 on  a high end PC and this macro takes about 7 secs to move about 220 pixels!

 

Mouse Move: 516, 120 Relative to Screen // Also displays Time Slider
Repeat Until %nPixCol% Equals "16053492"
  Get Pixel Color from Beneath the Mouse into %nPixCol%
  Mouse Move: -1, 0 Relative to Last Position
End Repeat

I'm sure that sort of script used to run in under a second.

 

Share this post


Link to post
Share on other sites

Did you search the forum? I seem to remember a post that sounded identical to this a couple months ago. Maybe more. 

Share this post


Link to post
Share on other sites

Thanks for the reminder Cory. I've now found it - 13 months old.

http://pgmacros.invisionzone.com/topic/7894-get-pixel-colour-beneath-mouse-incredibly-slow/

After further testing I concllude that it's Get Pixel Color that's causing the glacial movement. Same if I get the colour from specific (successively changing) locations rather than beneath the mouse. Support's position a year ago was that it was an unavoidable Windows issue.

Screws up quite a few of my macros.

 

Share this post


Link to post
Share on other sites

I wonder whether Windows 10 is making this worse.

Moving the mouse cursor can be slow. To test, for example, 1000 pixels, you need to do two steps: move the cursor; and test the pixel under it. So that's 2000 steps to perform 1000 tests.

Because computers are fast at performing mathematics, I try, as much as is practical, to avoid the step of moving the cursor, at least until the target pixel colour has been located:


 

  Repeat Start (Repeat %xLength% times)

    Get Pixel Color at (%xCurrent%, %yCurrent%) Relative to Current Window into %PixelColour%

    If Variable %PixelColour% Does not Equal "%PixelTarget%"
    // Increment x so we test next pixel to the right...
      Variable Modify Integer %xCurrent%: Increment
    Else
    // Pixel found... now it's OK to move the mouse cursor....
      Mouse Move: %xCurrent%, %yCurrent% Relative to Current Window
      Text Box Display: Found!
      Macro Stop
    End If
  End Repeat
	

 

Share this post


Link to post
Share on other sites

Thanks, but "... Same if I get the colour from specific (successively changing) locations rather than beneath the mouse."

I used -1 in that example for simplicity. In practice I'm using -2, the largest reliable delta I can use in this case, so it's still unacceptably long.

Support have just confirmed "Macro Express asks Windows for the pixel color. Later versions of Windows take longer. There's nothing we can do."

Share this post


Link to post
Share on other sites

I have a few macros where I move the cursor and watch for it to change format, rather than looking at pixel color. For example, changing from arrow to finger when it reaches a URL.   Here’s a loop watching for the vertical beam to change to something else.  I don’t know if that would be any faster for you, or feasible for what you are trying to accomplish.  It is easy for the mouse to overrun the macro if you move it too fast or too-large increments.  The routine below fails perhaps 2% of the time because the mouse moves past its target before Windows changes the format.  I use Windows 7, not 10. 

 //  
// Scan down until mouse cursor is no longer vertical beam.
Repeat Start (Repeat 125 times)
  Mouse Move Position 0, 3
  Get Mouse Position Screen: %N47%, %N48%
  // If we run past the bottom of the screen, abort macro.
  If Variable %N48% > 720
    Text Box Display: Screen limits exceeded
    Macro Stop
  End If
  Delay 15 Milliseconds
  If Mouse Cursor is Beam
  Else
    Repeat Exit
  End If
Repeat End
//  

 

Share this post


Link to post
Share on other sites

Thanks, yes, I too use that method whenever possible. But unfortunately it's not in this case.

Any Google Earth users here, who also use its Time Slider feature? If so I'll elaborate.

Terry, East Grinstead, UK

 

 

Share this post


Link to post
Share on other sites
21 hours ago, terrypin said:

Anyone here experiencing very slow operation of Mouse Moves please? I'm running Win 10 on  a high end PC and this macro takes about 7 secs to move about 220 pixels!

 


Mouse Move: 516, 120 Relative to Screen // Also displays Time Slider
Repeat Until %nPixCol% Equals "16053492"
  Get Pixel Color from Beneath the Mouse into %nPixCol%
  Mouse Move: -1, 0 Relative to Last Position
End Repeat

I'm sure that sort of script used to run in under a second.

 

I don't understand why you need to move the mouse at all. You can specify the pixel address using variables, so simply increment or decrement the pixel address and test again. I'd have thought that would be much faster.

Share this post


Link to post
Share on other sites

Did you try it? That's always my preferred method, but as per my earlier post: "After further testing I concllude that it's Get Pixel Color that's causing the glacial movement. Same if I get the colour from specific (successively changing) locations rather than beneath the mouse. Support's position a year ago was that it was an unavoidable Windows issue."

"I'm sure that sort of script used to run in under a second."

Agreed, and I have quite a few macros built on that basis. (!)

Share this post


Link to post
Share on other sites

OK, I din't read all the posts since mine but I don't have much time tonight. I only want to impart that I believe the WDM (Windows Desktop Manager) is having some kind of conflict with MEP. And I don't think it's MEP's fault. 

Share this post


Link to post
Share on other sites

I notice your original post mentions moving about 220 pixels.  Can you get closer on the original positioning of the mouse, so it doesn't have to scan so far?  I have done that on a couple of pixel-color searches, to speed up the macro. 

 

Share this post


Link to post
Share on other sites

Ah!  Thanks for the visuals.

Do you have to actually grab the slider with the mouse and drag it, or can you just click the mouse on the right hand end of the slider scale? 

For example, playing a YouTube video either method works to get to the end of the video.  Or, I can click anywhere on the scale line and the slider jumps to the mouse-clicked position, where it can then be grabbed and moved. 

Share this post


Link to post
Share on other sites

I'm sure you have considered this but is there a command to go to a certain time like in media players? In VLC I can type CTRL+T, enter a time, and it jumps to it. 

I like what rberg is suggesting. Then you would avoid the drag.

I made a simple test program in VB.NET to see how difficult it would be to scan pixel colors and it's simple. I was thinking I could make a simple add-on program for MEP that would scan pixels quickly. Though I'm not sure what the best way would be to go about it. I was thinking that the user could set thresholds for reg green and blue and it would scan along a path until the threshold is reached and return that position. I'd have to figure out how people would want to use it first. 

Share this post


Link to post
Share on other sites

Hi Terry,

 

Do you have a choice of operating systems? You may be able to workaround the problem by reverting back to Windows 7.

Because of the kinds of problems you are encountering, I have assiduously avoided Windows 8 and 10.

Using an older operating system is a temporary solution, as Microsoft will, in time, discontinue support for Windows 7. But for now it is supported, and in Windows 7, pixel colour checks run acceptably fast.

 

 

Share this post


Link to post
Share on other sites

@rberg: Thanks a bunch, you're a star - that does work! So glad I showed you those visuals. And embarrassed not to have pursued that approach properly again myself. I think I dismissed it way back because of several potential complications (the slider itself sometimes partially covering the target click point, etc) but mainly because dragging was so fast in XP anyway, and also gave me some tolerance over pixel positions . But I hadn't thought to reinvestigate.

Your post also motivated me to do some belated lateral thinking of my own this morning. I found it needs only 61 mouse clicks on the button I've shown to get full movement in about a tenth of  a second. (As shown in GE-TS-03.jpg. The other, earlier screenshot was added by mistake and so far I've found no way to delete it . Even canceling the post and restarting still brought it back!)

@cory: I wonder if Insight would be interested in pursuing that idea with you? Some sort of script add-on or just a macro that would get around the issue until MS possibly fix it.

@acantor: I know how you feel as I was very reluctant to move up from XP after 12-15 years. But for my video work I wanted a high end PC and Win 10 Pro was the only option I could buy. I'm committed to it now and despite its quirks and its over-protective UAC stuff, it's growing on me.

 

 

 

GE-TS-03.jpg

GE-TS-01.jpg

Share this post


Link to post
Share on other sites

The "final solution" for compatibility on a Win10 machine is Hyper-V. It's MS's VM (Virtual Machine). click the start button and start typing "hyper" and you will see it. You need a license for the machine you virtually build but most of us have an Win7 license available from a previous computer. I used it with MEP a few times for compatibility and often simply because I was running a macro that was using the mouse and keyboard for a long time and I wanted to keep working on other things. It's a free solution if you ever need it.

Share this post


Link to post
Share on other sites

I've proposed a few add-ons for MEP but there's no interest and I'm not going to put time into something if it's only going to benefit a couple people. Unless someone wants to pay me for it. I've proposed a WinForm (multiple boxes and other windows controls) input for MEP, a RegEx module, a web downloader,and a few others. Last week I created a specialize web browser as a demo using the WebBrowser control for a client and was thinking I could make a web browser that would be designed to work with MEP as well. Solve all the problems I hear about here automating web pages. But there's just no interesting in these things. Joe made the PGMs a long time ago but there was a lot of demand then. 

And I haven't received any interest from ISS either. I have suggested that  could make some add-ons but really if they wanted something like that they could simply develop the solution in MEP. I think it could be cool to have them just like we have add-ons for all kinds of programs, EG Chrome. 

But it sure would be fun to do...

Share this post


Link to post
Share on other sites
14 hours ago, Cory said:

I've proposed a few add-ons for MEP but there's no interest and I'm not going to put time into something if it's only going to benefit a couple people. Unless someone wants to pay me for it. I've proposed a WinForm (multiple boxes and other windows controls) input for MEP, a RegEx module, a web downloader,and a few others. Last week I created a specialize web browser as a demo using the WebBrowser control for a client and was thinking I could make a web browser that would be designed to work with MEP as well. Solve all the problems I hear about here automating web pages. But there's just no interesting in these things. Joe made the PGMs a long time ago but there was a lot of demand then. 

And I haven't received any interest from ISS either. I have suggested that  could make some add-ons but really if they wanted something like that they could simply develop the solution in MEP. I think it could be cool to have them just like we have add-ons for all kinds of programs, EG Chrome. 

But it sure would be fun to do...

IMHO ISS gave up on ME a long, long time ago. And the company structure doesn't appear to permit professional outcomes.

Share this post


Link to post
Share on other sites

I know they haven't given up but it has slowed. And I worry about their ability to cope with UWP. But more than that it seems public interest in MEP has faded for some reason. I'm not sure why. 

Share this post


Link to post
Share on other sites
18 hours ago, paul said:

IMHO ISS gave up on ME a long, long time ago. And the company structure doesn't appear to permit professional outcomes.

I have seen Windows-automation programs that do similar functions to ME, even better, but instead of buying them outright for $45 I can lease them for $100,000 a year.  Hmmmmm.  Lemme think.  Which one should I get for navigating a few screens to check my credit card balance?   

As for professional outcomes, I have written LAN-based ME systems used by hundreds of simultaneous users, monitoring and responding to and interfacing among dozens of unique application windows.  All that was after the "long, long time ago" that you say ISS gave up. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×