sd333221 Posted June 24, 2005 Posted June 24, 2005 (edited) In my script i got this -> HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) EndFunc But i want my computer still to recognice that the key A was pressed, when i am in word and i type A with the script running the MsgBox appears but he doesn't write A. I tried this -> HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) Send("A") EndFunc but it doesn't work. I need ur help guys. Thanks for ur answers! PS: I get this Error: Recursion level has been exceeded - AutoIT will quit to prevent stack overflow. Edited June 24, 2005 by sd333221
ezzetabi Posted June 24, 2005 Posted June 24, 2005 (edited) may help... AdlibEnable('_CheckAPressure', 10) While 1 Sleep(1000) WEnd Exit Func _CheckAPressure() If _IsPressed(0x41) Then;0x41 means 'A' MsgBox(0, 'Hahahah', 'I love you.') EndIf EndFunc Func OnAutoItstart() Global $DllUser32 = DllOpen('user32') EndFunc Func OnAutoItExit() DllClose($DllUser32) EndFunc Func _IsPressed($hexKey) ; $hexKey must be the value of one of the keys. ; _IsPressed will return 0 if the key is not pressed, 1 if it is. Local $aR $aR = DllCall($DllUser32, "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then Return 1 Else Return 0 EndIf EndFunc ;==>_IsPressed Btw, of course you have overstack error... Sending an 'A' when 'A' starts the function itself... Edited June 24, 2005 by ezzetabi
Lord_Doominik Posted June 24, 2005 Posted June 24, 2005 In my script i got this-> HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) EndFuncBut i want my computer still to recognice that the key A was pressed,when i am in word and i type A with the script running the MsgBox appearsbut he doesn't write A. I tried this-> HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) Send("A") EndFuncbut it doesn't work.I need ur help guys.Thanks for ur answers!PS: I get this Error: Recursion level has been exceeded - AutoIT will quit to prevent stack overflow.<{POST_SNAPBACK}>o.Oon my computer it works pretty well o.O
JSThePatriot Posted June 24, 2005 Posted June 24, 2005 In my script i got this-> HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) EndFuncBut i want my computer still to recognice that the key A was pressed,when i am in word and i type A with the script running the MsgBox appearsbut he doesn't write A. I tried this-> HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) Send("A") EndFuncbut it doesn't work.I need ur help guys.Thanks for ur answers!PS: I get this Error: Recursion level has been exceeded - AutoIT will quit to prevent stack overflow.<{POST_SNAPBACK}>Do the following...HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) HotKeySet("A") Send("A") HotKeySet("A", "laugh") EndFuncNothing against ezzetabi's code, but this is much smaller.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
FuryCell Posted June 24, 2005 Posted June 24, 2005 (edited) Do the following...HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) HotKeySet("A") Send("A") HotKeySet("A", "laugh") EndFuncNothing against ezzetabi's code, but this is much smaller.JS<{POST_SNAPBACK}>I thought letters by themselves can't be set as hotkeys.Just made a quick script to test it and it didn't work either. Edited June 24, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
herewasplato Posted June 24, 2005 Posted June 24, 2005 sd333221 said: "...and i type A with the script running the MsgBox appears but he doesn't write A...." JS offered this code:HotKeySet("A", "laugh") Func laugh() MsgBox(4096, "Hahaha", "Hahahaha", 10) HotKeySet("A") Send("A") HotKeySet("A", "laugh") EndFuncEven with the code above, might not the "A" be lost? Would this be better?HotKeySet("A", "laugh") Func laugh() HotKeySet("A") Send("A") HotKeySet("A", "laugh") MsgBox(4096, "Hahaha", "Hahahaha", 10) EndFunc ...then you do not have window focus issues... depending on the app and the computer, the app might not be ready to take the "A" right after the msgbox. If you put the msgbox ahead of the "send A", then while the computer is switching focus between the AutoIt msgbox and the app - where would the "A" be sent? ...just a thought... [size="1"][font="Arial"].[u].[/u][/font][/size]
ezzetabi Posted June 24, 2005 Posted June 24, 2005 GetAsyncKeyState of user32 is made for detecting a key pressure without stealing focus or remove the key from the queue... anyway, do as you want guys.
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