Jump to content

Recommended Posts

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

Link to post
Share on other sites
Link to post
Share on other sites

#include<Misc.au3>

While 1

If _IsPressed("1b") Then

$Escape = True

$HasSentEscape = True

EndIf

WEnd

Link to post
Share on other sites

_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

EndIf

WEnd

DllClose($dll)

---

Could you show me how I would use that to my benefit with what I am trying to accomplish? thanks! :-D

Link to post
Share on other sites
  • Moderators

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.

Link to post
Share on other sites

#include<Misc.au3>

While 1

If _IsPressed("1b") Then

$Escape = True

$HasSentEscape = True

EndIf

WEnd

Hi, 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 by RiCK_420_333
Link to post
Share on other sites

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..

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...