Jump to content

Clicking OK or Sending Enter, Program with Funky Controls


Recommended Posts

I'm trying to automate a chunk of what I do as a hobby with OBS Multiplatform, a livestreaming app. The original OBS program worked with a script in AutoHotkey, but doesn't in the newer rewrite of the app. Basically while the app is not in focus I need to double click an item in a list, just click 'OK' or hit enter or space, then send the same hotkey to OBS that goes through AutoIt. I got the double click to work just fine which was the problem with AHK, but I'm struggling to click 'OK'. 

I think the real issue is that this new multiplatform version of OBS has really funky naming for its classes & controls. They seem generic - for example the main window has the class "Qt5QWindowIcon". Anyway this is my first night looking into AutoIt but from what I've cobbled together after looking through the docs and picking up scraps, I have worked up the code below. (I know I commented the ControlSend & ControlClick, that's just to point out the two options I've tried.)

Local $inTargetProg = False

Func _num2()
   ControlClick("OBS 0.11.4 (windows)","","[CLASS:Qt5QWindowIcon; INSTANCE:4]","",2,224,35)
   WinWait("[TITLE:Properties for 'CC_Transition'")
   ;ControlSend("Properties for 'CC_Transition'","","[CLASS:Qt5QWindowIcon; INSTANCE:2]","","{enter}")
   ;ControlClick("Properties for 'CC_Transition'","","[CLASS:Qt5QWindowIcon; INSTANCE:2]","",1,28,10)
EndFunc

While 1
   If WinExists("OBS 0.11.4 (windows)") and Not $inTargetProg Then
      HotKeySet("^{NUMPAD2}","_num2")
      $inWC3 = True
   EndIf

   If Not WinExists("OBS 0.11.4 (windows)") and $inTargetProg Then
      HotKeySet("^{NUMPAD2}")
      $inWC3 = False
   EndIf

    Sleep(5)
WEnd

Below is the Window Info while I hovered exactly in the center of the button I need to click. I though just sending {enter} with the ControlSend option above would do it easily but it didn't.

>>>> Window <<<<
Title:  Properties for 'CC_Transition'
Class:  Qt5QWindowIcon
Position:   29, 272
Size:   989, 700
Style:  0x96CC0000
ExStyle:    0x00000500
Handle: 0x004E0074

>>>> Control <<<<
Class:  Qt5QWindowIcon
Instance:   2
ClassnameNN:    Qt5QWindowIcon2
Name:   
Advanced (Class):   [CLASS:Qt5QWindowIcon; INSTANCE:2]
ID: 
Text:   buttonBoxWindow
Position:   830, 629
Size:   132, 21
ControlClick Coords:    30, 12
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x002C04CC

>>>> Mouse <<<<
Position:   860, 641
Cursor ID:  0
Color:  0x8E6A65

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
OBSPropertiesViewClassWindow
buttonBoxWindow
OBSQTDisplayClassWindow


>>>> Hidden Text <<<<

Any suggestions? If I missed anything I'd be glad to provide it if I can.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...