Auto Click Macro (Help)

05/12/2019 07:47 InclerFR#1
edited
05/14/2019 08:54 Else#2
Maybe use pixel search or with image to get the location?
05/16/2019 10:48 killzone#3
What language are you planning to use to create this macro?
07/04/2019 03:40 InclerFR#4
Quote:
Originally Posted by killzone View Post
What language are you planning to use to create this macro?
Hi, pref VB
07/16/2019 19:36 Myddo#5
[Only registered and activated users can see links. Click Here To Register...]

This might give you some ideas. It doesn't automatically detect any colors, but it allows you to set up custom coordinates for the clicker to go through.
07/17/2019 22:15 kiges#6

now you can search for vb.net screenshot and vb.net bmp get pixel color. adding r + g + b if its equal to your number click left coordinates else right coordinates
07/17/2019 22:34 Dusty Rose#7
For the main part of the script, it does seem to be entirely location-based (dealing with inventory items). Slowing down the video it clicks the first slot as a constant and then clicks the second slot (and then each repetition it adds a certain specific amount to the horizontal value to move across). When it reaches the end of the row it moves down one row and repeats the above not excluding the first slot this time.

As for the Ok and Cancel button changing between two, it does seem to be some form of get pixels. I'm not clued up on VB i'm afraid, and i think trying to include sikuli into vb for one button press is a little OTT. I remember seeing in a tutorial for python there was a function where you supply an image and then a variable is made based on numeric value of all the individual pixels of the image, and then using that to find it on the screen. I was wondering if there's similar for VB at all?

I did bump into: [Only registered and activated users can see links. Click Here To Register...] while googling for VB solutions, is it of any help at all? Sorry, VB goes over my head i'm afraid.
08/07/2019 18:12 InclerFR#8
I can't do this guys. I'm looking for someone to do :(
08/10/2019 02:19 0x33c#9
simple as that:
1) Import some stuff
Code:
Imports System.Runtime.InteropServices
2) u need to import the mouse event from the user32.dll to handle the click
Code:
<DllImport("user32.dll")>
    Private Sub mouse_event(dwFlags As UInteger, dx As Integer, dy As Integer, dwData As UInteger, dwExtraInfo As Integer)
    End Sub
3) declare the function to set the mouse Position
Code:
Declare Function SetCursorPos Lib "user32" (ByVal X As Integer, ByVal Y As Integer) As Integer
4) declare the mouse key adresses to handle the click
Code:
    Private Const MOUSEEVENTF_LEFTDOWN = &H2
    Private Const MOUSEEVENTF_LEFTUP = &H4
    Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
    Private Const MOUSEEVENTF_MIDDLEUP = &H40
    Private Const MOUSEEVENTF_MOVE = &H1
    Private Const MOUSEEVENTF_RIGHTDOWN = &H8
    Private Const MOUSEEVENTF_RIGHTUP = &H10
5.1) move the mouse
Code:
    Public Sub MoveMouse(ByVal xMove As Integer, ByVal yMove As Integer)
        mouse_event(MOUSEEVENTF_MOVE, xMove, yMove, 0, 0) '[move the mouse by xMove and yMove pixels]
    End Sub
5.2) set mouse position
Code:
SetCursorPos(X, Y) 'X=X coord | Y = Y coord [Set the exact position]
6) perform the click
Code:
    Public Sub LClick()
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) ' Down
        System.Threading.Thread.Sleep(10)
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)   ' Up
    End Sub
And your done, HF