A few useful methods to make a bot in VB
I thought some might be interested by VB because it's a pretty intuitive coding language so here are some cool stuff to make bots ;
Detecting a pixel color :
Simulating mouse clicks and keyboard inputs :
You have to declare those functions/sub right after your Public Class line ;
Left means left click, right means, alright you got it.
DOWN is when a click button is pressed, UP is when its released.
Changing the mouse (X,Y) coordinates and simulating a mouse click :
Simulating a key press :
I'm not allowed to post any outside links, but you can find all the key values by typing 'SendKeys Statement' on Google.
You can also send a complete line of text directly from a textbox, and/or add some raw text :
Opening a link in the default browser :
Hoping this will be useful to some users.
I can also help you on skype in visual basic if you are a begginer, my skype is : turgodi
Best regards.
I thought some might be interested by VB because it's a pretty intuitive coding language so here are some cool stuff to make bots ;
Detecting a pixel color :
Code
'Taking a screenshot and converting to Graphics type, note that here the screen resolution is 1280x720.
Dim Img As New Bitmap(1280, 720)
Dim ImgGraphics As Graphics = Graphics.FromImage(Img)
ImgGraphics.CopyFromScreen(0, 0, 0, 0, Img.Size)
'Getting the pixel color at (X,Y) on the screenshot, note that i'm using .ToArgb to compare a color value, change -65906 to the color you want.
Dim Slot1Selec As Color = Img.GetPixel(X, Y)
If Slot1Selec.ToArgb = -65906 Then
'Do something here
End If
'Getting rid of the BMP and Graphics screenshots, else it will constantly increase your ram usage
Img.Dispose()
ImgGraphics.Dispose()Simulating mouse clicks and keyboard inputs :
You have to declare those functions/sub right after your Public Class line ;
Code
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long) 'Long may have to change to type Int32 or DWORD
'LEFTDOWN = &H2
'LEFTUP = &H4
'RIGHTDOWN = &H8
'RIGHTUP = &H10
'MIDDLEUP = &H40
'MIDDLEDOWN = &H20
Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)DOWN is when a click button is pressed, UP is when its released.
Changing the mouse (X,Y) coordinates and simulating a mouse click :
Code
Cursor.Position = New Point(X, Y)
mouse_event(&H2, 0, 0, 1, 0)
mouse_event(&H4, 0, 0, 1, 0)Simulating a key press :
Quote:SendKeys.Send("{Enter}")
I'm not allowed to post any outside links, but you can find all the key values by typing 'SendKeys Statement' on Google.
You can also send a complete line of text directly from a textbox, and/or add some raw text :
Code
SendKeys.Send((TextBox1.Text) & "Some text you want to add after the text from Textbox1.text")Opening a link in the default browser :
Code
Process.Start("link")Hoping this will be useful to some users.
I can also help you on skype in visual basic if you are a begginer, my skype is : turgodi
Best regards.

