Announcement

Collapse
No announcement yet.

mouse click

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    mouse click

    Ok i have an issue here. I got the mouse moving but it refuses to click no matter what way i approach the code.

    I would use the bitmap option but not sure how to use them just yet.

    Atm i have it moving to the back to deck button.

    the code im using for Cursor.Position is very simple.

    -------------------------------------------------------------------------------------------------------------------------------------------
    code
    -------------------------------------------------------------------------------------------------------------------------------------------
    Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Cursor.Position = New Point(900, 410)

    End Sub
    End Class
    --------------------------------------------------------------------------------------------------------------------------------------------
    I want it to be able to click after moved and then wait 30 seconds and then click on the station to restation. so ill have to add a timer and stuff. This will be my first bot so i would like to do it right.
    --------------------------------------------------------------------------------------------------------------------------------------------

    Add me skype: Sarcasm.bs

    If you would rather just put it in comments thats fine also.

    - - - Updated - - -

    Forgot to mention that i have this.


    Public Class Form1

    Private WithEvents Button1 As New Button

    <Flags()> _
    Private Enum MouseEvents As UInteger
    MOUSEEVENTF_MOVE = &H1
    MOUSEEVENTF_LEFTDOWN = &H2
    MOUSEEVENTF_LEFTUP = &H4
    MOUSEEVENTF_RIGHTDOWN = &H8
    MOUSEEVENTF_RIGHTUP = &H10
    MOUSEEVENTF_MIDDLEDOWN = &H20
    MOUSEEVENTF_MIDDLEUP = &H40
    MOUSEEVENTF_ABSOLUTE = &H8000
    End Enum

    Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As MouseEvents, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)

    Sub New()
    InitializeComponent()
    Me.Controls.Add(Button1)
    Button1.Text = "Go"
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' Define a point that is probably near the start button.
    Dim pointToClick As Point
    pointToClick.X = 20
    pointToClick.Y = Screen.PrimaryScreen.Bounds.Height - 20
    ' Move the mouse cursor. I'm not using the api. If you use the API you need
    ' to use MOUSEEVENTF_ABSOLUTE and normalize the point to a screen that has
    ' 0,0 at the top left and (65535,65535) at the lower right.
    Windows.Forms.Cursor.Position = pointToClick
    ' And click.
    mouse_event(MouseEvents.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    mouse_event(MouseEvents.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    End Sub

    End Class
    -------------------------------------------------------------------------------------------------------------------
    But this does not move the mouse like a person.

    #2
    Ok i have got it working but if anyone could teach me to get the mouse to move according to Bitmap or pixel detection. Please contact me

    Comment


      #3
      have you tried yelling at your computer yet?

      Comment


        #4
        lmao many times i got the bot working clicks abandon duty after 1.4 minutes ( 100000 intervals) then clicks station then the start station. Only having a few bugs now like my timers wont repeat correctly. this is how i have my timers set in the code.
        timer1.interval = 100000
        timer1.enabled = true
        timer2 interval = 30000
        timer2.enabled = true
        timer3.interval = 5000
        timer3.enabled = true

        something like that anyways my mind is covered in codes atm haha. But i found out that screaming at the computer doesn't help but makes me feel better D

        Comment

        Working...
        X