I try to use Logitech mouse to send string like logitech provide a software to do
I click Forward button it will send string but I can't use winform to send string to it to modify it
I find logitech has G-series Lua API
I try to use OnEvent function to control mouse click to send string
But I never Lua before.
Here is my c# code
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using LuaInterface;
namespace LuaScript
{
public partial class Form1 : Form
{
public Lua lua = new Lua();
string var = "aabbcc";
public Form1()
{
InitializeComponent();
lua.DoFile("logitechSendString.lua");
object[] objs = lua.GetFunction("OnEvent").Call(this, var);
lua.Close();
}
}
}
My lua code
function OnEvent(event, arg)
if (arg!=null)then
PressKey(arg)
ReleaseKey(arg)
Sleep(50)
PressMouseButton("Forward")
ReleaseMouseButton("Forward")
end
end
But it complie error
System.IO.FileLoadException
HResult=0x80131621
Message=Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
Source=LuaInterface
StackTrace:
LuaInterface.Lua..ctor()
LuaScript.Form1..ctor() D:\Visual Studio\LuaScript\LuaScript\Form1.cs: 15
LuaScript.Program.Main() D:\Visual Studio\LuaScript\LuaScript\Program.cs:19
How to solve this error?
And How to do use lua to control Mouse?
Thanks
mouse button #5 X2(Forward)press and release you don't need Lua at all. This could be done natively in C#. - Egor SkriptunoffForwardthen you need to create a macro in Logitech Gaming Software (press a plus sign next to "Commands" in your picture). Bind created macro to the mouse button by drag-n-drop the macro name. - Egor Skriptunoff