Opened 14 years ago

Closed 14 years ago

#1651 closed Feature Request (Completed)

Addition to _IsPressed page in Help file

Reported by: Melba23 Owned by: Jpm
Milestone: Component: Documentation
Version: Severity: None
Keywords: Cc:


A few recent forum help requests have been the result of users not waiting for a key detected by _IsPressed to be released before continuing the script. This resulted in multiple actioning of the code for that event.

Could I suggest that the following remark be added to the _IsPressed page in the Help file:


_IsPressed will return 1 until the key is released. Even brief key presses can result in multiple returns within a loop. If the code called does not include a blocking function (such as MsgBox) and the user does not require multiple returns, the script should wait until _IsPressed returns 0 before continuing.

And then alter the example as follows:

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
	Sleep ( 250 )
	If _IsPressed("24", $dll) Then
		ConsoleWrite("_IsPressed - Home Key Pressed" & @CRLF)
		; Wait until key is released
		While _IsPressed("24", $dll)
			Sleep( 250 )
	ElseIf _IsPressed("23", $dll) Then
		MsgBox(0,"_IsPressed", "End Key Pressed")


Attachments (0)

Change History (2)

comment:1 Changed 14 years ago by TicketCleanup

  • Version deleted

Automatic ticket cleanup.

comment:2 Changed 14 years ago by Jpm

  • Milestone set to
  • Owner set to Jpm
  • Resolution set to Completed
  • Status changed from new to closed

Added by revision [5869] in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jpm.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.