Jump to content

Recommended Posts

Posted

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:

  • Developers
Posted

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 ?

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

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
Posted

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


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

Posted

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


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

Posted

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

  • Moderators
Posted

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.

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

Posted

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.

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
  • Recently Browsing   0 members

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