Jump to content

Problems with clicking between two fixed mousepos


Recommended Posts

It doesn't work,but what's wrong with my code below?

Global $pos1,$pos2
HotKeySet("{F7}","one")
HotKeySet("{F8}","two")
HotKeySet("{F9}","exitit")
Func one()
$pos1 = MouseGetPos()
EndFunc
Func two()
$pos2 = MouseGetPos()
while 1
MouseClick("left",$pos1[0],$pos1[1])
Sleep(200)
MouseClick("left",$pos2[0],$pos2[1])
sleep(200)
WEnd
EndFunc
Func exitit()
    Exit
EndFunc
Link to comment
Share on other sites

Link to comment
Share on other sites

Not sure if it matters for what you're doing, but when you use two() you're stuck inside the loop in that function.

Actually no, that's what the F9 key is for.

(This script sorta reminds me of my unfinished BA-AUTO program)

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

It immediately exits, as you give it no commands to perform a.k.a. "There is no while loop"

Global $pos1, $pos2
HotKeySet("{F7}", "one")
HotKeySet("{F8}", "two")
HotKeySet("{F9}", "exitit")

While 1
Sleep(1000)
Wend

Func one()
    $pos1 = MouseGetPos()
EndFunc   ;==>one
Func two()
    $pos2 = MouseGetPos()
    While 1
        MouseClick("left", $pos1[0], $pos1[1])
        Sleep(200)
        MouseClick("left", $pos2[0], $pos2[1])
        Sleep(200)
    WEnd
EndFunc   ;==>two
Func exitit()
    ExitEndFunc   ;==>exitit
Link to comment
Share on other sites

It immediately exits, as you give it no commands to perform a.k.a. "There is no while loop"

Global $pos1, $pos2
HotKeySet("{F7}", "one")
HotKeySet("{F8}", "two")
HotKeySet("{F9}", "exitit")

While 1
Sleep(1000)
Wend

Func one()
    $pos1 = MouseGetPos()
EndFunc   ;==>one
Func two()
    $pos2 = MouseGetPos()
    While 1
        MouseClick("left", $pos1[0], $pos1[1])
        Sleep(200)
        MouseClick("left", $pos2[0], $pos2[1])
        Sleep(200)
    WEnd
EndFunc   ;==>two
Func exitit()
    ExitEndFunc   ;==>exitit

Isn't that sorta what bert already said...

For it to work you needed to of have the While....

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
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...