Sign in to follow this  
Followers 0
Kane49

Help with MouseClick() ^^

7 posts in this topic

Okay, at first i'd like to say that im a total noob when it comes down to AutoIT, so i'd to not get scolded for the first mistake i made , unless of course im starting to get retarded *drop*

So, my code looks like this

CODE
Sleep(11000);

MouseClick("left",728,550,1,0);

pretty simple, so now the Problem is that sometimes, even if under the exactly same preferences it won't click,

just moves the mouse onto the right button and refuses to click O_o

It seems totaly random, maybe i'd have to say that im trying to click a flashy button inside a c++ Application.

Desperately hoping for Help

Felix

Share this post


Link to post
Share on other sites



...Problem is that sometimes, even if under the exactly same preferences it won't click,...

Are you sure that the window of interest is active prior to the click? Not just visible, but active? Try adding a WinActivate and WinWaitActive line right before your MouseClick line.

Sleep

WinActivate

WinWaitActive

MouseClick

Welcome to the forum...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks for the Help ^^

The Window was already active, a normal MouseClick() just wasnt recognized so i made my own MouseClickSecure();

CODE
Func MouseClickSecure()

MouseDown("left");

Sleep(150);

MouseUp("left");

EndFunc

Seems like a normal mouse click was to short Oo, this may work for other apps too.

Im not sure about the randomness though, something about process timing maybe ^^

Share this post


Link to post
Share on other sites

Good work around. You might also want to look into the Opt setting for MouseClickDelay. According the help file, it:

Alters the length of the brief pause in between mouse clicks.

Time in milliseconds to pause (default=10).

Placing this one Opt setting near the top if your script would make all of your MouseClicks like your function... or you could place it before and after the one MouseClick that did not work using the default 10ms.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

I think you mean Opt MouseClickDownDelay. MouseClickDelay alters the delay between clicks when clicking multiple times; MouseClickDownDelay sets the time between mouse_down and mouse_up.

Opt("MouseClickDownDelay", 150)

Makes all MouseClick()s like your MouseClickSecure() function.

Share this post


Link to post
Share on other sites

I think you mean Opt MouseClickDownDelay...

You are correct. One would think that I would read what I copied/pasted/posted from the help file. It only goes to prove that I can be senile - "in the moment" - as it were.

Thanks for the correction, hopefully the OP will stop back by.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

At least you're backed up by your member title! :P

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