Command: IsKeyPressed

DIAdem 2018 Help

Edition Date: June 2018
Part Number: 370858P-01
View Product Info

DOWNLOAD (Windows Only)

DIAdem 2017 Help
DIAdem 2018 Help
DIAdem 2019 Help
DIAdem 2020 Help
DIAdem 2020 SP1 Help

Specifies whether the specified key was pressed.

ReturnValue = IsKeyPressed(KeyValue)

Input Parameters

KeyValue Specifies the pressed key.
Integer variable
-2147483648 <= KeyValue <= 2147483647
The following list contains some possible values. You can find a detailed list on the internet under the search term "Virtual Keys". The Hex value and the associated key are specified.
&H01Left mouse button
&H02Right mouse button
&H04Middle mouse button
&H10<Shift> key
&H11CTRL key
&H1BESC key
&H0DEnter key
&H70 to &H87HF1- to F24 keys
&H41 to &H5AA- to Z keys
&H30 to &H390- to 9 keys
&H60 to &H690- to 9 keys on the numeric block

Return Parameters

ReturnValue The return value is a Boolean variable type.

Use the IsKeyPressed command to request the keys of the keyboard and of the mouse. The command returns the physical key not the logical key. For example, even if a left-handed user re-configured the mouse buttons, the command returns the left mouse button when this button is pressed.


The following example outputs a message after the space bar was pressed. The KeyWait stops the script until a key is pressed.

Call MsgBoxDisp("Press space bar.",,,,5,True)
Do While Not IsKeyPressed(&H20) 
  Call KeyWait
Call MsgBoxDisp("Space bar pressed")



Not Helpful