Código:
Windows.Forms.Cursor.Position = New Point(TextBox1.Text, TextBox2.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Eso es lo que tengo en el Timer1 y entonces le añadí al programa más direcciones para dar más clicks, es decir primero va a X dirección y despues a otra.
así:
Código:
Windows.Forms.Cursor.Position = New Point(TextBox1.Text, TextBox2.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label3.Text = ("Ya")
If Label3.Text = "Ya" Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
Ese es timer1 y timer 2, para el siguiente click:
Código:
Windows.Forms.Cursor.Position = New Point(TextBox3.Text, TextBox4.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label4.Text = ("Yaa")
If Label4.Text = "Yaa" Then
Timer2.Enabled = False
Timer3.Enabled = True
End If
Como veis tengo que hacer que los labels camibien para que el primer timer se pare y inicie el segundo.
Me parece un poco cutre poner que un label se tiene que llamar de X forma para que pare el timer e inicie el otro timer.
¿hay algún code para que el timer pare después de 2 segundos o después de hacer el click?
Gracias de antebrazo.
Aquí teneis el código completo de todo mi programa:
Código:
Public Class Form1
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long)
Public Const LinksDown = &H2
Public Const LinksUp = &H4
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
Timer1.Interval = TextBox25.Text
Timer2.Interval = TextBox26.Text
Timer3.Interval = TextBox27.Text
Timer4.Interval = TextBox28.Text
Timer5.Interval = TextBox29.Text
Timer6.Interval = TextBox30.Text
Timer7.Interval = TextBox31.Text
Timer8.Interval = TextBox32.Text
Timer9.Interval = TextBox32.Text
Timer10.Interval = TextBox32.Text
Timer11.Interval = TextBox33.Text
Timer12.Interval = TextBox34.Text
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Windows.Forms.Cursor.Position = New Point(TextBox1.Text, TextBox2.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label3.Text = ("")
If Label3.Text = "" Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Windows.Forms.Cursor.Position = New Point(TextBox3.Text, TextBox4.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label4.Text = ("")
If Label4.Text = "" Then
Timer2.Enabled = False
Timer3.Enabled = True
End If
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Windows.Forms.Cursor.Position = New Point(TextBox5.Text, TextBox6.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label5.Text = ("")
If Label5.Text = "" Then
Timer3.Enabled = False
Timer4.Enabled = True
End If
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Windows.Forms.Cursor.Position = New Point(TextBox7.Text, TextBox8.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label6.Text = ("")
If Label6.Text = "" Then
Timer4.Enabled = False
Timer5.Enabled = True
End If
End Sub
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
Windows.Forms.Cursor.Position = New Point(TextBox9.Text, TextBox10.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label7.Text = ("")
If Label7.Text = "" Then
Timer5.Enabled = False
Timer6.Enabled = True
End If
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
Windows.Forms.Cursor.Position = New Point(TextBox11.Text, TextBox12.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label8.Text = ("")
If Label8.Text = "" Then
Timer6.Enabled = False
Timer7.Enabled = True
End If
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
Windows.Forms.Cursor.Position = New Point(TextBox13.Text, TextBox14.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label9.Text = ("")
If Label9.Text = "" Then
Timer7.Enabled = False
Timer8.Enabled = True
End If
End Sub
Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer8.Tick
Windows.Forms.Cursor.Position = New Point(TextBox15.Text, TextBox16.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label10.Text = ("")
If Label10.Text = "" Then
Timer8.Enabled = False
Timer9.Enabled = True
End If
End Sub
Private Sub Timer9_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer9.Tick
Windows.Forms.Cursor.Position = New Point(TextBox17.Text, TextBox18.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label11.Text = ("")
If Label11.Text = "" Then
Timer9.Enabled = False
Timer10.Enabled = True
End If
End Sub
Private Sub Timer10_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer10.Tick
Windows.Forms.Cursor.Position = New Point(TextBox19.Text, TextBox20.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label12.Text = ("")
If Label12.Text = "" Then
Timer10.Enabled = False
Timer11.Enabled = True
End If
End Sub
Private Sub Timer11_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer11.Tick
Windows.Forms.Cursor.Position = New Point(TextBox21.Text, TextBox21.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label13.Text = ("")
If Label13.Text = "" Then
Timer11.Enabled = False
Timer12.Enabled = True
End If
End Sub
Private Sub Timer12_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer12.Tick
Windows.Forms.Cursor.Position = New Point(TextBox23.Text, TextBox24.Text)
mouse_event(LinksDown, 0, 0)
mouse_event(LinksUp, 0, 0)
Label14.Text = ("")
If Label14.Text = "" Then
Timer12.Enabled = False
End If
End Sub
End Class
Y aquí una imágen del programa:
http://img339.imageshack.us/i/20110418160439.jpg/