I see I have some stars on here, and that is great. But I did not put nearly enough effort into this as I could have. I spent a couple hours after supreme frustration with the lack of lua code examples. I thoroughly welcome contributions and pull requests suggesting edits, and contributing example scripts. It would be great if we could help Logitech gaming mice achieve just a little bit more of its potential. I doubt this kind of stuff is ever going to come from Logitech itself...
AbortMacro()
ClearLog()
EnablePrimaryMouseButtonEvent()
OnEvent()
GetDate()
GetKeyState()
GetMKeyState()
GetMousePosition()
GetRunningTime()
IsKeyLockOn()
IsModifierPressed()
IsMouseButtonPressed()
MoveMouseRelative()
MoveMouseTo()
MoveMouseToVirtual()
MoveMouseWheel()
OnEvent()
OutputDebugMessage()
OutputLCDMessage()
OutputLogMessage()
PlayMacro()
PressAndReleaseKey()
PressAndReleaseMouseButton()
PressKey()
PressMouseButton()
ReleaseKey()
ReleaseMouseButton()
SetBacklightColor(
SetMKeyState()
SetMouseDPITable()
SetMouseDPITableIndex()
Sleep()
“MOUSE_BUTTON_PRESSED” 1|2|3|4|5|6 LB|MB|RB|XB1|XB2
“MOUSE_BUTTON_RELEASED” 1|2|3|4|5|6 LB|MB|RB|XB1|XB2
"G_PRESSED"|"G_RELEASED" 1|2|3…18 G1|G2|G3…G18
"M_PRESSED"|"M_RELEASED" 1|2|3 M1|M2|M3
"PROFILE_ACTIVATED" none none
"PROFILE_DEACTIVATED" none none
ARG:MOUSE ==> 1:LB | 2:MB | 3:RB | 4:XB1 | 5:XB2
if (event == "PROFILE_ACTIVATED") then end
if (event == "PROFILE_DEACTIVATED") then end
if (event == "G_PRESSED" and arg == 1) then end
if (event == "G_RELEASED" and arg == 1) then end
if (event == "M_PRESSED" and arg == 1) then end
if (event == "M_RELEASED" and arg == 1) then end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 6) then end
function OnEvent(event, arg [, family])
doStuff
end
if condition then
doStuff
end
if not condition then
doStuff
end
for iter = 0, 10 do
doStuff
end
1 | LButton [FN2]
2 | MButton
3 | RButton
4 | XButton1
5 | XButton2
OnEvent(
event, arg [, family])
;EnablePrimaryMouseButtonEvent(
true|false)
;PlayMacro(
"my macro")
;
MoveMouseWheel(
-1|1)
; -- mouse wheel [-1|1] click downMoveMouseTo(
0, 0)
; -- mouse to upper left cornerMoveMouseTo(
32767, 32767)
; -- mouse to center screenMoveMouseTo(
65535, 65535)
; -- mouse to lower right cornerMoveMouseRelative(
0, 0)
; -- move [dx, dy] relative to current positionMoveMouseToVirtual(
0, 0)
; -- mouse to absolute position on multi-monitor layout
SetBacklightColor((red, green, blue, [family]);
SetMKeyState(mkey, [family]);
SetMouseDPITable({value1, value2, value3}, [index]);
SetMouseDPITable({500, 1000, 1500, 2000, 2500, ...16_entry_max})
SetMouseDPITableIndex(1|2|3 ...16);
Sleep( 20 );
-- ——————————————————————————————————————————————————————————————————————————————————————
GetDate() • GetMousePosition() • GetRunningTime() • GetKeyState() • GetMKeyState()
-- ——————————————————————————————————————————————————————————————————————————————————————
date = GetDate([format [, time]])
x, y = GetMousePosition()
t_ms = GetRunningTime();
"M1"|"M2"|"M3" = GetMKeyState(“kb”|"lhc")
"M1"|"M2"|"M3" = GetMKeyState()
OutputDebugMessage("logs to Windows debugger");
OutputLCDMessage("logs to LCD");
OutputLogMessage('logs to script editor');
AbortMacro();
ClearLog();
PressAndReleaseMouseButton(1|2|3|4|5|6)
PressMouseButton(1|2|3|4|5|6)
ReleaseMouseButton(1|2|3|4|5|6)
-- keynames
PressAndReleaseKey("a", "b", "c", ...)
PressKey("a", "b", "c", ...)
ReleaseKey("a", "b", ...)
-- scancodes
PressAndReleaseKey(1, 2, 4, ...)
PressKey(1, 2, 3 ...)
true|false = IsKeyLockOn();
true|false = IsModifierPressed("lalt"|"ralt"|"alt")
true|false = IsModifierPressed("lctrl", "rctrl", "ctrl"
true|false = IsModifierPressed("lshift"|"rshift"|"shift")
true|false = IsMouseButtonPressed( 1|2|3|4|5|6 )
function OnEvent(event, arg)
if (event == "PROFILE_ACTIVATED") then
-- profile has been activated
end
if (event == "PROFILE_DEACTIVATED") then
-- profile has been deactivated
end
if (event == "G_PRESSED" and arg == 1) then
-- G1 has been pressed
end
if (event == "G_RELEASED" and arg == 1) then
-- G1 has been released
end
if (event == "M_PRESSED" and arg == 1) then
-- M1 has been pressed
end
if (event == "M_RELEASED" and arg == 1) then
-- M1 has been released
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6) then
-- Mouse Button 6 has been pressed
End
if (event == "MOUSE_BUTTON_RELEASED" and arg == 6) then
-- Mouse Button 6 has been released
end
end
PressMouseButton(1)
if IsMouseButtonPressed(1) then
OutputLogMessage("Left mouse button is pressed.\n");
end
ReleaseMouseButton(1)
if not IsMouseButtonPressed(1) then
OutputLogMessage("Left mouse button is not pressed.\n");
end
PressKey("lshift")
if IsModifierPressed("shift") then
OutputLogMessage("shift is pressed.\n");
end
ReleaseKey("lshift")
if not IsModifierPressed("shift") then
OutputLogMessage("shift is not pressed.\n");
end
OutputLogMessage("Today’s date/time is: %s\n", GetDate())
function OnEvent(event, arg)
if (event == "G_PRESSED" and arg == 1) then
SetMkeyState(1);
end
end
String Functions | |
---|---|
string.char string.dump string.find string.format string.gmatch string.gsub |
string.lower string.match string.rep string.reverse string.sub string.upper |
Table Functions | |
---|---|
table.inserttable.maxn |
table.sort |
Math Functions | ||
---|---|---|
math.acos math.asin math.atan math.atan2 math.ceil math.cos math.deg math.exp math.floor |
math.frexp math.huge math.ldexp math.log math.log10 math.max math.min math.modf math.pi |
math.rad math.random math.randomseed math.sin math.sinh math.sqrt math.tan math.tanh |
[FN1] | The numbers on the left substitute for the mouse buttons on the right, when used as arguments for functions (e.g., PressMouseButton( ) ). |
[FN2] | LButton (1) not reported by default. Use EnablePrimaryMouseButtonEvents(true) to override. |