In general, SendMessage and PostMessage are two Win API functions that are available not only in the bot script engine.
In our case, we will focus on their wrappers: Engine.SendMessage and Engine.PostMessage

Let's start as usual with the question - what are they doing?
These functions send a message to one or more game-windows. What is important is the fact that you can send messages into minimized windows! The difference between them is that SendMessage sends a message and waits for the target window to process this message, while PostMessage simply puts the message in the queue and the program continues. In the case where pointers to dynamically allocated data are involved in the message, it is preferable to use SendMessage, because otherwise, it is possible that when the target window starts processing the message, the pointers will already be released. n general, the target window descriptor (HWND) is required in both functions, but since we consider the wrappers as commands of the script engine, then there will automatically be a handle to the current window with the game.

What is a message?
This is information about some changes in the user interface, such as moving a window or pressing a key on a keyboard/mouse. Messages also notify the program that the specified length of time has elapsed. Messages are used for data sharing operations. From a programming point of view, a message is an unsigned integer value (Cardinal).

The message can be represented by the following entry:

Message = record
 msg : longint;    // message number
 lParam : longint; // information
 wParam : longint; // fields

The lParam and wParam fields contain additional information about the event, for example, for the wm_lbuttondown message (pressing the LMB), lParam contains the coordinates of the mouse pointer at the moment the mouse is pressed, wParam contains information whether the Ctrl or Shift keys were pressed at the moment the mouse button was clicked.

Why is all this necessary?
With the help of these commands, you can implement your clicker, for example for enchanting things and similar tasks. In addition, you can enter the text from the keyboard, although for this there is a more convenient command Engine.EnterText

How to use it?
In order to send a message, you need to know what exactly you are sending, so we read the documentation, google it and tense it.
Immediately it should be noted that the script will need to specify the message code, i.e. number:

Engine.SendMessage($102, 65, 0);

Here $102 is the WM_CHAR message, 65 - button A code, 0 is depending on the value of the third parameter, it may have a different meaning, as a rule, this is written in the same place as the message description