Jump to content

Do....Until "I press Escape"


Recommended Posts

How about

#include <IsPressed.au3>
While 1
  Sleep(100)  
If _IsPressed('1B') = 1 Then
    
MsgBox(0, "Mouse x,y:","ESC has been Pressed")
ExitLoop
EndIf
WEnd


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 post
Share on other sites

How about

#include <IsPressed.au3>
While 1
  Sleep(100)  
If _IsPressed('1B') = 1 Then
    
MsgBox(0, "Mouse x,y:","ESC has been Pressed")
ExitLoop
EndIf
WEnd

<{POST_SNAPBACK}>

Auto it tells me that there's a mistake with the following line:

If _IsPressed('1B') = 1 Then

What is the reason ?

Link to post
Share on other sites
  • Developers

Auto it tells me that there's a mistake with the following line:

If _IsPressed('1B') = 1 Then

What is the reason ?

<{POST_SNAPBACK}>

Use HotKeySet ... that's supported without an UDF... or look up the UDF _IsPressed() and include the code.... (will be part of the Next Beta installer)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Use HotKeySet ... that's supported without an UDF... or look up the UDF _IsPressed() and include the code.... (will be part of the Next Beta installer)

<{POST_SNAPBACK}>

I tried HotKeySet("ESC", "ExitLoop") without success

But this one works perfectly even if it's quite brutal :whistle:

While 1

......................................
......................................
HotKeySet("{ESC}", "Terminate")

WEnd

Func Terminate()
Exit 0
EndFunc

Thnak you very much all :dance:

Edited by venezia
Link to post
Share on other sites

More specifically, this will also work for you:

hotkeySet("{ESC}", "terminate")

while 1
    ···
    ···
; don't forget a short delay!
    sleep(100)
wEnd

func terminate()
    exit
endFunc
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...