All pastes #471980 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-05 07:09 UTC
rendered paste body
Hotkeyset("{HOME}", "Program")
$GUI = GuiCreate("gT - By BoB", 300, 300,(@DesktopWidth-500)/2, (@DesktopHeight-400)/2 , $WS_OVERLAPPED+$WS_CAPTION+$WS_SYSMENU+$WS_MINIMIZEBOX+$WS_VISIBLE+$WS_CLIPSIBLINGS)

; __ __  O
;|  |  |
;|  |  | |  __  __
;|  |  | | |_  |
;|  |  | | __| |__


$lastexe = IniRead("gT.ini", "Info", "$lastexe", "GT.exe")
$bhkey = IniRead("gT.ini", "Keys", "$bhkey", "20")
$apfkey = IniRead("gT.ini", "Keys", "$apfkey", "01")
$comboBH = GUICtrlCreateCombo("Select Key...", 10, 105, 100)
$comboBH2 = GUICtrlSetData(-1,"Mouse1|Mouse2|Mouse3|Enter|Space|Shift|Ctrl|Alt|End|KP_INS","")
$comboAPF = GUICtrlCreateCombo("Select Key...", 10, 165, 100)
$comboAPF2 = GUICtrlSetData(-1,"Mouse1|Mouse2|Mouse3|Enter|Shift|Ctrl|Alt|End","")
$exe = GUICtrlCreateEdit($lastexe, 10, 30, 150, 20, $ES_MULTILINE = 0)


; __ __
;|  |  |
;|  |  |  __   __
;|  |  | / _\ |  | |  |
;|  |  | \___ |  | |__|

$menu1 = GUICtrlCreateMenu("Program")
$menuitemExit = GUICtrlCreateMenuitem("Exit", $menu1)


;|          |         |
;|          |         |
;|      __  |__   __  |  __
;|     /  | |  | / _\ | |_
;|____ \__| |__| \___ | __|

$exelbl = GUICtrlCreateLabel("Exe Name", 10, 10, -1, 15)
$bhkeylbl = GUICtrlCreateLabel("Bunny Hop Key", 10, 80, -1, 15)
$apfkeylbl = GUICtrlCreateLabel("Auto Pistol Fire Key", 10, 135, -1, 15)


; ___
;|   |
;|___|      _|_ _|_  __   __   __
;|   | |  |  |   |  |  | |  | |_
;|___| |__|  |   |  |__| |  | __|
$addbtn = GUICtrlCreateButton("Add", 160, 29, -1, 22)
$onbtn = GUICtrlCreateButton("ON", 150, 100)


; _____
;|
;|___        __   __  __
;|     |  | |  | |   |_
;|     |__| |  | |__ __|

Func _IsPressed($hexKey)
   Local $aR, $bO
   $hexKey = '0x' & $hexKey
   $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
   If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
           $bO = 1
      Else
      $bO = 0
   EndIf
   Return $bO
EndFunc


Func CheckComboBH()
   $keybh = GUICtrlRead($comboBH)
   If $keybh = "Mouse1" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "01")
   Elseif $keybh = "Mouse2" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "02")
   Elseif $keybh = "Ctrl" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "11")
   Elseif $keybh = "Alt" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "12")
   Elseif $keybh = "End" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "23")
   Elseif $keybh = "Shift" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "10")
   Elseif $keybh = "Mouse3" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "04")
   Elseif $keybh = "Enter" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "0D")
   Elseif $keybh = "KP_INS" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "60")
   Elseif $keybh = "Space" Then
      IniWrite("gT.ini", "Keys", "$bhkey", "20")

   EndIf
EndFunc

Func CheckComboAPF()
   $keyapf = GUICtrlRead($comboAPF)
   If $keyapf = "Mouse1" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "01")
   Elseif $keyapf = "Mouse2" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "02")
   Elseif $keyapf = "Ctrl" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "11")
   Elseif $keyapf = "Alt" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "12")
   Elseif $keyapf = "End" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "23")
   Elseif $keyapf = "Shift" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "10")
   Elseif $keyapf = "Mouse3" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "04")
   Elseif $keyapf = "Enter" Then
      IniWrite("gT.ini", "Keys", "$apfkey", "0D")
   EndIf
EndFunc

Func WriteExe()
   $exe2 = GUICtrlRead($exe)
   $writeexe = IniWrite("gT.ini", "Info", "$lastexe", "" & $exe2)
   $exe1 = GUICtrlSetData($lastexe, $exe)
EndFunc

Func On()
   While 2
      If _IsPressed($bhkey) = 0 Then Sleep(1)
      If _IsPressed($apfkey) = 0 Then Sleep(1)
      If _IsPressed($apfkey) = 1 Then APF()
      If _IsPressed($bhkey) = 1 Then BH()
   Wend
EndFunc


Func APF()
   While 1
      If _IsPressed($apfkey) = 0 Then ProcessSetPriority($lastexe, 2)
      If _IsPressed($apfkey) = 0 Then Sleep(1)
      If _IsPressed($bhkey) = 1 Then BH()
      If _IsPressed($apfkey) = 0 Then ContinueLoop
         ProcessSetPriority($lastexe, 3)
         Send("{F12}")
         Sleep(25)
   Wend
EndFunc

Func BH()
   While 1
      If _IsPressed($bhkey) = 0 Then ProcessSetPriority($lastexe, 2)
      If _IsPressed($bhkey) = 0 Then Sleep(1)
      If _IsPressed($apfkey) = 1 Then APF()
      If _IsPressed($bhkey) = 0 Then ContinueLoop
         ProcessSetPriority($lastexe, 3)
         Send("{F11}")
         Sleep(85)
   Wend
EndFunc


Func Program()
WinSetState ("gT - By BoB","", @SW_SHOW)
GuiSetState()
While 1
   $msg = GuiGetMsg()
   Select
   Case $msg = $GUI_EVENT_CLOSE
      Exit
   Case $msg = $menuitemExit
      Exit
   Case $msg = $comboBH
      CheckComboBH()
   Case $msg = $comboAPF
      CheckComboAPF()
   Case $msg = $addbtn
      WriteExe()
   Case $msg = $onbtn
      WinSetState ("gT - By BoB","", @SW_HIDE)
      On()
   EndSelect
Wend
EndFunc

;|         | |    O |
;|    _    | |      |
;|   / \   | |__  | |  __
;|  /   \  | |  | | | / _\
; \/     \/  |  | | | \___


WinSetState ("gT - By BoB","", @SW_SHOW)
GuiSetState()
While 1
   $msg = GuiGetMsg()
   Select
   Case $msg = $GUI_EVENT_CLOSE
      Exit
   Case $msg = $menuitemExit
      Exit
   Case $msg = $comboBH
      CheckComboBH()
   Case $msg = $comboAPF
      CheckComboAPF()
   Case $msg = $addbtn
      WriteExe()
   Case $msg = $onbtn
      WinSetState ("gT - By BoB","", @SW_HIDE)
      On()
   EndSelect
Wend