Jump to content

How can I figure out how long it takes MouseClick() to run? Speed parameter is ambiguous.


Recommended Posts

Hi all,

I am using AutoIt to write a local automation script and am using both MouseClick and MouseMove and am using the speed parameter to set the speed at which the mouse moves. I am trying to figure out how long it takes for the mouse movement to occur and can't as the speed parameter is fairly ambiguous.

How long does it take for the mouse movement to complete at speed 5? 10? 15? Presumably there's some kind of simple formula to figure it out?

Thanks,

A

Link to comment
Share on other sites

  • Moderators

projectamsterdam,

Why use the speed parameter at all? Why not use a Sleep and then an instantaneous move if you need a specific pause between clicks? :bye:

But there are much better ways to automate an app than moving the mouse. Can you identify the controls you want to automate by using the Window Info tool? If so than you should be able to automate them directly with the Control* commands. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Kind of a long story and I'm developing something for a client so I don't want to break NDA and risk getting into trouble but suffice to say while you bring up good points in the general sense the end goal of my specific project needs to be moving the mouse [not instantly] across the screen and knowing how long it takes to do so

Link to comment
Share on other sites

MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 10)

Use the code snippet above to judge how fast the mouse moves the cursor (to the center of the screen). It's set to speed 10 here. 0 is the fastest, and 100 is the slowest. So just change the speed parameter and note the difference. Remember to not have the mouse in the center of the screen when you run this (that's where it moves TO). You should also note that to click on a certain area, the MouseMove() function usually isn't needed before the MouseClick() function, as MouseClick takes x/y/speed parameters itself. Since you're new here, I'll just point out that the Help file is very, helpful. Welcome to the forum, good luck with your project.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 10)

Use the code snippet above to judge how fast the mouse moves the cursor (to the center of the screen). It's set to speed 10 here. 0 is the fastest, and 100 is the slowest. So just change the speed parameter and note the difference. Remember to not have the mouse in the center of the screen when you run this (that's where it moves TO). You should also note that to click on a certain area, the MouseMove() function usually isn't needed before the MouseClick() function, as MouseClick takes x/y/speed parameters itself. Since you're new here, I'll just point out that the Help file is very, helpful. Welcome to the forum, good luck with your project.

Thanks first just to note I'm not using MouseMove() I just noticed that it has the same speed parameter. I've looked through the help and there doesn't seem to be any explanation of speed other than what you posted which is "low is fast, high is slow" which doesn't help me. Don't want to hate because I appreciate the tim eit took to write a reply but your post isn't really helpful, running a script and using a stop watch isn't what I want to do. I want to know HOW the speed is calculated, clearly there is some calculation that says "ok he put the speed parameter as 6 that means take 0.12345 seconds to move to mouse" which is what I am interested in.
Link to comment
Share on other sites

  • Moderators

projectamsterdam,

I am moving this to "Developer Chat" - you stand more chance of one of them noticing it there. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

If you want to know the answer to your question then why haven't you downloaded the legacy source code for AutoIt and looked yourself?

Honestly I tried downloading one of those executable zips and it just wouldn't work. Also thought that posting on the forum for help was permitted? Furthermore I think the fact that the documentation doesn't answer my question is a hole in them and should be filled. Apologies if I didn't use the correct method to alert everyone, if there's something else you'd like me to do that would result in a question please let me know and I'll hop on it.

Link to comment
Share on other sites

Furthermore I think the fact that the documentation doesn't answer my question is a hole in them and should be filled.

We aren't in the habit of documenting implementation details. Looking at the code the speed is dependent on the system timer resolution among other things anyway.

Also I don't really know C++, I thought AutoIt existed so I didn't need to learn it :oops:

So you can't sit down and read simple code in another language? It's not like this going to be some complex class using multiple inheritance and polymorphism using functors all over the place.

If precise mouse movements down to the millisecond are that important for your program then roll your own code. AutoIt's method guarantees a relative speed, no more. It only promises that 100 is the same speed or slower than 99 and so forth. It does not and was never intended to make any guarantee that a speed of 50 will move 50 pixels in 50ms or something.

Link to comment
Share on other sites

We aren't in the habit of documenting implementation details. Looking at the code the speed is dependent on the system timer resolution among other things anyway.

So you can't sit down and read simple code in another language? It's not like this going to be some complex class using multiple inheritance and polymorphism using functors all over the place.

If precise mouse movements down to the millisecond are that important for your program then roll your own code. AutoIt's method guarantees a relative speed, no more. It only promises that 100 is the same speed or slower than 99 and so forth. It does not and was never intended to make any guarantee that a speed of 50 will move 50 pixels in 50ms or something.

#1) Wow are you a huge asshole. I ask a question that's frankly no less valid than 95%+ of the other posts on this forum and you flame me for not reading the AutoIt source in a language I don't regularly use. Wow, would love to know what you consider a valid forum post to be.

#2) It should absolutely be explained in the documentation. Period.

Edited by projectamsterdam
Link to comment
Share on other sites

#1) Wow are you a huge asshole.

Yes. Yes I am. This is well known and has been known for years. I guess you missed that memo.

I ask a question that's frankly no less valid than 95%+ of the other posts on this forum

I would assert that 95% of the posts on this forum are invalid because they can easily be answered by reading and critical thinking.

and you flame me

I didn't flame you. I pointed out the obvious. I guess to a dunce the obvious must seem a flame. But it's not.

for not reading the AutoIt source in a language I don't regularly use

I can read virtually any programming language. I could read programming languages before I could write code in them. Why? Because the logic is all the same. The syntax varies a little or a lot but core logic generally doesn't. Especially when it comes to mathematical formulas. I looked at the code. What you want to know - the formula for how to calculate how long it takes to move the mouse - is nothing more than a bunch of mathematical statements. It's not complex.

I guess it's just easier to demand the developers do all the hard work for you, though, and hide behind a shield of ignorance.

Wow, would love to know what you consider a valid forum post to be.

A question that can't be answered in 5 or 10 minutes of work by you if you would just bother to put forth the effort. A very old - but still relevant in some cases - version of the source code is available. As mentioned above and before, the code you are interested in is simple to follow assuming you know virtually any programming language including AutoIt.

#2) It should absolutely be explained in the documentation. Period.

It's people like you that make me glad I'm the one who makes these decisions and not you. It's an implementation detail, nothing more. Moving the mouse with a speed parameter has been in AutoIt since before I ever discovered this language. In something like 10+ years I've never seen a single request to know how fast the mouse actually moves. Now you come along and demand we document something only you care about. Imagine if we did that for every moron that comes along? Our documentation would be a bloated piece of shit.

Furthermore, I'm telling you right now as a developer of AutoIt that I am not going to guarantee the speed the mouse moves. If I decide tomorrow I want to change those speeds I'm going to do it. If it's important to you then don't use a high level wrapper like AutoIt. Implement your own code to do what you want instead of demand we conform to your wishes. Let's not forget - as I mentioned in my last post - that the speed is going to vary. There's a call to Sleep() in there which means the whole timing aspect is at the mercy of the system timer resolution. Over the course of a long movement the time taken may vary by several milliseconds on each successive run dependent upon how accurately the system timer shifts control back to AutoIt after the Sleep().

At this point you should just get lost. I answered your question with logical, technical and design reasons. All I get for my trouble is called an asshole. Piss off.

Link to comment
Share on other sites

It should absolutely be explained in the documentation. Period.

don't go getting pushy. autoit is already documented better than any language available and valik, mr.asshole to you, has already explained why it won't be further documented.

...AutoIt source in a language I don't regularly use

if you have ever done anything at all in c++ you should be able to figure that function out.

Also I don't really know C++, I thought AutoIt existed so I didn't need to learn it

autoit is a wrapper around the windows api which is written in c++ and it was never intended to replace c++ at all. if you don't like the way autoit works and you don't want to take time to study what has already been pointed out to us then write your own damn language.

from what i see in this thread; you have so far managed to insult the primary developer and insult the many people who have worked on the help file so why don't you just take the opprtunity to think over who the real asshole is and then slink away like the snake i think you are.

btw; you're lucky for you that i don't have mod privledges or i would have made valik look like a pussy cat and you would be gone.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

So few things in order of relevance:

Should speed be further documented in the docs

First of all, I'm not dissing the docs as a whole. I've done a bunch of AutoIt stuff and this is the only thing I couldn't figure out from reading the docs/googling. It sounds like the argument that its fine as is would be that people shouldn't care about how fast the mouse moves and the language wasn't designed to care. If this was true the speed setting would be a boolean value. 0 for instant [as it currently is] and 1 for not instant but unsure how long. The fact that it's a sliding scale shows that the language was designed allowing for people who care about the speed of these commands.

My posting this question

The first two replies to this thread were completely unhelpful to me in the sense they didn't solve my issue but guess what, the guys who posted them came in with a decent attitude and did their best to help me solve an issue. Didn't work but can't fault guys who did their best. I haven't written a line of C++ in about 10 years and even then it was a basic comp sci class in high school. Is reading the entirety of the source code a pre-requisite for asking for help?

Vailk

Wow are you a small, pathetic person. Hard to know where to start but let me suggest that for your own mental well being you consider stepping back a bit. 17k+ posts on a forum that you think is 95%+ garbage is going to make you a very unhappy person [too late for this but you can still hopefully reverse it.] GEOSoft says you're the lead developer for AutoIt so I suppose you're used to people putting up with your bullshit and kissing the rings but wow dude, seriously take a step back and look at yourself in the mirror. Not a pretty picture.

P.S. GEOSoft thanks for the productive post. If you wanted to kiss his ass a PM may have sufficed.

Link to comment
Share on other sites

Serious attitude problem here


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Heh. You're amsuing.

Wow are you a small, pathetic person.

Based on what criteria? Details are important. Based on your criteria? I don't give a fuck about you so why should I care about your arbitrary criteria.

Hard to know where to start but let me suggest that for your own mental well being you consider stepping back a bit.

What exactly is the danger to my mental well being? You and your stupid post don't even register as mild annoyance. Hell I haven't even banned your or even threatened to ban you. Arguably to people who know me just slightly better than three posts worth of content that in itself my show my mental well being is in question.

17k+ posts on a forum that you think is 95%+ garbage is going to make you a very unhappy person [too late for this but you can still hopefully reverse it.]

People have been accusing me of being unhappy for over a decade. They confuse lethal efficiency with personal dissatisfaction. It's good to see you are no more clever than any other of a thousand or more people I've have the pleasure of tormenting over the years.

GEOSoft says you're the lead developer for AutoIt so I suppose you're used to people putting up with your bullshit and kissing the rings but wow dude,

Putting up with my bullshit? Yes, somewhat due to my knowledge and technical ability. Kissing my ass, though? It gets people nothing so very few people bother to do so. I'm not interested in fluffy words. I suspect you a professional brown noser, though, since that's the first place you went with your logic.

seriously take a step back and look at yourself in the mirror. Not a pretty picture.

I see somebody who is not unhappy with life. I see somebody who more or less has everything they want. I see somebody who has been successful in stewarding a language used by you and thousands of other people. I see somebody who has been successful in keeping a clean forum largely free of people who feel the need to come onto it and try to play Dr. Phil with only minimal knowledge. I see somebody who people come to for programming advice and guidance.

Pray do tell what you see based on your what, 4 posts or so of knowledge about me. Keep in mind that nobody here knows me. Some know more about me than others but as a rule nobody here truly knows me. So that's why it's so fascinating to me that you think you can diagnose every single piece of damage I may have to produce a comprehensive picture of how my life is terrible just because I told you to read the fucking source and answer a question for yourself instead of demand the developers do it for you.

Thread unlocked. This amuses me (and others) and I don't feel it's out of control yet.

Link to comment
Share on other sites

as there isn't much on topic stuff here anymore.

I agree, but to be fair it was the OP who steered the topic off on the "let's bash Valik" route so I guess the OP wishes to change the topic of their topic?
Link to comment
Share on other sites

I thought valiks post () was a decent answer to the OP original question.

I like troll threads as the make me giggle sometimes, and this is obviously an attempt

by the OP to engage someone in trollsmanship (bastard, can't believe that is already a word)

and probably explicitly valik.

I have to say though, that a person who can read and understand everything in the help file

except not understand that one paramater even after it was explained, is undoubtedly on

a wind up.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...