zemen Posted September 29, 2007 Posted September 29, 2007 Hi all, Is there a way to disable just mouse input instead of disable both mouse and keyboard using BlockInput command? thnkz
Moderators SmOke_N Posted September 29, 2007 Moderators Posted September 29, 2007 zemen said: Hi all,Is there a way to disable just mouse input instead of disable both mouse and keyboard using BlockInput command?thnkzYou could trap the mouse in a pixel region with _MouseTrap() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Paulie Posted September 29, 2007 Posted September 29, 2007 and add a little window under the mouse that will steal the clicks
Nahuel Posted September 29, 2007 Posted September 29, 2007 Here's what I've done before. I thought of using Paulie's idea, but creating a GUI would be too noticeable. I thought of using a small splash window but when you click, it disables mousetrap.. for some reason. Function: _BlockMouseMove() Requires: #include <Misc.au3> Func _BlockMouseMove($iFlag) If $iFlag <> 0 Then If $iFlag <> 1 Then Return 1;Incorrect parameters EndIf EndIf $iPos=MouseGetPos() If $iFlag = 1 Then _MouseTrap($iPos[0],$iPos[1]); Enable ;~ SplashTextOn("","",1,1,$iPos[0],$iPos[1],1); Doesn't work Return Else _MouseTrap(); Disable ;~ SplashOff() Return EndIf EndFuncoÝ÷ ØLZ^jëh×6#include <Misc.au3> _BlockMouseMove(1); Enable Sleep(2000); Do your stuff _BlockMouseMove(0);Disable
Moderators SmOke_N Posted September 29, 2007 Moderators Posted September 29, 2007 (edited) Paulie said: and add a little window under the mouse that will steal the clicks Good point, and I knew I had done something like this before with a gui as well, found it in an oooooold #include of mine (When Gary first introduced the function):#include <misc.au3> $hMBHwnd = _MouseBlock() If @error Then Exit Sleep(5000) _MouseBlock($hMBHwnd) Func _MouseBlock($hWnd = 0) If $hWnd Then _MouseTrap() Return GUIDelete($hWnd) EndIf Local $aMPOS = MouseGetPos() If IsArray($aMPOS) Then Local $hGUI = GUICreate("", 3, 20, $aMPOS[0], $aMPOS[1]-30) GUISetState(@SW_HIDE) Return _MouseTrap(MouseGetPos(0), MouseGetPos(1)) EndIf Return SetError(1, 0, 0) EndFuncoÝ÷ ØGb´k²Ì¨¹Ê.Ûkf{ bëºÚ"µÍ[ÈÓ[ÝÙPØÚÊ ÌÍÚÛH BRY ÌÍÚÛ[] Ó[ÝÙU H ÈÕRQ[]J ÌÍÚÛ JBSØØ[ ÌÍØSTÔÈH[ÝÙQÙ]ÜÊ BRYÐ^J ÌÍØSTÔÊH[BSØØ[ ÌÍÚÕRHHÕRPÜX]J ][ÝÉ][ÝËËÌ ÌÍØSTÔÖÌK ÌÍØSTÔÖÌWKLÌ BBT] ÕRTÙ]Ý]JÕ×ÒQJH ÈÓ[ÝÙU [ÝÙQÙ]ÜÊ K[ÝÙQÙ]ÜÊJJJBQ[YT]Ù]ÜK B[[ Edited September 29, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Nahuel Posted September 29, 2007 Posted September 29, 2007 (edited) ^Yours is not creating the GUI, for some reason, and you can still click... Here's an update of mine, but the little square there really bothers me: Func _BlockMouseInput($iFlag) Local Const $WS_EX_TOOLWINDOW = 0x00000080; This is to avoid including <GUicontants.au3> Local Const $WS_EX_TOPMOST = 0x00000008; This is to avoid including <GUicontants.au3> Local Const $WS_EX_WINDOWEDGE = 0x00000100; This is to avoid including <GUicontants.au3> Local $hGUI If $iFlag <> 0 Then If $iFlag <> 1 Then Return 1;Incorrect parameters EndIf EndIf $iPos=MouseGetPos() If $iFlag = 1 Then $hGUI=GUICreate("", 1, 1, $iPos[0],$iPos[1], -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)) GUISetState(@SW_SHOW) _MouseTrap($iPos[0],$iPos[1]); Enable Return Else _MouseTrap(); Disable GUIDelete($hGUI) Return EndIf EndFuncoÝ÷ ØLZ^jëh×6#include <Misc.au3> _BlockMouseInput(1) Sleep(2000) _BlockMouseInput(0) Edited September 29, 2007 by Nahuel
Moderators SmOke_N Posted September 29, 2007 Moderators Posted September 29, 2007 (edited) Nahuel said: ^Yours is not creating the GUIIt's not?I removed the @SW_HIDE and it was fine. Edited September 29, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Siao Posted September 29, 2007 Posted September 29, 2007 Func _BlockMouseInput($iFlag) Switch $iFlag Case 0 ;off GUIDelete(WinGetHandle("BlockMouseMove")) _MouseTrap() Case 1 ;on $iPos=MouseGetPos() GUICreate("BlockMouseMove", 1, 1, $iPos[0],$iPos[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetState() _MouseTrap($iPos[0],$iPos[1]) EndSwitch EndFunc "be smart, drink your wine"
Nahuel Posted September 29, 2007 Posted September 29, 2007 (edited) Ah, cool ______________ My last try, added transparency. I'm finally pleased Func _BlockMouseInput($iFlag=0,$Trans=1) ;Use $Trans=0 if you are not using Win2000/XP ; This is to avoid including <GUicontants.au3> Local Const $WS_EX_TOOLWINDOW = 0x00000080 Local Const $WS_EX_TOPMOST = 0x00000008 ;============================================ Local $hGUI If $iFlag <> 0 Then If $iFlag <> 1 Then Return 1;Incorrect parameters EndIf EndIf $iPos=MouseGetPos() If $iFlag = 1 Then $hGUI=GUICreate("", 1, 1, $iPos[0],$iPos[1], -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)) GUISetState(@SW_SHOW) If $Trans Then WinSetTrans($hGUI,"",10) EndIf _MouseTrap($iPos[0],$iPos[1]); Enable Return Else _MouseTrap(); Disable GUIDelete($hGUI) Return EndIf EndFunc Examples: If you are using Win2000/XP/Vista: #include <Misc.au3> _BlockMouseInput(1) Sleep(2000) _BlockMouseInput() Else: #include <Misc.au3> _BlockMouseInput(1,0) Sleep(2000) _BlockMouseInput() Edited September 29, 2007 by Nahuel
zemen Posted September 30, 2007 Author Posted September 30, 2007 (edited) m8s, that's all good but my prob is another... the script clicks for me in a game window. I have to leave mouse click free to do that job... that's why I cant steal click in a small window under the mouse. Trap the pointer in the game window is unuseless as well couse what I need is just to disable mouse input so my click and drag script works well even if my little dumb sister move the mouse I could use BlockInput command if I find a way to leave hotkey press activated... I just need ESC and PAUSE keys free to be pressed when BlockInput is on... any hint? (tnkz a lot ) Edited September 30, 2007 by zemen
Moderators SmOke_N Posted September 30, 2007 Moderators Posted September 30, 2007 zemen said: m8s, that's all good but my prob is another...the script clicks for me in a game window. I have to leave mouse click free to do that job... that's why I cant steal click in a small window under the mouse. Trap the pointer in the game window is unuseless as well couse what I need is just to disable mouse input so my click and drag script works well even if my little dumb sister move the mouse I could use BlockInput command if I find a way to leave hotkey press activated... I just need ESC and PAUSE keys free to be pressed when BlockInput is on... any hint?(tnkz a lot )See what happens when people don't explain themselves properly? ... You get people to take time out of their schedules for nothing ...So, let me get this right - You want to block the mouse, but not. (Unplug the mouse)You want to block the all the keys, but two. (HotKeySet(), but that's only going to work on 64 of them the easy way)There's my effort... GL Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
jvanegmond Posted September 30, 2007 Posted September 30, 2007 I have a laptop for my botting. I just unplug the mouse, and put the screen down... Done. github.com/jvanegmond
zemen Posted September 30, 2007 Author Posted September 30, 2007 SmOke_N said: See what happens when people don't explain themselves properly? ... You get people to take time out of their schedules for nothing ...So, let me get this right - You want to block the mouse, but not. (Unplug the mouse)You want to block the all the keys, but two. (HotKeySet(), but that's only going to work on 64 of them the easy way)There's my effort... GL I'm sorry m8... really! it's couse my bad eng....So there is no way to get an exeption on BlockInput command and let activated 2 keys nor a command to get out just the mouse isnt it?anyway, unplugging the mouse... a very nice idea, not a 'correct' solution... probably not working under a XP based PC with a ps2 mouse but...it' always a nice idea thnkz 4 your time
jvanegmond Posted September 30, 2007 Posted September 30, 2007 zemen said: anyway, unplugging the mouse... a very nice idea, not a 'correct' solution... probably not working under a XP based PC with a ps2 mouse but...Get an USB mouse, otherwise when you reconnect the PS/2 one it will not work. github.com/jvanegmond
Nahuel Posted September 30, 2007 Posted September 30, 2007 Manadar said: Get an USB mouse, otherwise when you reconnect the PS/2 one it will not work. What I do to make it work after I reconnect it, is go to the device manager and press 'refresh'
jvanegmond Posted September 30, 2007 Posted September 30, 2007 Nahuel said: What I do to make it work after I reconnect it, is go to the device manager and press 'refresh' Awesome trick. I'll try that at school sometime, as we have mostly PS/2 mouses and keyboards at school. Some of the newer ones are fitted with USB. github.com/jvanegmond
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now