Search code examples
lualogitechlogitech-gaming-software

Is there any way to get data from logitech lua log console?


I'm doing some code for my logitech mouse with lua but I can't find any way to communicate with my pc at all. No lib available here so I can't even send smth to cmd, write file, launch .bat and etc. At least I wasn't successful at this.

The only place where you can output some info is the log window. So the title asks main problem of this topic: Is there any way to get data from logitech lua log console?


Solution

  • To run a .bat file from LGS Lua script:

    Create a shortcut action

    • Run 'Logitech Gaming Software' application
    • Open 'Customise buttons' tab
    • Select profile
    • In the left side you will see the 'Commands' pane (list of bindable actions such as keyboard keys, macros, etc), press the big 'plus' sign to add new command.
    • In the 'Command Editor', select the 'Shortcut' in the left pane
      • Set the 1st text field 'Name' to RUN_BAT_FILE
      • Set the 2nd text field 'Enter a shortcut' to your_bat_file.bat
      • Set the 3rd text field 'Working Directory' to C:\Path\to\folder
    • Press 'OK' button to close the 'Command Editor'

    Now you can:

    • either bind this action to a mouse button (drag-n-drop action RUN_BAT_FILE from Commands pane to the big picture of the mouse)
    • or invoke this action from your LGS Lua script by PlayMacro("RUN_BAT_FILE")

    Please note that console window will be brought to the front, and your game will switch off fullscreen mode and will lose keyboard focus.
    That is a very nasty thing while you're playing.
    But you can invoke windowless applications without interfering the game.


    To pass a long message from LGS Lua script to external program:

    You can send strings by invoking OutputDebugMessage in your LGS script
    and receive them in your external program by means of LGS Debug Interceptor.dll.


    To pass information from your external program to your LGS Lua script:

    The best way I'm aware of is the following:
    Your external program can create a .lua-file and your LGS Lua script can execute it and receive the result (a tuple of Lua values returned by this script)

    data = dofile[[c:\some_script.lua]]