Skip to main content
Version: Next

POST EVENT

POST EVENT ( what ; message ; when ; mouseX ; mouseY ; modifiers {; process} )

ParameterTypeDescription
whatLongint🡒Type of event
messageLongint🡒Event message
whenLongint🡒Event time expressed in ticks
mouseXLongint🡒Horizontal coordinate of mouse
mouseYLongint🡒Vertical coordinate of mouse
modifiersLongint🡒Modifier keys state
processLongint🡒Destination process reference number, or Application event queue, if omitted, or 0

Description

The POST EVENT command simulates a keyboard or mouse event. Its effect is as if the user actually acted on the keyboard or the mouse.

You pass one of the following values in what:

ConstantTypeValue
Auto key eventLongint5
Key down eventLongint3
Key up eventLongint4
Mouse down eventLongint1
Mouse up eventLongint2

If the event is a mouse-related event, you pass 0 (zero) in message. If the event is a keyboard-related event, you pass the code of the simulated character in message.

Usually, you pass the value returned by Tickcount in when.

If the event is a mouse-related event, you pass the horizontal and vertical coordinates of the click in mouseX and mouseY.

In the parameter modifiers, you pass one or a combination of the constants of the Events (Modifiers) theme.

ConstantTypeValueComment
Activate window bitLongint0
Activate window maskLongint1
Caps lock key bitLongint10Windows and OS X
Caps lock key maskLongint1024Windows and OS X
Command key bitLongint8Ctrl key under Windows, Command key under OS X
Command key maskLongint256Ctrl key under Windows, Command key under OS X
Control key bitLongint12Ctrl key under OS X, or right click under Windows and OS X
Control key maskLongint4096Ctrl key under OS X, or right click under Windows and OS X
Mouse button bitLongint7
Mouse button maskLongint128
Option key bitLongint11Alt key (also called Option under OS X)
Option key maskLongint2048Alt key (also called Option under OS X)
Right control key bitLongint15
Right control key maskLongint32768
Right option key bitLongint14
Right option key maskLongint16384
Right shift key bitLongint13
Right shift key maskLongint8192
Shift key bitLongint9Windows and OS X
Shift key maskLongint512Windows and OS X

For example, to simulate the Shift key, pass Shift key bit.

If you specify the process parameter, the event is sent to the process whose process number you pass in process. If you pass 0 (zero) or if you omit the parameter, the event is sent at the application level, and the 4D scheduler will dispatch it to the appropriate process.

See also

POST CLICK
POST KEY