ASawyer Posted February 14, 2008 Share Posted February 14, 2008 I would like to know if for example someone types in asdf at any time while in windows, and then do something. Basically what I'm trying to do is instead of using a hotkey, if the user types a secret code like 3edhe, or something that I have decided, then I want to run a certain function. I tried searching but I'm sure I'm sure not using the right keywords. Thanks, Alan Link to comment Share on other sites More sharing options...
martin Posted February 14, 2008 Share Posted February 14, 2008 (edited) I would like to know if for example someone types in asdf at any time while in windows, and then do something. Basically what I'm trying to do is instead of using a hotkey, if the user types a secret code like 3edhe, or something that I have decided, then I want to run a certain function. I tried searching but I'm sure I'm sure not using the right keywords. Thanks, AlanThere are a few ways it can be done. Here is a fairly simple way using Hot Keys. It isn't foolproof but you can can add hotkeys if required to break a false trigger. expandcollapse popupHotKeySet("{ESC}","gone");allow us to quit Global $code = "subprime";the code to detect Global $arrayc = StringSplit($code, "") Global $progress = 0;how many keys in sequence detected For $n = 1 To $arrayc[0] HotKeySet($arrayc[$n], "hcoder") Next ;add some keys that are not in the code but chosen so it is unlikely ;that the keys will occur in sequence without one of these being pressed HotKeySet("{SPACE}","hcoder") HotKeySet("{ENTER}","hcoder") ;add more if needed. While 1;hang around while waiting for keys Sleep(20) WEnd Func hcoder() HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) If @HotKeyPressed = $arrayc[$progress + 1] Then $progress += 1 ConsoleWrite("count = " & $progress & @LF) Else $progress = 0 EndIf If $progress >= StringLen($code) Then MsgBox(0, 'hey', "that's my code") EndIf HotKeySet(@HotKeyPressed, "hcoder") EndFunc ;==>hcoder Func gone() Exit EndFunc ;==>gone Edited February 14, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ResNullius Posted February 15, 2008 Share Posted February 15, 2008 (edited) I would like to know if for example someone types in asdf at any time while in windows, and then do something.Basically what I'm trying to do is instead of using a hotkey, if the user types a secret code like 3edhe, or something that I have decided, then I want to run a certain function.I tried searching but I'm sure I'm sure not using the right keywords.Thanks,AlanTwo other approaches: chris95219's @ http://www.autoitscript.com/forum/index.ph...st&p=361763and Manadar's @ http://www.autoitscript.com/forum/index.ph...st&p=247970Edit: Manadar's require's Larry's hook.dll from here: http://www.autoitscript.com/forum/index.ph...st&p=458286 Edited February 15, 2008 by ResNullius 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