- Macro Interpreter is a project that can simulate the mouse/keyboard action with script.
- This program can simulate the input by using both virtual keycode and scancode mode. Which allow the action can be caught by the directx game.
- The user can specify the
X1
(side button of the mouse),X2
(side button of the mouse),F1
~F12
to trigger the script or useScrollLock
to run the script in loop mode. - You also can long-press the trigger key, it will act as in loop mode.
- This function will prevent you from switching the window while running the script.
- Such that when you are running the script in a game application window, and you forget that the script is running and switch to explorer. Then the script may mess up your files.
- This program use Query Performance Counter as delay.
- QPC is a very high precision sleep function with error time ≤ 0.05ms.
- E.g. for a
pause(100)
call- CPU usage ≤ 0.2%
- Maximum error time ≤ 35us
- Average error time over 100 runs ≤ 1us
- There are two style of script.
- Main only Script
- 3 Step Script
- If debug is specified. It will also runs the getcursor mode. Cursor pos, pressed key and sleep_api_time_resolution(TRes) will be shown in title.
- If directx is specified. It will simulate all the input action with scancode, otherwise the virtual keycode will be used.
- If scrollLockDisable is specified. It will disable scrolllock as loop mode trigger.
- If verboseMode is specified. It will display all the input it sent.
- Targetkey is the trigger key to run the script. You can use
X1
,X2
andF1
~F12
to trigger the script. - Latency is the delay time which will be added between each input action.
[debug]?
[directx]?
[scrollLockDisable]?
[verboseMode]?
[targetKey]?
[latency]
[main]+
[debug]?
[directx]?
[scrollLockDisable]?
[verboseMode]?
[targetKey]?
[latency]
[pre]*
%
[main]+
%
[post]*
- Debug
- "debug"
- directx
- "directx"
- scrollLockDisable
- "scrdis"
- verboseMode
- "verbose"
- targetKey
- "F1"
- ...
- "F12"
- "X1"
- "X2"
- latency
- Non-negative integer number
- lines
- click [key|vk]
- press [key|vk]
- release [key|vk]
- mouse [L|R][0|1]?//click if no 0/1, press if 0, release if 1.
- mgoto [x] [y]
- mgotor [x] [y]//relative
- pause [ms]
- system [cmd]
- click [key|vk]
- click [key|vk]
- e.g.
click z
,click 65
- press [key|vk]
- the same as click but only press
- e.g.
press x
- release [key|vk]
- the same as click but only release
- e.g.
press i
- mouse [L|R][0|1]?
- click/press/relase the mouse
- L/R specify left key or right key.
- click if no 0/1, press if 0, release if 1.
- e.g.
mouse L
,mouse R0
- mgoto [x] [y]
- move mouse arrow to x,y absolute coordinate.
- e.g.
mgoto 1920 1080
- mgotor [x] [y]
- move mouse arrow with x,y relative coordinate.
- e.g.
mgotor 200 250
- pause [ms]
- pause time in millisecond
- e.g.
pause 35
- system [cmd]
- run the system command
- e.g.
system "another_program.exe"
- Example 1
50
click f
- Example 2:
F2
50
press a
%
click t
%
release a
- Example 3:
directx
F3
20
mouse L
- Example 4:
directx
20
click p
%
click c
%
- Example 5:
debug
directx
scrdis
X2
30
click p
click i
- The program take parameters as script file path. So you can start the script by issue the
macro-interpreter.exe script1.txt script2.txt
or just drag&drop the script file onto themacro-interpreter.exe
. - The program will use
macro.txt
as default script path if not provide.