anixon Posted January 25, 2007 Share Posted January 25, 2007 The following script has the "Pause" key assigned to the _IsPressed Key function. Can anyone show me how _IsPressed can be assigned to respond to a two key combination say "Alt + H" . This is would help minimise an event where a single key like the "Pause" assignment could be accidentally keyed or used for a process unrelated to the script. Help is always appreciated Ant... CODE; Notes: ;_IsPressed Key = "Pause" ;Call Routine ; Keymonitor() Func KeyMonitor() $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("13", $dll) Then processor() DllClose($dll) EndIf WEnd EndFunc ;Process the Panic Button ; Func processor() $PID = ProcessExists("yourprogram.exe") If $PID Then ProcessClose($PID) Run (@ScriptDir&"\yourprogram.exe") Keymonitor() EndFunc ; ;End of Script Link to comment Share on other sites More sharing options...
xcal Posted January 26, 2007 Share Posted January 26, 2007 Can anyone show me how _IsPressed can be assigned to respond to a two key combination say "Alt + H" . Two ways I can think of. First... #include <misc.au3> HotKeySet('{Esc}', 'quit') While 1 If _IsPressed('12') And _IsPressed('48') Then MsgBox(0, '', 'combo pressed') Sleep(50) WEnd Func quit() Exit EndFunc oÝ÷ Ø Ýü¨»§¶Ú¾"ÃëzËu©Ý¶¦Ç»wâæ¥Ú zØ^«¢+Ø)!½Ñ-åMÐ ÌäìÌÌí Ìäì°Ìäí±Ñ Ìäì¤)!½Ñ-åMÐ ÌäííÍôÌäì°ÌäíÅÕ¥ÐÌäì¤()1½°ÀÌØíÍÝ¥Ñ ()]¡¥±Ä(%%ÀÌØíÍÝ¥Ñ Q¡¸($%5Í ½à À°ÌäìÌäì°Ìäí½µ¼ÁÉÍÍÌäì¤($$ÀÌØíÍÝ¥Ñ ô±Í(%¹%(%M±À ÔÀ¤)]¹()Õ¹±Ñ ¤($ÀÌØíÍÝ¥Ñ ôQÉÕ)¹Õ¹()Õ¹ÅեР¤(%á¥Ð)¹Õ¹ How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
anixon Posted January 26, 2007 Author Share Posted January 26, 2007 Two ways I can think of. First... expandcollapse popup#include <misc.au3> HotKeySet('{Esc}', 'quit') While 1 If _IsPressed('12') And _IsPressed('48') Then MsgBox(0, '', 'combo pressed') Sleep(50) WEnd Func quit() Exit EndFunc Thanks very much for your help. After a bit of testing I have found that this works. [codebox] #include <misc.au3> HotKeySet('{Esc}', 'quit') Keymonitor() Func KeyMonitor() $dll = DllOpen("user32.dll") While 1 sleep(50) If _IsPressed('14' ,$dll) And _IsPressed('48', $dll) Then msgbox(0, "", "Capslock & H",5 ) EndIf If _IsPressed('14', $dll) And _IsPressed('31', $dll) Then msgbox(0, "", "Capslock & 1",5 ) EndIf WEnd DllClose($dll) EndFunc Func quit() Exit EndFunc [/codebox] Thanks again for your help very much appreciated Ant... :mellow: oÝ÷ Ø Ýü¨»§¶Ú¾"ÃëzËu©Ý¶¦Ç»wâæ¥Ú zØ^«¢+Ø)!½Ñ-åMÐ ÌäìÌÌí Ìäì°Ìäí±Ñ Ìäì¤)!½Ñ-åMÐ ÌäííÍôÌäì°ÌäíÅÕ¥ÐÌäì¤()1½°ÀÌØíÍÝ¥Ñ ()]¡¥±Ä(%%ÀÌØíÍÝ¥Ñ Q¡¸($%5Í ½à À°ÌäìÌäì°Ìäí½µ¼ÁÉÍÍÌäì¤($$ÀÌØíÍÝ¥Ñ ô±Í(%¹%(%M±À ÔÀ¤)]¹()Õ¹±Ñ ¤($ÀÌØíÍÝ¥Ñ ôQÉÕ)¹Õ¹()Õ¹ÅեР¤(%á¥Ð)¹Õ¹ Link to comment Share on other sites More sharing options...
anixon Posted January 26, 2007 Author Share Posted January 26, 2007 My last post did not get published in the right place. So here it is again. Thanks for the help I have found after some testing that this code works ok. Cheers Ant.... CODE #include <misc.au3> HotKeySet('{Esc}', 'quit') Keymonitor() Func KeyMonitor() $dll = DllOpen("user32.dll") While 1 sleep(50) If _IsPressed('14' ,$dll) And _IsPressed('48', $dll) Then msgbox(0, "", "Capslock & H",5 ) EndIf If _IsPressed('14', $dll) And _IsPressed('31', $dll) Then msgbox(0, "", "Capslock & 1",5 ) EndIf WEnd DllClose($dll) EndFunc Func quit() Exit EndFunc 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