randomboy Posted October 25, 2006 Share Posted October 25, 2006 Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc $dll = DllOpen("user32.dll") $r = Send("{BS}p") While 1 sleep (50) If _IsPressed("41") Then Send("{BS}h") EndIf I have been working with the above code and I'm trying to create a script where a user hits a key and the program sends out a random key. I have managed to set the program to send out set letters but not random letters. Can anyone help me? Thanks I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 25, 2006 Moderators Share Posted October 25, 2006 Random + Loop + Chr() 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. Link to comment Share on other sites More sharing options...
randomboy Posted October 25, 2006 Author Share Posted October 25, 2006 Thank you very much I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? Link to comment Share on other sites More sharing options...
randomboy Posted October 25, 2006 Author Share Posted October 25, 2006 (edited) Actually I don't understand what SmOke_N has told me to do. Can someone help? Edited October 25, 2006 by randomboy I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? Link to comment Share on other sites More sharing options...
BigDod Posted October 25, 2006 Share Posted October 25, 2006 Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc $dll = DllOpen("user32.dll") ;$r = Send("{BS}p") While 1 sleep (50) If _IsPressed("41") Then $key=Random(65,90) $key1=chr($key) msgbox(0,"Key sent",$key1) ;Send("{BS}h") EndIf Wend Remember it will still send the original key 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 Link to comment Share on other sites More sharing options...
randomboy Posted October 25, 2006 Author Share Posted October 25, 2006 (edited) When I tried it it didn't really work. Edited October 25, 2006 by randomboy I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? Link to comment Share on other sites More sharing options...
randomboy Posted October 25, 2006 Author Share Posted October 25, 2006 (edited) Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc $dll = DllOpen("user32.dll") While 1 sleep (50) If _IsPressed("41") Then $key=Random(65,90) Send($key) EndIf Wend I tried the above code and it gave me the following output. a75.3041700553149a71.0769480129238a66.9570499367546a80.7049670582637 I think it just gave me random numbers between 65 and 90. Does anyone know what has happened and what I need to do to solve it? Edited October 25, 2006 by randomboy I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? Link to comment Share on other sites More sharing options...
randomboy Posted October 25, 2006 Author Share Posted October 25, 2006 Not to worry I solved it. I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? Link to comment Share on other sites More sharing options...
BigDod Posted October 25, 2006 Share Posted October 25, 2006 You forgot key1=chr($key) send($key1) 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 Link to comment Share on other sites More sharing options...
randomboy Posted October 25, 2006 Author Share Posted October 25, 2006 Yeah I realised I forgot that but thanks anyway. I got inside my house, leant back on my bed and began to think...where the hell was my roof?!?!24 hours in a day....24 beers in a case....Coincidence?? 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