Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Enumeration
- #hk_ctrlm
- #hk_ctrlg
- #hk_ctrll
- #hk_ctrls
- #hk_ctrlk
- #hk_ctrlu
- #hk_ctrli
- EndEnumeration
- Procedure.s GetActiveWindowText()
- ActiveWindow.s = Space(999) : GetWindowText_(GetForegroundWindow_(),ActiveWindow,999)
- ProcedureReturn ActiveWindow
- EndProcedure
- Procedure SendInput(*txt)
- *idata = AllocateMemory(SizeOf(INPUT)*2)
- Protected *inputdata.INPUT, onekey.INPUT
- *key.CHARACTER = *txt
- While *key\c
- ; Translate the character to its virtual key code
- ; and see if it requires SHIFT to be pressed
- key.w = VkKeyScan_(*key\c)
- keyvalue = key & $FF
- shift = key >> 8
- ; Press SHIFT if indicated
- If shift
- RtlZeroMemory_(onekey,SizeOf(INPUT))
- With onekey
- \type = #INPUT_KEYBOARD
- \ki\wVk = #VK_SHIFT
- EndWith
- SendInput_(1, onekey, SizeOf(INPUT))
- EndIf
- ; Press the character key down
- *inputdata = *idata
- RtlZeroMemory_(*idata,SizeOf(INPUT)*2)
- With *inputdata
- \type = #INPUT_KEYBOARD
- \ki\wVk = keyvalue
- EndWith
- ; Release the character key
- *inputdata + SizeOf(INPUT)
- With *inputdata
- \type = #INPUT_KEYBOARD
- \ki\wVk = keyvalue
- \ki\dwFlags = #KEYEVENTF_KEYUP
- EndWith
- SendInput_(2, *idata, SizeOf(INPUT))
- ; Release the SHIFT key if we pressed it
- If shift
- RtlZeroMemory_(onekey,SizeOf(INPUT))
- With onekey
- \type = #INPUT_KEYBOARD
- \ki\wVk = #VK_SHIFT
- \ki\dwFlags = #KEYEVENTF_KEYUP
- EndWith
- SendInput_(1, onekey, SizeOf(INPUT))
- EndIf
- ; Process next character if there is one
- *key+1
- Wend
- EndProcedure
- LoadFont(1,"Terminal",12)
- OpenWindow(0,#PB_Ignore,#PB_Ignore,200,220,"mcadm b12",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
- TextGadget(1,10,10,180,20,"god mode toggle...........CTRL-G",#PB_Text_Center)
- TextGadget(2,10,40,180,20,"more items................CTRL-M",#PB_Text_Center)
- TextGadget(3,10,70,180,20,"active players............CTRL-L",#PB_Text_Center)
- TextGadget(4,10,100,180,20,"mcMMO stats...............CTRL-S",#PB_Text_Center)
- TextGadget(5,10,130,180,20,"claim chunk...............CTRL-K",#PB_Text_Center)
- TextGadget(6,10,160,180,20,"unclaim chunk.............CTRL-U",#PB_Text_Center)
- TextGadget(7,10,190,180,20,"chunk info................CTRL-I",#PB_Text_Center)
- SetGadgetFont(1,FontID(1)) : SetGadgetFont(2,FontID(1)) : SetGadgetFont(3,FontID(1)) : SetGadgetFont(4,FontID(1)) : SetGadgetFont(5,FontID(1)) : SetGadgetFont(6,FontID(1)) : SetGadgetFont(7,FontID(1))
- hk_ctrlm = RegisterHotKey_(WindowID(0),#hk_ctrlm,#MOD_CONTROL,#VK_M)
- hk_ctrlg = RegisterHotKey_(WindowID(0),#hk_ctrlg,#MOD_CONTROL,#VK_G)
- hk_ctrll = RegisterHotKey_(WindowID(0),#hk_ctrll,#MOD_CONTROL,#VK_L)
- hk_ctrls = RegisterHotKey_(WindowID(0),#hk_ctrls,#MOD_CONTROL,#VK_S)
- hk_ctrlk = RegisterHotKey_(WindowID(0),#hk_ctrlk,#MOD_CONTROL,#VK_K)
- hk_ctrlu = RegisterHotKey_(WindowID(0),#hk_ctrlu,#MOD_CONTROL,#VK_U)
- hk_ctrli = RegisterHotKey_(WindowID(0),#hk_ctrli,#MOD_CONTROL,#VK_I)
- Repeat
- ev = WaitWindowEvent()
- If ev = #WM_HOTKEY And GetActiveWindowText() = "Minecraft"
- Select EventwParam()
- Case #hk_ctrlm
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/more")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- Case #hk_ctrlg
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/god")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- Case #hk_ctrll
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/list")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- Case #hk_ctrls
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/stats")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- Case #hk_ctrlk
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/arg claim")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- Case #hk_ctrlu
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/arg unclaim")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- Case #hk_ctrli
- WindowHandle = GetForegroundWindow_()
- ProcessId = GetWindowThreadProcessId_(WindowHandle,0) ; ИД процесса активного окна
- Layout = GetKeyboardLayout_(ProcessId)
- Debug " - - - "
- Debug "Pre: " + Str(GetKeyboardLayout_(ProcessId))
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,LoadKeyboardLayout_("67699721",#KLF_ACTIVATE))
- Delay(1000)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- If GetKeyboardLayout_(ProcessId) = 67699721
- ;Debug "sending"
- keybd_event_(#VK_T,0,0,0)
- keybd_event_(#VK_T,0,#KEYEVENTF_KEYUP,0)
- Delay(500)
- SendInput(@"/arg info")
- ;Delay(50)
- keybd_event_(#VK_RETURN,0,0,0)
- keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
- Delay(1000)
- EndIf
- If Not Layout = 67699721
- PostMessage_(WindowHandle,#WM_INPUTLANGCHANGEREQUEST,0,ActivateKeyboardLayout_(Str(Layout),#KLF_ACTIVATE))
- Delay(500)
- Debug "Changed to: " + Str(GetKeyboardLayout_(ProcessId))
- EndIf
- Debug "After: " + Str(GetKeyboardLayout_(ProcessId))
- EndSelect
- EndIf
- Until ev = #PB_Event_CloseWindow
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement