#include <WinAPI.au3>
#include <WinAPIEx.au3>
#Include <Array.au3>
#include <process.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>
Global Const $VK_OEM_PLUS = 0xBB
Global Const $VK_OEM_MINUS = 0xBD
Global Const $VK_OEM_3 = 0xC0
Global Const $VK_TAB = 0x9
Global Const $VK_ESC = 0x1B
Global Const $VK_F5 = 0x74
Global Const $VK_F12 = 0x7B
HotKeySet("{ESC}", "OnAutoItExit")
HotKeySet("{Home}", "Farm")
Func OnAutoItExit()
Exit
EndFunc
while 1
sleep (100)
WEnd
Func Farm()
$list = ProcessList("notepad.exe")
for $i = 1 to $list[0][0]
$Data= _WinAPI_EnumProcessWindows($list[$i][1], 0)
;_ArrayDisplay($Data)
next
$hWnd = WinGetHandle( "[CLASS:$Data[1][1]]" )
$Virtual_Key_Code = 0x10
_SendKeys($hwnd, "M keys M")
KeySend($hwnd, 0x4D)
MsgBox(1,"","")
EndFunc
Func KeySend($hWnd, $Virtual_Key_Code)
if Not IsHWnd($hWnd) Then _
$hWnd = GUICtrlGetHandle($hWnd)
_SendMessage($hWnd,$WM_KEYDOWN,$Virtual_Key_Code,0)
_SendMessage($hWnd,$WM_KEYUP,$Virtual_Key_Code,0)
EndFunc
Func _SendKeys($hWnd, $keys)
If $hWnd <= 0 Or StringLen($keys) = 0 Then
SetError(-1)
Return False
EndIf
$keys = StringUpper($keys)
$keys = StringReplace($keys, "`", Chr($VK_OEM_3))
$keys = StringReplace($keys, "~", Chr($VK_OEM_3))
$keys = StringReplace($keys, "-", Chr($VK_OEM_MINUS))
$keys = StringReplace($keys, "=", Chr($VK_OEM_PLUS))
$keys = StringReplace($keys, "{ENTER}", Chr(0xD))
$keys = StringReplace($keys, "{TAB}", Chr(0x9))
$keys = StringReplace($keys, "{ESC}", Chr($VK_ESC))
$keys = StringReplace($keys, "{F5}", Chr($VK_F5))
$keys = StringReplace($keys, "{F12}", Chr($VK_F12))
$keys = StringReplace($keys, "M", Chr(0x4D))
$keys = StringReplace($keys, "{SHIFT}", "+")
Local $i, $ret
Local $shiftdown = False
For $i = 1 To StringLen($keys)
If StringMid($keys, $i, 1) = "+" Then
DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x002A0001)
DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x10, "long", 0x402A0001)
$shiftdown = True
Sleep(1)
ContinueLoop
Else
$ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc(StringMid($keys, $i, 1)), "int", 0)
If IsArray($ret) Then
DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]))
Sleep(1)
DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc(StringMid($keys, $i, 1)), "long", _MakeLong(1, $ret[0]) + 0xC0000000)
EndIf
EndIf
If $shiftdown Then
Sleep(1)
DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x10, "long", 0xC02A0001)
$shiftdown = False
EndIf
Next
Return True
EndFunc
Func _ArrowKey($hWnd, $key)
If $hWnd <= 0 Or ($key <> "left" And $key <> "right" And $key <> "up" And $key <> "down") Then
SetError(-1)
Return
EndIf
Local $wParam, $lParam, $ret
If $key = "left" Then
$wParam = 0x25
$lParam = 0x14B0001
ElseIf $key = "right" Then
$wParam = 0x27
$lParam = 0x14D0001
ElseIf $key = "down" Then
$wParam = 0x28
$lParam = 0x1500001
ElseIf $key = "up" Then
$wParam = 0x26
$lParam = 0x1480001
EndIf
$ret = DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", $wParam, "int", $lParam)
If $ret[0] = 0 Then
MsgBox(16, "_ArrowKey Error", "There was an error posting the WM_KEYDOWN message")
SetError(-2)
Return
EndIf
Sleep(2)
$ret = DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", $wParam, "int", ($lParam + 0xC0000000))
If $ret[0] = 0 Then
MsgBox(16, "_ArrowKey Error", "There was an error posting the WM_KEYUP message")
SetError(-3)
Return
EndIf
EndFunc