Th3W1z4rd Posted May 8, 2008 Share Posted May 8, 2008 hello everyone :-) I wrote this program to use my mouse with some keyboard keys, not very useful, but I'd like to do it :-) The problem is that if I use {SPACE} for DoubleClick event, it won't work with the other apps. I mean, I setted a flag to activate or not the keys...but I don't understand why it doesn't work Here's the code: expandcollapse popupGlobal $act = 1 Global $proc = "AutoItv3" HotKeySet("{RIGHT}","_MouseRight") HotKeySet("{LEFT}","_MouseLeft") HotKeySet("{UP}","_MouseUp") HotKeySet("{DOWN}","_MouseDown") HotKeySet("{ENTER}","_MouseClick") HotKeySet("{SPACE}","_MouseDoubleClick") HotKeySet("{END}","_EndProgram") HotKeySet("{PAUSE}","_ChangeScriptStatus") HotKeySet("{PGDN}","_ScrollMouseDown") HotKeySet("{PGUP}","_ScrollMouseUp") While 1 If ProcessExists($proc) Then ProcessSetPriority($proc, 4) EndIf Sleep(100) WEnd Func _MouseRight() If $act = 1 Then $pos = MouseGetPos() MouseMove($pos[0] + 10,$pos[1], 0) Else Send("{RIGHT}") EndIf EndFunc Func _MouseLeft() If $act = 1 Then $pos = MouseGetPos() MouseMove($pos[0] - 10,$pos[1], 0) Else Send("{LEFT}") EndIf EndFunc Func _MouseUp() If $act = 1 Then $pos = MouseGetPos() MouseMove($pos[0], $pos[1] - 10, 0) Else Send("{UP}") EndIf EndFunc Func _MouseDown() If $act = 1 Then $pos = MouseGetPos() MouseMove($pos[0], $pos[1] + 10, 0) Else Send("{DOWN}") EndIf EndFunc Func _MouseClick() If $act = 1 Then MouseClick("main") Else Send("{Enter}"); EndIf EndFunc Func _MouseDoubleClick() If $act = 1 Then $pos = MouseGetPos() MouseClick("main", $pos[0], $pos[1], 2) Else Send("{Space}") EndIf EndFunc Func _EndProgram() Exit 0 EndFunc func _ChangeScriptStatus() If $act=1 Then $act = 0 Else $act = 1 EndIf EndFunc Func _ScrollMouseDown() If $act=1 Then MouseDown("main") Else Send("{PGDN}") EndIf EndFunc Func _ScrollMouseUp() If $act=1 Then MouseUp("main") Else Send("{PGUP}") EndIf EndFunc Link to comment Share on other sites More sharing options...
monoceres Posted May 8, 2008 Share Posted May 8, 2008 (edited) Hi! You must deactivate the hotkey before sending the space, otherwise the the hotkey will catch that send, and send space again and catch the space and send space and... you get the point Deactivate a hotkey by skipping the function name in the hotkeyset, like this: HotKeySet("{space}") ; Disable space so we can send Send("{space}") HotKeySet("{space}","_MouseDoubleClick") ; Re-enable the hotkey Edited May 8, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Th3W1z4rd Posted May 8, 2008 Author Share Posted May 8, 2008 Ok, I got the point! Thank you very much! Link to comment Share on other sites More sharing options...
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