Mouse & Keyboard¶
Moving the mouse¶
There are two ways to move the mouse, these are:
TTarget.MouseTeleport
- Instantly changes the cursors position without taking a path.TTarget.MouseMove
- Moves the cursor using a randomized path like a human would.
For TTarget.MouseMove
there are variables to control the movement, these are:
TTarget.MouseOptions.Wind
- Strength pulling the position in random directions.TTarget.MouseOptions.Gravity
- Strength pulling the position towards the destination.TTarget.MouseOptions.Speed
- Speed of the mouse movement.
You can read a more in depth article about the algorithm used (WindMouse) here
Clicking the mouse¶
The mouse can be held, released or pressed using:
TTarget.MouseDown
TTarget.MouseUp
TTarget.MousePress
These methods use EMouseButton
enum.
The following will press the left mouse button for 50 milliseconds.
Target.MouseDown(EMouseButton.LEFT);
Sleep(50);
Target.MouseUp(EMouseButton.LEFT);
TTarget.MouseClick
will do above but will use TTarget.MouseOptions.MinClickTime
and TTarget.MouseOptions.MaxClickTime
to determine the sleep time.
TTarget.MouseOptions.MinClickTime
Minimum milliseconds to hold a mouse button.TTarget.MouseOptions.MaxClickTime
Maximum milliseconds to hold a mouse button.
Target.MouseClick(EMouseButton.LEFT);
Keyboard typing¶
TTarget.KeySend
will type text in a human like way, for example typing ‘A’ would hold the shift key down and at a customizable speed.
There are variables to control the speed. These are:
TTarget.KeyOptions.MinPressTime
Minimum milliseconds to hold a key.TTarget.KeyOptions.MaxPressTime
Maximum milliseconds to hold a key.
Keys can be held, released or pressed using:
TTarget.KeyDown
TTarget.KeyUp
TTarget.KeyPress
These methods use EKeyCode
enum.
The following will press shift for 50 milliseconds.
Target.KeyDown(EKeyCode.SHIFT)
Sleep(50);
Target.KeyUp(EKeyCode.SHIFT);
TTarget.KeyPress
will do above but will use Input.MinPressTime
and Input.MaxPressTime
to determine the sleep time.
TTarget.KeyOptions.MinPressTime
Minimum milliseconds to hold a button.TTarget.KeyOptions.MaxPressTime
Maximum milliseconds to hold a button.
Target.KeyPress(EKeyCode.SHIFT);