Opened 15 years ago
Closed 15 years ago
#1651 closed Feature Request (Completed)
Addition to _IsPressed page in Help file
| Reported by: | Melba23 | Owned by: | Jpm | 
|---|---|---|---|
| Milestone: | 3.3.7.0 | Component: | Documentation | 
| Version: | Severity: | None | |
| Keywords: | Cc: | 
Description
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:
Remarks:
_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 )
		WEnd
	ElseIf _IsPressed("23", $dll) Then
		MsgBox(0,"_IsPressed", "End Key Pressed")
		ExitLoop
	EndIf
WEnd
DllClose($dll)
M23
Attachments (0)
Change History (2)
comment:1 Changed 15 years ago by TicketCleanup
- Version 3.3.6.0 deleted
comment:2 Changed 15 years ago by Jpm
- Milestone set to 3.3.7.0
- Owner set to Jpm
- Resolution set to Completed
- Status changed from new to closed
Added by revision [5869] in version: 3.3.7.0
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.


Automatic ticket cleanup.