-
-
Notifications
You must be signed in to change notification settings - Fork 1
LGS Script Integration
This optional step provides closer integration with Logitech Gaming Software to allow the following features:
- Quicker/more accurate and efficient game profile switch detection.
- Detection of current memory slot (M#) on keyboards and G13 keypad.
- Sending G key/mouse button press events to Touch Portal.
Unfortunately this requires a special Lua script to be configured for each game profile (LGS allows for custom scripts in profiles). The good news is that I've provided a utility to automatically set up these scripts for all your existing profiles. However, if you already use custom scripts, you may want to do this manually. Only the profiles you want to use the extra features with would need to have this special script set up.
If you have profiles which already use Lua scripting, you will probably want to integrate things manually (see Options 2 and 3). But the utility I provide (Option 1) can also be used to selectively update profiles, for example ones that don't already use any scripting.
- If LGKeys Plugin is already running, you should stop it. This can be done from the TP Settings -> Plug-ins screen.
- Shut down/close the Logitech Gaming Software completely (right-click the taskbar icon and select Exit).
- Open a Windows command prompt in the
tools
folder where you unpacked the downloaded plugin zip archive (or in the source version). - Run the utility by entering:
update_profiles
(you can also just double-click to run this file from Explorer, but I recommend you use a command prompt). If using the source code version, just run the ".py" file instead.- Read the warnings. It will ask you to confirm that you want to proceed (you must answer with a "y" or "yes").
- By default it will also make a backup of all your profiles before it does anything else.
The backup will be in a uniquely-named sub-folder of your LGS profiles folder. You can also specify a backup folder using the
-b
startup option.
Eg.update_profiles -b C:\temp\LGS_profiles
- The utility will let you know if there is an error or any other problems or warnings.
- If it can't find your game profiles in the default location, you can specify one on the command line with
-p
option.
Eg.update_profiles -p C:\ProgramData\Logitech\profiles
- You can update only one, or some, of your profiles, using the
--names
option.
Eg.update_profiles --names "Default Profile" "My Game"
- Alternatively, you could copy all your profiles to a temporary directory first, then modify those versions (with the
-p
option above), and manually copy them back to the LGS profiles folder. - Run
update_profiles -h
to see all command line options.
- Restart the Logitech Gaming Software application (eg. from your Start menu), and Touch Portal or just the plugin itself (agin from the TP Settings screen).
- Open the Logitech Gaming Software application and go to the device setup page where you normally set up macros and such.
- Right-click on the icon of a profile you want to set up and select the Scripting menu item. This opens up the Lua script editor. Usually every profile has a simple default script which echoes some event information to the console below the editor window.
- In the Script menu select Import..., navigate to the
tools
folder inside where you unpacked the plugin zip archive, and select thelgkeys-integration.lua
file. (Or just open it with a plain-text editor and copy/paste the code.)-
Note: importing will replace any existing script (LGS will warn you). If you have a script you want to
keep, then you will need to manually "integrate" the code from
lgkeys-integration.lua
into your existing script. The code is very basic, so it shouldn't be a problem.
-
Note: importing will replace any existing script (LGS will warn you). If you have a script you want to
keep, then you will need to manually "integrate" the code from
- In the imported script, find the line with
arg = "PROFILE_NAME"
and replace thePROFILE_NAME
part with the profile's actual, full name.- Or, even better, its "GUID," which is that profile's file name in the LGS profiles
folder (including the curly braces, but without the ".xml" extension).
You can use the included
list_devices
utility (mentioned above) to see a list of all your profiles by name, which also shows the corresponding file name and GUID. Using the GUID is preferable to the profile name, because you may change the name later, but the ID will always remain the same while that profile exists.
- Or, even better, its "GUID," which is that profile's file name in the LGS profiles
folder (including the curly braces, but without the ".xml" extension).
You can use the included
- CTRL+S to save the script, and you're done (with that profile).
This method is ultimately faster if you need to modify several profiles at once, you just need to be a little careful when editing the files. This is also essentially what my utility script (Option 1) does for you. You'll need to use Notepad or your favorite plain-text editor to edit the profile XML files.
- If LGKeys Plugin is already running, you should stop it. This can be done from the TP Settings -> Plug-ins screen.
- Shut down/close the Logitech Gaming Software completely (right-click the taskbar icon and select Exit).
- Using Explorer browse to the LGS profiles folder, which is usually in
C:\Users\<User_Name>\AppData\Local\Logitech\Logitech Gaming Software\profiles
- You may want to copy the profiles to a backup folder if you don't already have one (in which case also strongly consider backing up those profiles regularly).
- Finding the right profile can be tricky... perhaps sort by modification date and then open each file
in the text editor until you find the right one(s). The profile's name is shown on the 3rd line of each file,
as an attribute of the
profile
XML element. You can also use the previously-mentionedlist_devices
utility to see a list of all your profiles bt name and the corresponding file name. - Scroll down to the end of the file to the
<script>...</script>
tags. Any existing script will be contained between those tags. - Replace the existing script with the contents of
lgkeys-integration.lua
as mentioned above (or edit any existing script as appropriate so that theDbgHandler
function fires correctly). - Also as in Option 2, find the script line with
arg = "PROFILE_NAME"
and replace thePROFILE_NAME
part with the profile's GUID. The GUID is the file's name (including the curly braces, but without the ".xml" extension) and can also be found at the top of the profile file, in theprofile
XML tag, as theguid
attribute. Using the GUID is preferable to the profile name, because you may change the name later, but the ID will always remain the same while that profile exists. - Save the file. Modify any others you want, then restart the LGS software and LGKeys plugin.