Reputation: 15
I am trying to create a script that spams w when windows key is pressed, but it says Lua Error (5): invalid argument: modifier not specified, this is my script.. any help would be greatly appreciated
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if IsModifierPressed ("appkey") then --windows key is appkey i am assuming
repeat
Sleep(100)
PressKey("w")
Sleep(100)
ReleaseKey("w")
until not IsModifierPressed ("appkey")
end
end
and also I am trying to make a quick switch script as well, if I press the right mouse button and left mouse button at the same time then it would automatically press the key q, but I get the error saying Syntax Error:Line:2
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == "3","1" then
repeat
PressKey("q")
Sleep(2)
ReleaseKey("q")
end
end
Upvotes: 0
Views: 5073
Reputation: 23767
-- if I press the right mouse button and left mouse button at the same time
-- then it would automatically press the key q
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and arg < 3 then
repeat
Sleep(10)
if IsMouseButtonPressed(1) and IsMouseButtonPressed(3) then
PressKey("q")
Sleep(10)
ReleaseKey("q")
else
break
end
until nil
end
end
Upvotes: 1
Reputation: 28994
According to the manual the modifier must be one of the following strings:
"lalt", "ralt", "alt", "lshift", "rshift", "shift", "lctrl", "rctrl", "ctrl"
"appkey"
is not in that list. Hence you get an error. Please read manuals.
https://douile.github.io/logitech-toggle-keys/APIDocs.pdf Page 17
Windows key is "lgui" and "rgui" and it is just a key, not a modifier. Modifiers modify the meaning of a key, as the name indicates.
Upvotes: 1