markyrocks

how do I monitor mouse cursor during a mousemove ()?

13 posts in this topic

I know this kinda sounds like a dumb noobish question but I am fairly decent at autoit but here goes.

OK so I am constantly monitoring a line of pixels using a for statement. Example

$y=614

For $x=0 to 1240 step 15

Mousemove($x, $y)

$m=mousegetcursor()

If $m <>14 then prepare to strike ect.

There's nothing wrong with the code and it's moderately fast. But I want faster.

And if I say just mousemove from one side of the screen to the other the script doesn't seem like it's monitoring the mouse cursor until the mouse move is complete. So I'm wondering if it's worth my while to just right a second script with a continuous loop that's sole purpose is to monitor the mouse cursor? I mean I know it sounds silly but even my code above stepping at 15 pixel intervals isn't exactly ideal bc sometimes the objective is missed by a pixel or 2....idk thanks in advance guys.

Share this post


Link to post
Share on other sites



Correct, the script halts until the mousemove is complete. Check the helpfile of the MouseMove function for information what the parameters can do.

But what are you automating if you're waiting for a cursor change? There are bound to be better ways to accomplish your goal than to automate pixel hunting.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Just out of curiosity: Why do you need to monitor a line of pixels?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Well for what it's worth I tried other more precise methods to accomplish this task to no avail. I went as far as using pixel get color to save ever 5th pixel to an an array and then compare current pixel to the array looking for a change then a click but that didn't work. So this is kinda a last resort. Like I said it's working but just not as effective as I'd like. I think I'm hitting like 20-25%.

I just tried running 2 scripts side by side but it looks like I'm encroaching on needing them to run on separate threads? Bc it seems like the script that is only monitoring the cursor is running 100% of the time nothing else will happen.

@water it's part of a school project.

Edited by markyrocks

Share this post


Link to post
Share on other sites

What we want to know:

Is this line a part of a GUI control, a web page etc.

Depending on the answer we might suggest a better solution.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It's just like a living wallpaper with random click able objects.

Share this post


Link to post
Share on other sites

I still do not understand how the wallpaper is being set up, but anyway:

Try:

Mousemove($x, $y, 0)

to enhance speed.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ok thanks but ya that's how it currently is. OK so new question so let's say I can get a baseline for every 5th pixel in a given row for comparison. Is there a way to say take a screen shot and then compare the line to the screen shot while it's in memory instead of say having it copied to paint the comparing? Also is there no way to run 2 functions simultaneously ?

Edit I've found adlibregister () so that may solve the issue but I guess I'll see. But from what I gather even using it still maybe no different than running a mouse cursor check once every loop

Edited by markyrocks

Share this post


Link to post
Share on other sites

Ok thanks but ya that's how it currently is.

No, it is not. See parameter 3. 0 means that the move is instantly. You hadn't set parameter 3 so it defaulted to 10.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

If $m <>14 then prepare to strike ect.

 

Have you read the forum rules?


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Have you read the forum rules?

Ya it's what do you call that a figure of speech... didn't realize using common phrases was against the rules. Thanks I'll know better for next time. Anyways I figured out the issue the mouse cursor Id was wrong and instead of just moving it was moving then clicking on every position so. I corrected the id and now speed is definitely not an issue. It's working at like a 95% rate.

No, it is not. See parameter 3. 0 means that the move is instantly. You hadn't set parameter 3 so it defaulted to 10.

And yes that's how it was. I just failed to include it in the example that I posted. Yep 3 parameters x,y,speed gotcha

Edited by markyrocks

Share this post


Link to post
Share on other sites

didn't realize using common phrases was against the rules

 

Not necessarily, just asking the question before this gets too involved...


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Ya it's what do you call that a figure of speech... didn't realize using common phrases was against the rules. Thanks I'll know better for next time.

A yes would have been sufficient when you are acting within our rules. ;)

Since you have been pretty about your usage of AutoIt3, don't be surprised you get these questions.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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