Code:
Sub RunCodeWith(ByRef Lines As String(), ByVal isChecked As Boolean)
If Lines.Count > 0 And isRunning Then
For Each strLine As String In Lines
arr = {}
arr = strLine.Split(Space)
Select Case arr(Zero)
Case PixLeftClick
Dim a As New Drawing.Bitmap(1, 1)
a.SetPixel(0, 0, ColorTranslator.FromHtml("#" & arr(Five)))
PictureBox2.BackColor = a.GetPixel(0, 0)
a.Dispose()
Try : If isChecked Then
Select RND.Next(Zero, Five)
Case Zero : Windows.Forms.Cursor.Position = New Point(arr(One) + One, arr(Two)) : Case One : Windows.Forms.Cursor.Position = New Point(arr(One) - One, arr(Two)) : Case Two : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) + One) : Case Three : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) - One) : Case Four : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two))
End Select
Else : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two)) : End If
Dim a2 As New Drawing.Bitmap(1, 1) : Dim b2 As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(a2)
Delay(RND.Next(Zero, arr(Three))) : mouse_event(ABSOLUTE, arr(One), arr(Two), 0, 0)
Application.DoEvents()
b2.CopyFromScreen(New Drawing.Point(arr(Six), arr(Seven)), New Drawing.Point(0, 0), a2.Size)
PictureBox1.BackColor = a2.GetPixel(0, 0)
If PictureBox1.BackColor = PictureBox2.BackColor Then
mouse_event(LEFTDOWN + LEFTUP, Zero, Zero, Zero, One) : Delay(arr(Four))
Else
Delay(arr(Three)) : Delay(arr(Four))
End If
b2.Dispose() : a2.Dispose()
PictureBox1.Dispose()
PictureBox2.Dispose()
Catch ex As Exception : End Try
Case PixRightClick
Dim a As New Drawing.Bitmap(1, 1)
a.SetPixel(0, 0, ColorTranslator.FromHtml("#" & arr(Five)))
PictureBox2.BackColor = a.GetPixel(0, 0)
a.Dispose()
Try : If isChecked Then
Select Case RND.Next(Zero, Five)
Case Zero : Windows.Forms.Cursor.Position = New Point(arr(One) + One, arr(Two)) : Case One : Windows.Forms.Cursor.Position = New Point(arr(One) - One, arr(Two)) : Case Two : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) + One) : Case Three : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) - One) : Case Four : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two))
End Select
Else : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two)) : End If
Dim a2 As New Drawing.Bitmap(1, 1) : Dim b2 As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(a2)
Delay(RND.Next(Zero, arr(Three))) : mouse_event(ABSOLUTE, arr(One), arr(Two), 0, 0)
Application.DoEvents()
b2.CopyFromScreen(New Drawing.Point(arr(Six), arr(Seven)), New Drawing.Point(0, 0), a2.Size)
PictureBox1.BackColor = a2.GetPixel(0, 0)
If PictureBox1.BackColor = PictureBox2.BackColor Then
mouse_event(RIGHTDOWN + RIGHTUP, Zero, Zero, Zero, One) : Delay(arr(Four))
Else
Delay(arr(Three)) : Delay(arr(Four))
End If
b2.Dispose() : a2.Dispose()
PictureBox1.Dispose()
PictureBox2.Dispose()
Catch ex As Exception : End Try
Case LeftClick
Try : If isChecked Then
Select Case RND.Next(Zero, Five)
Case Zero : Windows.Forms.Cursor.Position = New Point(arr(One) + One, arr(Two))
Case One : Windows.Forms.Cursor.Position = New Point(arr(One) - One, arr(Two))
Case Two : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) + One)
Case Three : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) - One)
Case Four : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two))
End Select
Else
Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two))
End If
Delay(arr(Three)) : mouse_event(LEFTDOWN, Zero, Zero, Zero, One)
Delay(arr(Four)) : mouse_event(LEFTUP, Zero, Zero, Zero, One)
Catch ex As Exception : End Try
Case RightClick
Try : If isChecked Then
Select Case RND.Next(Zero, Five)
Case Zero : Windows.Forms.Cursor.Position = New Point(arr(One) + One, arr(Two))
Case One : Windows.Forms.Cursor.Position = New Point(arr(One) - One, arr(Two))
Case Two : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) + One)
Case Three : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two) - One)
Case Four : Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two))
Case Else
End Select
Else
Windows.Forms.Cursor.Position = New Point(arr(One), arr(Two))
End If
Delay(RND.Next(Zero, arr(Three))) : mouse_event(RIGHTDOWN, Zero, Zero, Zero, One)
Delay(RND.Next(Zero, arr(Four))) : mouse_event(RIGHTUP, Zero, Zero, Zero, One)
Catch ex As Exception
End Try
Case EndCmd : If Loops > arr(1) Then : isRunning = False : Application.DoEvents() : End If
Case SendENT : SendKeys.SendWait("{ENTER}")
Case SendUp : If CheckBox4.Checked = True Then : HoldKeyDown(Keys.Up, arr(1))
ElseIf CheckBox4.Checked = False Then : SendKeys.SendWait("{UP}") : End If
Case SendDown : If CheckBox4.Checked = True Then : HoldKeyDown(Keys.Down, arr(1))
ElseIf CheckBox4.Checked = False Then : SendKeys.SendWait("{DOWN}") : End If
Case SendLeft : If CheckBox4.Checked = True Then : HoldKeyDown(Keys.Left, arr(1))
ElseIf CheckBox4.Checked = False Then : SendKeys.SendWait("{LEFT}") : End If
Case SendRight : If CheckBox4.Checked = True Then : HoldKeyDown(Keys.Up, arr(1))
ElseIf CheckBox4.Checked = False Then : SendKeys.SendWait("{RIGHT}") : End If
Case SendKey : If strLine.StartsWith(SendKey) Then : Dim str As String = strLine.Remove(0, 8) : Dim arr() As String = str.Split(CChar(" "))
For L As Integer = 0 To arr.Length - 1
If L < arr.Length - 1 Then : SendKeys.SendWait(arr(L) & " ") : Else : SendKeys.SendWait(arr(L)) : End If
Next : End If
Case Else : End Select
Delay(15)
If isRunning = False Then : Exit For : End If : Next
Loops += 1
If CheckBox5.Checked = True Then
If Loops > TextBox6.Text Then
CancelWork()
End If : End If : Else
CancelWork()
End If
- Oh my god, my eyes hurt. An unreadable code, a spaghetti code!!