RiCK_420_333 Posted March 17, 2007 Posted March 17, 2007 I am trying to get my script to send the escape key, but I also have a hotkey set for escape key. here is the relevant portion of my script. ----- HotKeySet("{ESCAPE}", "Escape") Func Escape() $Escape = True $HasSentEscape = True Send ("{ESCAPE}") EndFunc ----- I want the script to set those variables and then proceed to send the Escape key as if it was not absorbed by the hotkey. But when I try this it goes into an infinite loop and crashes. Any suggestions how I could do this, would be greatly appreciated. A work-around I can do is make the Escape hotkey be Shift+Escape, but that's rather more of a pain in the ass, then just quickly tapping the Escape key is. So I would like to be able to do it like this, if it's possible. Thanks in advance for any tips, RiCK
Moderators SmOke_N Posted March 17, 2007 Moderators Posted March 17, 2007 Send('{ESC}')http://www.autoitscript.com/autoit3/docs/functions/Send.htm 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.
McGod Posted March 17, 2007 Posted March 17, 2007 _IsPressed() [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
RiCK_420_333 Posted March 17, 2007 Author Posted March 17, 2007 Send('{ESC}')http://www.autoitscript.com/autoit3/docs/functions/Send.htm I've already read through all that before ever coming to ask in a forum, common sence would tell one to consult the instructions before asking for help. but thanks anyways for your poke.
McGod Posted March 17, 2007 Posted March 17, 2007 #include<Misc.au3> While 1 If _IsPressed("1b") Then $Escape = True $HasSentEscape = True EndIf WEnd [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
RiCK_420_333 Posted March 17, 2007 Author Posted March 17, 2007 _IsPressed()Hi chip, thanks for you answer, that looks like it might be what I was looking for, I looked it up in the autoit help and got this:---#include <Misc.au3>$dll = DllOpen("user32.dll")While 1 Sleep ( 250 ) If _IsPressed("23", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIfWEndDllClose($dll)---Could you show me how I would use that to my benefit with what I am trying to accomplish? thanks! :-D
Moderators SmOke_N Posted March 17, 2007 Moderators Posted March 17, 2007 I've already read through all that before ever coming to ask in a forum, common sence would tell one to consult the instructions before asking for help. but thanks anyways for your poke.It wasn't a "poke", I misread what you wrote. 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.
RiCK_420_333 Posted March 17, 2007 Author Posted March 17, 2007 (edited) #include<Misc.au3>While 1If _IsPressed("1b") Then$Escape = True$HasSentEscape = TrueEndIfWEndHi, I put this in my script, but it's not seeming to detect the Escape press now at all, just passing it to the program. ---#include <Misc.au3>While 1 If $CloseGUI = "CLOSE" Then ExitLoop If _IsPressed("1b") Then ;If _IsPressed("{ESCAPE}") Then $Escape = True $HasSentEscape = True EndIf sleep(10)Wend---Also tried replacing 1b with Escape, but still nothing. Any idea why it's not working? Thanks again for the ideas though! Appreciated!EDIT: I'm thinking maybe the gui='close' is messing with it since the gui is actually closed at this point. Am I able to have more than one While 1 Wend statement in a single script? Thanks again! Edited March 17, 2007 by RiCK_420_333
_Kurt Posted March 18, 2007 Posted March 18, 2007 Am I able to have more than one While 1 Wend statement in a single script?Absolutely! You can have as many as you want, you can even have loops within loops, example: While 1 While 1 $msgbox = Msgbox(4,"","This loop will continue forever" & @CRLF & "However, if you press YES, we will view the second msgbox" & @CRLF & "But it will loop back to this after.") If $msgbox = 6 Then;If user selects YES ExitLoop ;Exit the loop EndIf WEnd Msgbox(0,"","Unfortunately, you can only view me once everytime you press YES on the other msgbox") WEnd Kurt Awaiting Diablo III..
Shevilie Posted March 18, 2007 Posted March 18, 2007 To send a char that is assigned to a Hotkey use this HotKeySet("{ESC}") Send("{ESC}") HotKeySet("{ESC}","YourFunc") Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
RiCK_420_333 Posted March 18, 2007 Author Posted March 18, 2007 To send a char that is assigned to a Hotkey use this HotKeySet("{ESC}") Send("{ESC}") HotKeySet("{ESC}","YourFunc") THANKS Shevilie!!! That is exactly what I needed to make my script work how I wanted it to!! Thanks so much!!!
Shevilie Posted March 18, 2007 Posted March 18, 2007 Hint: I found it in the secret place called The Helpfile Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
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