Sign in to follow this  
Followers 0
aldona22

How to cancel last command?

10 posts in this topic

I'm writing script for one game, and have problem, here's this part of the code:

MouseClick("right", 400, 400, 2)
Sleep(1000)

It's not clicking by right mouse button two times, it's clicking two times + all the sleep time (example: 1000 ms = a lot of fast right mouse clicks). How to stop/end clicking on sleep time?

Thanks :whistle:

Share this post


Link to post
Share on other sites



MouseClick("right", 400, 400, 2)
Sleep(1000)

<{POST_SNAPBACK}>

This script will do 2 times a Rightmouse click and then wait 1000ms as requested... so what else is it you want it to do ?

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Nope. That's clicking all the sleeping time, the same here:

MouseClick("right", 765, 40, 2)
Opt("MouseClickDownDelay", 10000)

= 2 clicks + 10000ms of clicking...

Any ideas?

Edited by aldona22

Share this post


Link to post
Share on other sites

Nope. That's clicking all the sleeping time, the same here:

MouseClick("right", 765, 40, 2)
Opt("MouseClickDownDelay", 10000)

= 2 clicks + 10000ms of clicking...

Any ideas?

<{POST_SNAPBACK}>

In this one you are telling it to hold the mouse click down for 10000ms ???


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

Nope, I just want do it that way: 2 clicks and after that sleep. But that's clicking all the sleeping time and I've no idea why...

Share this post


Link to post
Share on other sites

Post the rest of your code so that people can see what you are doing.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

Run("Notepad.exe", "", @SW_MINIMIZE)
$i = 0
func start()
$i = 0
While $i <= 10

send("{1 2}")
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 40, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 65, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 90, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 115, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 140, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")

send("{2 2}")
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 40, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 65, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 90, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 115, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 140, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")

send("{3 2}")
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 40, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 65, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 90, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 115, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
Opt("MouseCoordMode", 1)
MouseClick("right", 765, 140, 2)
Opt("MouseClickDownDelay", 10000)
WinActivate("Bez tytułu - Notatnik","")
wend
endfunc
func stop()
while 1
sleep (10000)
wend
endfunc

HotKeySet("{NUMPAD7}", "start")
HotKeySet("{NUMPAD9}", "stop")
while 1
sleep (10000)
wend

:whistle:

I must activate the Notepad window, cause game is having some securities. All symbols must be typed in the Notepad...

Share this post


Link to post
Share on other sites

You can set the delay of the mouse click like this:

MouseClick("right", 400, 400, 2, 1)

Blue = Times to Click as it seems you already know

Red = Speed to Click: 10 is the default... 1 is the fastest

I hope this helps, because to be honest... I don't fully understand what your trying to accomplish... GL


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Or you can try this:

Opt("WinTitleMatchMode", 2)
Opt("MouseCoordMode", 1)

Run("Notepad.exe", "", @SW_MINIMIZE)
$i = 0
func start()
$i = 0
While $i <= 10

send("{1 2}")
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 40, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 65, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 90, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 115, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 140, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
send("{2 2}")
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")

MouseClick("right", 765, 40, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 65, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 90, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 115, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 140, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")

send("{3 2}")
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 40, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 65, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 90, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 115, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
MouseClick("right", 765, 140, 2, 1)
Sleep(10000); Sleeps approximately 10 seconds
If Not Winactive("Bez tytulu - Notatnik") Then WinActivate("Bez tytulu - Notatnik")
wend
endfunc
func stop()
while 1
sleep (10000)
wend
endfunc

HotKeySet("{NUMPAD7}", "start")
HotKeySet("{NUMPAD9}", "stop")

Edit: Had an extra paramater for wintitlematchmode :whistle:

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Just to clarify, this command:

opt("mouseClickDownDelay", ××)

should be (generally) used once at the beginning of your script to define how long the mouse button will be held down when AutoIt performs a click. To click the mouse and then wait for 10 seconds:

mouseClick(...)
sleep(10000)

You may find that you don't even need the Opt() command at all if the default click-hold time works for you.

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