Adblock breaks this site

[VB] Open Source Clicker

Discussion in 'Programming General' started by Blupig, Jan 3, 2012.

  1. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant
    [VB] Open Source Clicker

    In response to this thread: http://sythe.org/showthread.php?t=1309686
    I thought I'd make an open source, shitty, autoclicker for people to learn from, but in a real language. It's fully commented and all the features work, I just didn't bother adding any error handling so be careful. Definitely room for improvement.

    [​IMG]

    Download the program ONLY:
    Clicker.zip - 22 KB

    Download the VB.net SOURCE ONLY:
    Clicker Source.zip - 85 KB

    If you get any errors with WindowsHookLib references, the DLL is in the /bin/Debug/ folder.

    Code:
    
    '' We're using the 3rd party WindowsHookLib library to easily
    '' create a keyboard hook for the hotkeys
    Imports WindowsHookLib
    
    Public Class Form1
    
        '' This system function will return the system's current time
        Private Declare Function timeGetTime Lib "winmm.dll" () As Long
    
        '' Allows us to invoke mouse events (we're going to use left
        '' mouse button up and down)
        Public Declare Function apimouse_event Lib "user32.dll" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dX As Int32, ByVal dY As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32) As Boolean
    
        '' Constant 32-bit integers (cannot be changed) which
        '' correspond to the left down and up events so we can
        '' raise them
        Public Const MOUSEEVENTF_LEFTDOWN As Int32 = &H2
        Public Const MOUSEEVENTF_LEFTUP As Int32 = &H4
    
        '' Declare keyboard hook, it's WithEvents so we can access
        '' the object's events
        WithEvents kHook As New KeyboardHook
    
        '' This is how we'll tell when we need to stop clicking if the
        '' user doesn't want to click infinitely
        Dim limCount As Integer = 0
    
        '' Self explanatory shit
        Private Sub optTimes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optTimes.CheckedChanged
            txtTimes.Enabled = optTimes.Checked
        End Sub
    
        Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
    
            '' More self explanatory shit
            cmdStart.Enabled = False
            cmdStop.Enabled = True
    
            '' Change timer interval according to the "time between clicks"
            tmrClick.Interval = CInt(txtInterval.Text)
            '' Tell the computer to finish its current stack before moving 
            '' on, this makes sure that the interval was changed properly
            '' (Might not be necessary on most machines, I was having 
            '' memory issues while debugging so I popped it in for good measure)
            Application.DoEvents()
    
            '' Let's start fuckin clickiiiin
            tmrClick.Enabled = True
    
        End Sub
    
        Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    
            '' Remove keyboard hook (for memory purposes)
            kHook.RemoveHook()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            '' Install the keyboard hook so we can assign instructions to
            '' different events that have to do with the keyboard
            kHook.InstallHook()
    
        End Sub
    
        '' When a key on the keyboard is pushed DOWN
        Private Sub kHook_KeyDown(ByVal sender As Object, ByVal e As WindowsHookLib.KeyboardEventArgs) Handles kHook.KeyDown
    
            '' If the key that was pressed was F2...
            If e.KeyCode = Keys.F2 Then
                '' If the start button is enabled, raise its click event
                If cmdStart.Enabled = True Then cmdStart.PerformClick()
                '' Same shit here except with F4 and with the stop button
            ElseIf e.KeyCode = Keys.F4 Then
                If cmdStop.Enabled = True Then cmdStop.PerformClick()
            End If
    
        End Sub
    
        Private Sub cmdStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStop.Click
    
            '' Self explanatory shit
            tmrClick.Enabled = False
            cmdStart.Enabled = True
            cmdStop.Enabled = False
    
        End Sub
    
        '' Timer event
        Private Sub tmrClick_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrClick.Tick
    
            '' If the clicking is infinite...
            If optInf.Checked = True Then
                '' Left mouse button DOWN
                apimouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
                '' Left mouse button UP (DOWN+UP = CLICK! :D )
                apimouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
                '' Wait randomly between 0 and the random offset (offset 
                '' will add time onto the timer interval so that the interval
                '' is technically random within the range the user sets)
                '' Note that it does not directly change the timer's interval,
                '' just makes the timer wait a bit longer than usual depending
                '' on the random offset.
                Wait(RandomInt(0, CInt(txtRandClicks.Text)))
    
                '' If clicking isn't infinite...
            Else
                '' If our counter is equal to the times entered by the user minus
                '' one, then stop everything (minus one because I like my counters
                '' to start at 0, it's just a matter of programming style). You can
                '' make the counter start at 1 in the declaration at the top of the
                '' code and remove the minus one here if it confuses you.
                If limCount = CInt(txtTimes.Text) - 1 Then
                    tmrClick.Enabled = False
                    cmdStart.Enabled = True
                    cmdStop.Enabled = False
                End If
    
                '' Mouse click n shit, then wait randomly
                apimouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
                apimouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
                Wait(RandomInt(0, CInt(txtRandClicks.Text)))
    
                '' Add 1 onto the count
                limCount = limCount + 1
            End If
    
        End Sub
    
        '' Wait function
        Private Sub Wait(ByVal MS As Long)
    
            Try
    
                '' Assign the current system time to a variable
                Dim systime As Long = timeGetTime()
                '' Run a blank loop to "pause" the system (asynchronously! :D )
                '' while the recorded system time + the milliseconds to wait are
                '' bigger than the current system time
                Do
                Loop While systime + MS > timeGetTime()
    
            Catch ex As Exception
                '' Do nothing, cause idgaf about errors
            End Try
    
        End Sub
    
        '' Generates a random integer between "min" and "max"
        Public Function RandomInt(ByVal min As Integer, ByVal max As Integer) As Integer
    
            '' Declare generator as static so it doesn't produce the same
            '' numbers over and over
            Static gen As Random = New Random()
            '' Return generated number
            Return gen.Next(min, max)
    
        End Function
    
    End Class
    
     
  2. Jeff

    Jeff Previously named: Jeff.

    Joined:
    Apr 16, 2011
    Posts:
    11,438
    Referrals:
    26
    Sythe Gold:
    3,200
    Two Factor Authentication User MushyMuncher Christmas 2014 Christmas 2015 Easter 2016 Sythe's 10th Anniversary Pizza Muncher Homosex Extreme Homosex SytheSteamer
    Lawrence
    [VB] Open Source Clicker

    Thanks very much!

    Will definitely be checking this out and potentially use it. :D
     
  3. kendudex

    kendudex Apprentice
    Banned

    Joined:
    Oct 3, 2011
    Posts:
    927
    Referrals:
    1
    Sythe Gold:
    0
    [VB] Open Source Clicker

    I suppose it won't work for Mac either?
     
  4. iJava

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441
    [VB] Open Source Clicker


    Haha you make me laugh every time I see you post on an auto clicker thread, you seem to sell your auto clicker on one main point which is "Mac Compatible", get a few more marketing techniques.

    Seems decent Blupig but I don't call VB.Net a real language(I know it literally is).
     
  5. glycolasis

    glycolasis Newcomer

    Joined:
    Jan 3, 2012
    Posts:
    6
    Referrals:
    0
    Sythe Gold:
    0
    [VB] Open Source Clicker

    im with you, i hate windows it is a piece of shit, i know a lot of people who use mac>pc and need an auto clicker so that SHOULD be your selling point. dont let anyone talk you down.
     
  6. dark idiot

    dark idiot Apprentice

    Joined:
    Nov 18, 2008
    Posts:
    776
    Referrals:
    0
    Sythe Gold:
    0
    [VB] Open Source Clicker

    honestly, hop off, thats all you seem to post on every other thread that is selling/advertising an autoclicker...
     
  7. Porkymadcow

    Porkymadcow Member

    Joined:
    Jan 4, 2012
    Posts:
    39
    Referrals:
    0
    Sythe Gold:
    0
    [VB] Open Source Clicker

    If only I knew how to code in VB.net lol.
     
  8. EagleWings

    EagleWings Active Member

    Joined:
    Dec 28, 2009
    Posts:
    190
    Referrals:
    0
    Sythe Gold:
    9
    [VB] Open Source Clicker

    You know youre desperate for an extra buck when you try and plug yourself and your autoclicker on other peoples threads. And you know what. That pisses me off, so imma make a Java-based autoclicker that is OPENSOURCE AND FREE, and before you try and plug yourself on my thread to.. dont ask because yes it is Mac compatible.
     
  9. iJava

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441
    [VB] Open Source Clicker


    Already released one :)
     
  10. EagleWings

    EagleWings Active Member

    Joined:
    Dec 28, 2009
    Posts:
    190
    Referrals:
    0
    Sythe Gold:
    9
    [VB] Open Source Clicker

    Cool :) Ill make one just because I can. Thinking either to make it java or Objective-C. Java is easily decompilable with jd-gui
     
  11. The Black Tux

    The Black Tux Veteran
    The Black Tux Donor Java Programmers PHP Programmers

    Joined:
    Apr 19, 2009
    Posts:
    10,306
    Referrals:
    30
    Sythe Gold:
    55
    Vouch Thread:
    Click Here
    Two Factor Authentication User Cool Kid Former OMM Cook RsProd Sythe Awards 2012 Winner Village Drunk
    [VB] Open Source Clicker

    Do you really want some of the pros making a Java/Objective-C autoclicker open source and free?
     
  12. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant
    [VB] Open Source Clicker

    Actually this does work on Mac lol. Just compile it for Mono, there's nothing in there that would make it not work.
     
  13. iJava

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441
    [VB] Open Source Clicker

    That's why you obfuscate it.

    The Windhowshooklib DLL works on mono?
     
  14. Taylor--

    Taylor-- Apprentice
    Banned

    Joined:
    Oct 28, 2011
    Posts:
    909
    Referrals:
    1
    Sythe Gold:
    0
    [VB] Open Source Clicker

    Glad to see more open source work :) Keep it up.
     
  15. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant
    [VB] Open Source Clicker

    Oh right, probably not...Can just use the GetKeyPress API for hotkeys in that case. Don't really need hotkeys at all really, just an added perk :)
     
  16. magex

    magex Forum Addict

    Joined:
    Jan 10, 2006
    Posts:
    316
    Referrals:
    0
    Sythe Gold:
    0
    [VB] Open Source Clicker

    I shall try using this for alching in the next few days... :)
     
  17. RsAccountTrading

    RsAccountTrading Active Member

    Joined:
    Jun 30, 2012
    Posts:
    106
    Referrals:
    0
    Sythe Gold:
    0
    [VB] Open Source Clicker

    oo very nice will come in handy
     
  18. Marjus

    Marjus Active Member

    Joined:
    Nov 7, 2011
    Posts:
    154
    Referrals:
    0
    Sythe Gold:
    4
    [VB] Open Source Clicker

    sounds nice, ill try it when i get home.
     
< An auto clicker for iPhone? | Buying StackOverflow, Antichat, and other good programming/hacking accts >


 
 
Adblock breaks this site