Jump to content

Changing MouseClick Coordinates


Recommended Posts

A realy simple question. I want to make a Script like this:

I click [a key] then "it" makes a click on coordinate on Pos1 and then Pos0

nothing happens, wait for next action

I klick [a key] then "it" makes a click on coordinate on Pos2 and then Pos0

nothing happens, wait for next action

I klick [a key] then "it" makes a click on coordinate on Pos3 and then Pos0

Going to 19 Pos, coordinates I could insert myself.

But i have no fucking Idea how to do this >.<

Thx for any helpfull answers.

Link to comment
Share on other sites

Heres some example code to get you started.

Dim $Pos0[2]=[600,500]
Dim $Pos1[2]=[400,200]
Dim $Pos2[2]=[100,100]
Dim $Pos3[2]=[250,125]

HotKeySet("{F1}","Click1")
HotKeySet("{F2}","Click2")
HotKeySet("{F3}","Click3")

While 1
    Sleep(100)
WEnd

Func Click1()
    MouseClick("Primary",$Pos0[0],$Pos0[1])
    MouseClick("Primary",$Pos1[0],$Pos1[1])
EndFunc

Func Click2()
    MouseClick("Primary",$Pos2[0],$Pos2[1])
    MouseClick("Primary",$Pos0[0],$Pos0[1])
EndFunc

Func Click3()
    MouseClick("Primary",$Pos3[0],$Pos3[1])
    MouseClick("Primary",$Pos0[0],$Pos0[1])
EndFunc
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Am I right to say that you only want one hotkey that does mouse clicks that cycles on different coordinates?

If that is so, just use an array, and a counter that increases every time you run the hotkey function. That way, it just cycles through your array every time it's called and does mouse clicks on different locations.

Link to comment
Share on other sites

Global $Counter=0
Dim $Pos[4][2]

$Pos[0][0]=600
$Pos[0][1]=500

$Pos[1][0]=200
$Pos[1][1]=400

$Pos[2][0]=300
$Pos[2][1]=100

$Pos[3][0]=900
$Pos[3][1]=400


HotKeySet("{F1}","Click")

While 1
    Sleep(100)
WEnd

Func Click()
    MouseClick("Primary",$Pos[$Counter][0],$Pos[$Counter][1])
    $Counter+=1
    If $Counter=4 then $Counter=0
EndFunc

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Thanks, that wasnt what i need, but i was 99%.

What I needed was:

Global $Counter=0
Dim $Pos[20][2]

$Pos[0][0]=x
$Pos[0][1]=y

$Pos[1][0]=x
$Pos[1][1]=y

$Pos[2][0]=x
$Pos[2][1]=y

$Pos[3][0]=x
$Pos[3][1]=y

$Pos[4][0]=x
$Pos[4][1]=y

$Pos[5][0]=x
$Pos[5][1]=y

$Pos[6][0]=x
$Pos[6][1]=y

$Pos[7][0]=x
$Pos[7][1]=y

$Pos[8][0]=x
$Pos[8][1]=y

$Pos[9][0]=x
$Pos[9][1]=y

$Pos[10][0]=x
$Pos[10][1]=y

$Pos[11][0]=x
$Pos[11][1]=y

$Pos[12][0]=x
$Pos[12][1]=y

$Pos[13][0]=x
$Pos[13][1]=y

$Pos[14][0]=x
$Pos[14][1]=y

$Pos[15][0]=x
$Pos[15][1]=y

$Pos[16][0]=x
$Pos[16][1]=y

$Pos[17][0]=x
$Pos[17][1]=y

$Pos[18][0]=x
$Pos[18][1]=y

$Pos[19][0]=x
$Pos[19][1]=y

HotKeySet("{F1}","Click")

While 1
    Sleep(100)
WEnd

Func Click()
    MouseClick("Primary",x,y)
    MouseClick("Primary",$Pos[$Counter][0],$Pos[$Counter][1])
    $Counter+=1
    If $Counter=20 then $Counter=0
EndFunc

Thanks for all who helped me.

Edited by Langeweile
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...