Select scenes in OBS using Messages or Acc

Get help with using AutoHotkey and its commands and hotkeys
Revvilo
Posts: 6
Joined: 17 Nov 2015, 00:30

Select scenes in OBS using Messages or Acc

18 Jan 2019, 01:19

Firstly, I should mention I would prefer to not use the built-in OBS hotkey system for this. Technically I could, but I want to avoid having a 'middle man' hotkey between my second keyboard and OBS that adds the possibility for accidental presses.
I originally had this set up to whereupon executing one of the macros for a scene, the first character of the scene's name would be sent to the 'Scenes' box. This worked perfectly, but as anyone who has used the keyboard to select list items would know, you need to wait a small amount of time to start a new 'search,' as it were, meaning that I could not press different scene-hotkeys in quick succession, which is why I'm trying to improve it.

I've done my absolute best with the Acc library, and Send/PostMessage, but both methods reach a point where they are 'succeeding' but OBS doesn't change the scene properly, or at all.
While not happening with Acc since it effectively sits outside of HWNDs or ClassNNs, SendMessage is bound by the fact that the 'list' control containing the scenes shares its ClassNN and HWND with its two layers of parent controls (or so AccViewer had showed me). Meaning that I can't target it with the normal means, as far as I can tell from hours of Googling and SendMessage's ErrorLevel being 0 even when nothing happened.
The problem with Acc is even though I can actually get to the point of selecting the list item with DoDefaultAction, it doesn't actually switch to the scene and instead just leaves the target list item highlighted with no change to the preview. And no, I haven't been able to get accSelect to work at all. :facepalm:

Here's my code for Acc, where the first DoDefaultAction is the one that I see often on the forums, but yet doesn't have any effect in my case.

Code: Select all

oAcc := Acc_Get("Object", "4.4.1.1.1", 0, "ahk_exe obs64.exe") ; This gets the list containing all the scenes
Loop % oAcc.accChildCount
{
    If (InStr(oAcc.accName(A_Index), requestedScene))
    {
        oAcc.accDoDefaultAction(A_Index) ; Does not work
        oAcc.accChild(A_Index).accDoDefaultAction() ; Only highlights without selecting properly
        Break
    }
}
And here's the code for SendMessage that thinks its working, but I assume doesn't because it would be targeting the 'box' that is two child layers above the actual scene list. 'course it returns an ErrorLevel of 0.

Code: Select all

SendMessage, LB_SELECTSTRING := 0x018C, 0, "Game",, ahk_id 0x740440 ; hwnd of scene list - "Game" is part a scene's name
I think I've reached the limit of my capabilities with this, which is why I've come here to ask for help. I tried to provide as much info as I could, but if you need anything more, feel free to ask. Appreciate any input on this :D

Return to “Ask For Help”

Who is online

Users browsing this forum: Archezuli, Bing [Bot], Google [Bot], Jara and 183 guests