sd333221 Posted September 15, 2005 Posted September 15, 2005 Hi, i want my program to wait for you to type on the keyboard the keyword "secret" in the right order. Any way to get this working? i use the If _IsPressed(0x41) Then command. thank you
BigDod Posted September 15, 2005 Posted September 15, 2005 Hi,i want my program to wait for you to type on the keyboardthe keyword "secret" in theright order. Any way to get thisworking? i use theIf _IsPressed(0x41) Thencommand.thank you <{POST_SNAPBACK}>How about$pass = "secret" $passwd = InputBox("Security Check", "Enter your password.", "", "*") if $passwd = $pass Then Run ("Explorer.exe") Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
GaryFrost Posted September 15, 2005 Posted September 15, 2005 (edited) I used the beta, but you could modify this for use with the version you are using. expandcollapse popup#include <Misc.au3> HotKeySet("{Esc}","_Exit") Dim $s_word = StringSplit("SECRET","") Dim $s_notword[112] = [111, _ "01","02","04","05","06","08","09","0C","0D","10", _ "11","12","13","14","1B","20","21","22","23","24", _ "25","26","27","28","29","2A","2B","2C","2D","2E", _ "30","31","32","33","34","35","36","37","38","39", _ "41","42","44","46","47","48","49","4A","4B","4C", _ "4D","4E","4F","50","51","55","56","57","58","59", _ "5A","5B","5C","60","61","62","63","64","65","66", _ "67","68","69","6A","6B","6C","6D","6E","6F","70", _ "71","72","73","74","75","76","77","78","79","7A", _ "7B","7C","7D","7E","7F","80H","81H","82H","83H","84H", _ "85H","86H","87H","90","91","A0","A1","A2","A3","A4","A5"] For $x = 1 To $s_word[0] $s_word[$x] = String(Hex(Asc($s_word[$x]),2)) Next $x = 1 $dll = DllOpen("user32.dll") While 1 Sleep ( 100 ) If (_IsPressed($s_word[$x], $dll) And $x = 1) Or (_IsPressed($s_word[$x], $dll) And $x = 2) Or _ (_IsPressed($s_word[$x], $dll) And $x = 3) Or (_IsPressed($s_word[$x], $dll) And $x = 4) Or _ (_IsPressed($s_word[$x], $dll) And $x = 5) Or (_IsPressed($s_word[$x], $dll) And $x = 6) Then $x += 1 Else For $y = 1 To $s_word[0] If _IsPressed($s_word[$y], $dll) Then $x = 1 ExitLoop EndIf Next For $y = 1 To $s_notword[0] If _IsPressed($s_notword[$y], $dll) Then $x = 1 ExitLoop EndIf Next EndIf If $x == 7 Then MsgBox(0,"_IsPressed", "secret Pressed") ExitLoop EndIf ConsoleWrite("x = " & $x & @LF) WEnd DllClose($dll) Func _Exit() Exit EndFunc Edited September 15, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
sd333221 Posted September 15, 2005 Author Posted September 15, 2005 very intelligent and nice and working idea @ gafrost thank you
seandisanti Posted September 15, 2005 Posted September 15, 2005 I used the beta, but you could modify this for use with the version you are using.expandcollapse popup#include <Misc.au3> HotKeySet("{Esc}","_Exit") Dim $s_word = StringSplit("SECRET","") Dim $s_notword[112] = [111, _ "01","02","04","05","06","08","09","0C","0D","10", _ "11","12","13","14","1B","20","21","22","23","24", _ "25","26","27","28","29","2A","2B","2C","2D","2E", _ "30","31","32","33","34","35","36","37","38","39", _ "41","42","44","46","47","48","49","4A","4B","4C", _ "4D","4E","4F","50","51","55","56","57","58","59", _ "5A","5B","5C","60","61","62","63","64","65","66", _ "67","68","69","6A","6B","6C","6D","6E","6F","70", _ "71","72","73","74","75","76","77","78","79","7A", _ "7B","7C","7D","7E","7F","80H","81H","82H","83H","84H", _ "85H","86H","87H","90","91","A0","A1","A2","A3","A4","A5"] For $x = 1 To $s_word[0] $s_word[$x] = String(Hex(Asc($s_word[$x]),2)) Next $x = 1 $dll = DllOpen("user32.dll") While 1 Sleep ( 100 ) If (_IsPressed($s_word[$x], $dll) And $x = 1) Or (_IsPressed($s_word[$x], $dll) And $x = 2) Or _ (_IsPressed($s_word[$x], $dll) And $x = 3) Or (_IsPressed($s_word[$x], $dll) And $x = 4) Or _ (_IsPressed($s_word[$x], $dll) And $x = 5) Or (_IsPressed($s_word[$x], $dll) And $x = 6) Then $x += 1 Else For $y = 1 To $s_word[0] If _IsPressed($s_word[$y], $dll) Then $x = 1 ExitLoop EndIf Next For $y = 1 To $s_notword[0] If _IsPressed($s_notword[$y], $dll) Then $x = 1 ExitLoop EndIf Next EndIf If $x == 7 Then MsgBox(0,"_IsPressed", "secret Pressed") ExitLoop EndIf ConsoleWrite("x = " & $x & @LF) WEnd DllClose($dll) Func _Exit() Exit EndFunc<{POST_SNAPBACK}>awesome code man, but it seems like it misses keystrokes if you type too slowly... i've got an idea for another way to skin the cat... will post code shortly...
seandisanti Posted September 15, 2005 Posted September 15, 2005 (edited) awesome code man, but it seems like it misses keystrokes if you type too slowly... i've got an idea for another way to skin the cat... will post code shortly...<{POST_SNAPBACK}>ARG. i'm having 0 time to work on anything today. basically what i was going to try to do was modify your code a little. i was going to add 2 functions, the first would be called if the counter is at 1, and set a hotkey for the first character of the pass string to call the second new function. the second added function would remove the current hotkey, and increment the placeholder, announcing success if incrementing beyond the length of the string, or set hotkey to the letter at the new position. then in the main loop, there would be an if _ispressed(all letters)- with all of the letters listed AND NOT _ispressed(current hotkey reference $s_word[$x]) the condition would reset the counter to 1 if any key was pressed that isn't the hotkey. so at any given time, the hotkey is the letter needed for the pass, and any other key restarts. doing it that way though, the placeholder isn't reset if the user types too slowly. sorry i didn't add the code, but i haven't had the time to actually write it out. it took me about an hour just to get this post finished with the constant interruptions. it would not take alot of modifications, but i can't stay on one train of thought long enough to do it myself. Edited September 15, 2005 by cameronsdad
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