Sign in to follow this  
Followers 0
markyrocks

what happens if mouseclick x or y coordinate is a decimal?

17 posts in this topic

Ok So I been working on a program for awhile and I have a bunch of preset places to click and if anyone else than me ever uses it the program won't work if their resolution is different than mine so long story short I made a function that gets the % the users resolution is to mine. And I save that as a variable and just add *$varx and *$vary to the x and y coordinate. So I really haven't tested it yet but there's a strong possibility that it could be a decimal. So what can I expect to happen if it is? I'd hope that it just rounds up or down. I guess I could add mouseclick(int (123*$xdif),int (123*$ydif))

But that still a lot more messing around than what I want

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can easily test this out yourself...

MouseMove(500.8, 500.8)
Sleep(2000)
MouseMove(500, 500)

These will end up moving the mouse to the same spot.  So there must be some rounding as part of the function.  You can replace mousemove with mouseclick...I just didn't want to actually click anything on my comp.

As per the actual issue...I'd suggest using:

ControlClick

This function has NO reliance on your resolution, location, etc.  The window can even be off the screen, or minimized, and this will still do the trick.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I would test it myself kinda busy atm... thanks tho

Share this post


Link to post
Share on other sites

Not too hard to just use the Round (or Floor or Ceiling) function with no decimal places.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Nm I need to stop posting after I've had couple beers

Edited by markyrocks

Share this post


Link to post
Share on other sites

Yes bc for one I don't totally understand how it works. But u guess I'll look into it

Share this post


Link to post
Share on other sites

I'm just trying to click on different buttons on webpages. My logic is sound the only issue is the webpages don't scale the way I'd expect them to. I've tried using control click but the info tool doesn't display unique info when I highlight a particular button .

When I talk about scaling in a predictable way. Going from 1536x864 res to 1920x1080 the x coordinate of an item doesn't match the scale. I.e. 1920/1536=1.25 if x was 1000 @ 1536x864 it should be 1250@1920x1080 but the actual location is different the higher the x pos the more it's off. And also in regards to the scaling the y coordinate between the 2 resolutions stays the same i.e if an object was at y=400 at 1536x864 it would still be there at 1920x1080. This has to be a coding issue related to the page bc if I say find a specific point on my desktop change the resolution find the spot again compare numbers. And multiply the x,y(@1536x864)by 1.25 (which should be the spot @1920×1080) it matches almost to the pixel of where I determined it would be with the mouse. The only reason it's not exact is probably on my ability to get the mouse in exactly the same spot...

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

This doesn't rely on coordinates...get the object, and click it directly:

_IeAction($oyourobject,"Click")
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

That would be great but unfortunately I'm using chrome. I've even tried using the simplespy.au3 and the uiawrappers.au3 ect and it just doesn't recognize it as an object. Maybe I should consider using IE but I just don't like it. Chrome is so much faster.

Edited by markyrocks

Share this post


Link to post
Share on other sites

Dude I've been all over that thread I have the simplespy.au3 ect it doesn't work. I can't even get it to click on the toolbar. It basically say run simplespy hover cursor over button,control ect hit ctrl+w, it writes the code and it still don't work. Either way I figured out how to bypass pressing those buttons just using Web addresses instead

Share this post


Link to post
Share on other sites

Browser DOMs are not accessible to the spy tool.  You have to use the _ie functions, like I suggested above.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Ok So how exactly do I implement IE functions to work on chrome?

Share this post


Link to post
Share on other sites

you don't.  Use IE, or look up the Chrome udf in the 'examples' forum.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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
Sign in to follow this  
Followers 0