Lua ← Ahk "SendMessage" ?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Posts: 90
Joined: 03 Aug 2016, 19:03

Lua ← Ahk "SendMessage" ?

12 Nov 2017, 20:10

Hi again! Ima Win7Ult64bit user.

Im trying to work with Lua, specifically inside the scripting of my Logitech G-Series Profiler software but that's Lua true enough.

I have a function that I've written in AHK, and it works fine.
But considering it uses ControlGetFocus and SendMessage I'm rather lost on how to convert this script into a Lua script.

Anyone else here familiar with Lua?

Right now, I've got the "G-Series profiler" converting
mouseButton4(aka rightTiltWheel) to Lua_f22, and
mouseButton5(aka leftTiltWheel) to Lua_f23.
then this AHK script below intercepts the f22 or f23 keypress and converts it into RightScroll and LeftScroll accordingly, using sendmessage
but that's pretty round-about don't you think??

"G-Series profiler" lacks any simple constant for Left and Right scrolling. It also doesn't auto repeat messages such as "VScrolling". So it seemed to get any 'repeating' options it was best to repeat a f22/f23 key. but reeeealy its just a mess to convert it 3 times... Isn't there a way to just do SendMessage, 0x114, ~~~ in Lua?

Don't punch me in the noobLua for askin! *^p^*

Code: Select all

#KeyHistory 0
#MaxMem 1

hscrl(r=0) {
ControlGetFocus, fcontrol, A
SendMessage, 0x114, %r%, 0, %fcontrol%, A  ;  0x114 is WM_HSCROLL and the 1 after it is SB_LINERIGHT. or the 0 after it is SB_LINELEFT.


Posts: 299
Joined: 26 Apr 2014, 07:57

Re: Lua ← Ahk "SendMessage" ?

12 Nov 2017, 23:58

To be honest with you, you're probably better off doing it the way you're doing it.

SendMessage isn't something included in the full base lua, and LGS uses a cut down version of that base lua, with some other custom functions added (i.e. LG hardware handling, like mouse/keyboard/led type "stuff"). You could search for code which implements the functionality you're after and then use "require" in you're lua script (lua's require is like ahk's #include), which would work assuming you can find the correct code, but IMO you're better off just having ahk see the mouse event and have it do the stuff.

I'm a little intrigued with this "G-Series Profiler" software you're using, I'm thinking it is in fact different to LGS (Logitech Gaming Software) as LGS does have a simple way for changing wheel tilts (left/right) via the GUI and is only missing wheel scrolling (up/down) in the Gui.

Anyway, one possibility to cut down some of the conversion (which you may have already tried), is set the wheel tilts to their generic functions (i.e. remove the code for them) and have ahk grab WheelLeft or WheelRight hotkeys instead. Or perhaps, your particular mouse model actually maps forward & back buttons to your wheel tilt ? Just a guess, as you seem to be using mousebutton 4 & 5 which for me is used for forward & back buttons, so it may be necessary to use XButton1 & XButton2 in ahk instead of WheelLeft or WheelRight, i.e. I'm just thinking perhaps you weren't trying to read the correct buttons in ahk before you changed them to F22 & F23.
User avatar
Posts: 90
Joined: 03 Aug 2016, 19:03

Re: Lua ← Ahk "SendMessage" ?

13 Nov 2017, 02:07

Oh excuse me i was mistaken, im not using the G-Series profiler after all,
thats just the name of what i used to use back on windows-XP that i did a lot of f13 through f24 coding for back then.
That one did incorporate autohotkey had had lots of useful options when you applied the patch that was built by a autohotkey community member that directly patched the profiler. I got so used to saying it, that i get them mixed up.

You were correct to assume i was using "Logitech Gameing Software" my version is v8.56.109
g-series profiler could not handle horizontal scroll at all, and sofar as i can tell, neither can "Logitech Gameing Software".

furthermore there is some confusion i've been having with the driver or the version, i've tried patches and fixes but v8.56.109 does not seem to handle middle click correctly at all. useing the Lua internal script, i can have it display to my g15 LCD screen that it has tried to use the "Middle click" key, and it assujes it has used that key (mouse wheel click). but outside the LOgitech software, nothing receives the middle click.

to further test this i ran an external java program that reported the mouse button pushes. and that program detects
leftclick as mouse1
rightclick as mouse2
middleclick as mouse4
rightTilt as mouse4
leftTilt as mouse5
pinkyClick as mouse6

notice the redundant click mouse4
yet the -effect- from pressing middle click, is the right-click sub-menu, with typical things like 'open with' and 'properties'.
So its detected by java as key 4 tilt... yet detected by the rest of the os as right-click. it doesn't show up as mouse3, anywhere but inside the Lua feedback to my G15 lcd screen, or output logs generated by Lua.

This is why i turned to the f24 for middle click, 23 and 22 for horizontal scroll. As thoes keys take it out beyond the v8.56.109 and lua, without device numeration issues. (and because AHK does have H-scroll for us win7 ppl.)

Whether i set tilt, or middle click to thier defaults, tilt, or middle click, makes no difference externally. and v8.56.109 (non Lua-scripting mode), lacks any option for setting XButton1 & XButton2 or Mouse4 & Mouse5, thoes are exclusive to the Lua scripting options and called vie functions in events and such. Yes the old good G-series-Profiler for XP could do the " XButton1 & XButton2 " stuff, but only with the patch made by this community.

Which is sort of why i'm back here again. AHK helps with HID, so much!

I have no idea why middle click doesn't work properly in Logitech Gaming Software v8.56.109 . maybe its a win7 ult 64bit issue, or a particular KB-msUpdate file or something. But once in a while very rarely, i sometimes get the -normal- function of middle click back. but in that i dont use it often. its hard to tell what caused middle-click to work one day and stop some other. its all extremely mysterious and i dont know where to start looking for answers. so i just figured i'd patch around the aggravation for now.
Posts: 299
Joined: 26 Apr 2014, 07:57

Re: Lua ← Ahk "SendMessage" ?

14 Nov 2017, 00:24

I'm inclined to think there is an issue with your installation of the driver and/or the lgs software.

Clearly (as I'm sure you're aware) that sort of stuff shouldn't be happening, personally I'd try a reinstall with the latest version (LGS software is up to 8.96.88), and if that doesn't work I'd try fully removing it first and then re-installing (i.e. Clean install it & the driver).

Having said that what sort of mouse do you have ?, perhaps it's not supported with the newer software ? I know the G15 keyboard is (I checked) but if the mouse isn't and it's a Logitech mouse, upgrading the driver & software might be an issue. Anyway assuming your mouse model is supported by the software version you're currently running, I'm thinking the installation must be borked (the issues you describe like the middle mouse button is just crazy, and so there must be something fundamentally wrong).

All I really know for certain is that version of LGS did definitely allow mapping of wheel tilt for my mouse (G9) and hence my assumption is it should also do it for yours too, but that MMB stuff just screams to me that something isn't wright with the install, or the mouse model itself isn't supported by the software.

Another thought that crossed my mind is perhaps you're running the 32bit version of the software instead of the 64bit version ? they have separate downloads for each version. And another thing to check is what the mouse does without the LGS software running, if it's not working I'd be thinking along the lines of driver, or hardware issue.
User avatar
Posts: 90
Joined: 03 Aug 2016, 19:03

Re: Lua ← Ahk "SendMessage" ?

15 Nov 2017, 09:10

My mouse is the G600
I've a white one and a black one.
The white one I've cord-modded (longer smooth cord, no mesh). the white modded one is not the one im using right now however. (that's the one i use for travel) been using these for years, even gone through 2 of the black ones. but in spite of updates the same problem persists.

I've tried running the software as admin mode, and normally.
once in a blue moon middle mouse button just works. but no i've never seen in any of the provided options anything for asigning a key to any of the following:
X Mouse button 1
X Mouse button 2
X Mouse button 4
X Mouse button 5
Mouse button 4
Mouse button 5

heres my version and its install location:
C:\Program Files\Logitech Gaming Software\LCore.exe
Tue Sep 16 16:39:21 2014 Image: 64-bit

Think you could host a pic of your Lgs GUI displaying the X MOUSE # option?
Just to be -literally- sure were all on the same page here?

Im leery about upgrading my Lgs -again- because i usually have to remake all my profiles (all 200 of them) every time i do, due to compatibility changes.
Posts: 299
Joined: 26 Apr 2014, 07:57

Re: Lua ← Ahk "SendMessage" ?

16 Nov 2017, 01:48

I wasn't able to attach a pic, not sure why kept getting a little orange exclamation mark with no error but it wouldn't actually attach. I'm not really familiar with or "into" posting pics, so I'm not set up on any image sharing sites that could host it and don't really intend to sign up to one.

Anyway, you should be able to remap these button in LGS, this link may help ... 0069vEiAAI, it does at least show that they should be able to be remapped. Perhaps you're not selecting the correct page in LGS, i.e. the icons down the bottom of the window allow different things to be set, one of which should be customize buttons (next to the house Icon in the linked page). Mentioning this as the pictures in the link and the links instructions seem to neglect to mention this, and show the Home button highlighted (when it can be seen) regardless of what should actually be selected.

Also you should upgrade to the latest version, G600 is supported and with regard to the profiles, I can't say I've ever lost them due to an upgrade, but you can export/import them, but since it only lets you do it one at a time through LGS from what I remember, this could quickly become tedious.

Easier way is make a copy of the "%LocalAppData%\Logitech\Logitech Gaming Software\profiles" folder. It should have a bunch of xml files in it, one for each profile, the filenames are cryptic but it doesn't matter, you don't need to know which one is for what, when you're going to restore them all, if they do go missing. To restore them if they get deleted just copy the backup back to the same spot. Or you can import them one at a time through LGS, the actual profile names are stored within the XML so you'll get the proper name displayed in LGS.

Return to “Ask For Help”

Who is online

Users browsing this forum: Aaron0824, magnus, RubbeH and 42 guests