Jump to content

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


Go to solution Solved by markyrocks,

Recommended Posts

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.

Link to comment
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.

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Solution

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...