Results 1 to 7 of 7

Thread: [RESOLVED] Macro In VB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    Resolved [RESOLVED] Macro In VB

    Hello, i would like to know how to make the mouse click every 2 seconds.

    doset matter about co-ordinates i dont need to bother about that

  2. #2
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Macro In VB

    Quote Originally Posted by Gunner54
    Hello, i would like to know how to make the mouse click every 2 seconds.

    doset matter about co-ordinates i dont need to bother about that
    Check this post out
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    Re: Macro In VB

    thats... hard to understand what hes on about sorry =(

    i just want the click left mouse click every 2 seconds

  4. #4
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Macro In VB

    Have you written any code yet? Most people here will assist you in your endeavors but they areen't going to write the code for you without seeing that you are attempting to solve your own problem.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    Re: Macro In VB

    yes i do write vb codes, but NEVER had tryed this before so... :S im new to mouse macro

  6. #6
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Macro In VB

    I didn't ask if you have written code before, I was asking if you have done relative to your question?
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    Re: Macro In VB

    NVM I just got the hang of it

    Make two buttons and add a timer

    Module #1
    VB Code:
    1. Declare Function GetCursorPos& Lib "user32" (lpPoint As PointAPI)
    2. Type PointAPI
    3.      x As Long
    4.      y As Long
    5. End Type
    6. Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    7. 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)
    8. Public Const MOUSEEVENTF_LEFTDOWN = &H2
    9. Public Const MOUSEEVENTF_LEFTUP = &H4
    10.  
    11. Sub MouseMove(xP As Long, yP As Long)
    12. Dim move
    13. move = SetCursorPos(xP, yP)
    14. End Sub
    15.  
    16. Sub LeftClick(xP As Long, yP As Long)
    17. mouse_event MOUSEEVENTF_LEFTDOWN, xP, yP, 0, 0
    18. mouse_event MOUSEEVENTF_LEFTUP, xP, yP, 0, 0
    19. End Sub

    add this code to your project

    VB Code:
    1. Private Sub Command1_Click()
    2. Timer2.Enabled = True
    3. End Sub
    4.  
    5. Private Sub Command2_Click()
    6. Timer2.Enabled = False
    7. End Sub
    8.  
    9. Private Sub Timer1_Timer()
    10. Dim xP As Long
    11. Dim yP As Long
    12. Dim move As Long
    13. LeftClick (xP), (yP)
    14. End Sub

    now you have a clicker =) (change the timer settings to change how fast it clicks)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width