Entonces, les libero mi macro, y quiero mejorarlo...
Código
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Const MOUSELEFTDOWN = &H2 ' left button down /This is actually MOUSEEVENTF_LEFTDOWN Private Const MOUSELEFTUP = &H4 ' left button up /This is actually MOUSEEVENTF_LEFTUP Private Const KEY_TOGGLED As Integer = &H1 Private Const KEY_PRESSED As Integer = &H1000 Private Const MOUSEEVENTF_MOVE = &H1 Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Option Explicit ' * Colocar un control Timer '------------------------------------------------- 'Estructura de coordenadas para el api GetCursorPos Private Type POINTAPI x As Long y As Long End Type Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Dim Mouse As POINTAPI Private Sub Form_Load() 6 Me.FontSize = 10 Text1.Text = "100" 'Para configurar los intervalos de clicks Timer1.Enabled = False Timer2.Enabled = True End Sub Private Sub Timer1_Timer() 'Ejecutamos la función y recuperamos la posicion del cursor Call GetCursorPos(Mouse) ' limpia el form Me.Cls Me.Print "Posicion del cursor :" 'Imprimimos las cordenadas X e Y devueltas por el api Me.Print "X:" + Str$(Mouse.x) + vbCrLf + "Y:" + Str$(Mouse.y) If Mouse.x < 1000 Then Dim y As String Dim x As String y = Text2.Text x = Text3.Text mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up End If End Sub Private Sub Timer2_Timer() If GetKeyState(vbKeyF10) And KEY_PRESSED Then Timer1.Interval = Val(Text1.Text) 'Lee el valor del textbox en MS Timer1.Enabled = True ElseIf GetKeyState(vbKeyF11) And KEY_PRESSED Then Timer1.Enabled = False ElseIf GetKeyState(vbKeyF9) And KEY_PRESSED Then Timer4.Enabled = True ElseIf GetKeyState(vbKeyF8) And KEY_PRESSED Then Timer1.Enabled = False ElseIf GetKeyState(vbKeyF7) And KEY_PRESSED Then Timer5.Enabled = True ElseIf GetKeyState(vbKeyF6) And KEY_PRESSED Then Timer1.Enabled = False ElseIf GetKeyState(vbKeyF9) And KEY_PRESSED Then Timer6.Enabled = True End If End Sub Private Sub Timer3_Timer() End Sub Private Sub Timer4_Timer() 'Ejecutamos la función y recuperamos la posicion del cursor Call GetCursorPos(Mouse) ' limpia el form Me.Cls Me.Print "Posicion del cursor :" 'Imprimimos las cordenadas X e Y devueltas por el api Me.Print "X:" + Str$(Mouse.x) + vbCrLf + "Y:" + Str$(Mouse.y) If Mouse.x < 1000 Then Dim y As String Dim x As String y = Text2.Text x = Text3.Text mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up End Sub Private Sub Timer5_Timer() 'Ejecutamos la función y recuperamos la posicion del cursor Call GetCursorPos(Mouse) ' limpia el form Me.Cls Me.Print "Posicion del cursor :" 'Imprimimos las cordenadas X e Y devueltas por el api Me.Print "X:" + Str$(Mouse.x) + vbCrLf + "Y:" + Str$(Mouse.y) If GetAsyncKeyState(2) = -32767 Then 'comprueba si hacen click derecho SendKeys "{u}" SendKeys "{u}" SendKeys "{u}" 'si lo hacen manda la letra u End If End Sub
Ideas:
Bueno, lo que tenía pensado era que al potear no haya intervalo...
También que te haga un autoclick en una coordenada (La que pongas en un textbox) pero que no valla el mouse hacia la coordenada, si no que sea auto click sin mover el mouse, porque mi auto click es feo, lleva el mouse hacia la coordenada, entonces lo saque.
Las 2 ideas no me salieron perfectas como quería...
Asique, pido si me pueden orientar, o si no darme lo codes que preferiría mejor interpretarlos así aprendo.
Saludos!