khaosnmt Posted October 6, 2014 Share Posted October 6, 2014 I work for my college campus' radio station I have one program that allows our DJs to go live which relies on the state of the software that controls the AutoDJ, so I want to check when the AutoDJ client shows "You have 15 seconds to connect before I take back over..." on Static4, but I haven't had much luck getting it to work. I have all of the AutoDJ client stuff automated, but I can't get the part that reads the Client window working correctly. (Granted, that part has been piecemealed from other code that I found through Google... ) When Static4 says that, I need to send Mixxx Ctrl+L ("Enable Live Broadcasting"). I have included a screenshot, my AutoIT code and the Window info below. Window code: expandcollapse popup>>>> Window <<<< Title: RadioBot Client 3.0/Win32 Class: #32770 Position: 302, 245 Size: 714, 343 Style: 0x96CA0084 ExStyle: 0x00010101 Handle: 0x003502B0 >>>> Control <<<< Class: Static Instance: 4 ClassnameNN: Static4 Name: Advanced (Class): [CLASS:Static; INSTANCE:4] ID: Text: You have 15 seconds to connect before I take back over... Position: 178, 35 Size: 180, 40 ControlClick Coords: 125, 18 Style: 0x52000100 ExStyle: 0x00000000 Handle: 0x002803FE >>>> Mouse <<<< Position: 608, 323 Cursor ID: 0 Color: 0xF0F0F0 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Connections Connected SERVER STATUS You have 15 seconds to connect before I take back over... STREAM STATUS The Neighbourhood - Staying Up Listeners: 2/200, Peak: 18 DJ Login DJ Logout Show Req Ded. Show Ded. To. Clear Req. List ADJ Next Broadcast Msg Do Spam Die Restart Request Song Count Me In ADJ Force Off ADJ Play ADJ Reload Options... About... >>>> Hidden Text <<<< AutoIT code: #include <MsgBoxConstants.au3> run("C:\Program Files (x86)\RadioBot\Client3.exe") sleep(1000) ControlClick("RadioBot Client 3.0/Win32", "", "Button2") sleep(1000) ControlClick("RadioBot Client 3.0/Win32", "", "Button14") MsgBox($MB_SYSTEMMODAL, "Please wait...", "The control window will appear to freeze. Please wait for this box to close before continuing.", 30) sleep(1000) run("C:\Program Files (x86)\Mixxx\mixxx.exe") MsgBox($MB_SYSTEMMODAL, "Mixx Instructions", "When the Radiobot Client window shows ""You have 15 seconds to connect before I take over..."", click Options->Enable Live Broadcasting", 30) Global $Waiting = True ; your GUI loop While (1) If $Waiting And WinExists("RadioBot Client 3.0/Win32") Then $sText = ControlGetText(WinGetTitle("[CLASS:#32770]"), "You have 15 seconds to connect before I take back over...", "[CLASS:Static; INSTANCE:4]") If $sText Then ; we got the text, so we know we can go live ; now do whatever you need to do $Waiting = False EndIf EndIf WEnd WinActivate ("Mixxx 1.11.0") Send("^{L}") Screenshot (linked because the forum yelled at me for including the preview): https://www.dropbox.com/s/wsv69d3ztwm03o0/Screenshot%202014-10-05%2018.20.30.png?dl=0 Link to comment Share on other sites More sharing options...
JohnOne Posted October 6, 2014 Share Posted October 6, 2014 What exactly can you not get to work? ControlGetText? If so try... If StringInStr(WinGetText("[CLASS:#32770]"), "You have 15 seconds") Then ;whatever EndIf AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
khaosnmt Posted October 6, 2014 Author Share Posted October 6, 2014 (edited) What exactly can you not get to work? ControlGetText? If so try... If StringInStr(WinGetText("[CLASS:#32770]"), "You have 15 seconds") Then ;whatever EndIf That is working, but now it is infinitely sending the CTRL+L keyboard shortcut. I'm assuming it's because I have it in that loop. How can I make the loop stop after that "You have 15 seconds..." actually appears? (Also that post from GCarslaw is spam. I can't seem to find a "report" button anywhere.) Edited October 6, 2014 by khaosnmt Link to comment Share on other sites More sharing options...
alienclone Posted October 6, 2014 Share Posted October 6, 2014 first off, i like the song playing in your screen shot. does Static4 only show when it has 15 seconds? or does it count down? $sText = ControlCommand("RadioBot Client 3.0/Win32", "", "[CLASS:Static; INSTANCE:4]", "IsVisible", "") if $sText = "1" Then ;visible If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
khaosnmt Posted October 6, 2014 Author Share Posted October 6, 2014 first off, i like the song playing in your screen shot. does Static4 only show when it has 15 seconds? or does it count down? $sText = ControlCommand("RadioBot Client 3.0/Win32", "", "[CLASS:Static; INSTANCE:4]", "IsVisible", "") if $sText = "1" Then ;visible It counts down. It counts down every 30 seconds until it hits 30 seconds remaining, and then counts down every 5 seconds until it hits that "You have 15..." message. Link to comment Share on other sites More sharing options...
khaosnmt Posted October 6, 2014 Author Share Posted October 6, 2014 I got it! Thanks guys! #include <MsgBoxConstants.au3> run("C:\Program Files (x86)\RadioBot\Client3.exe") sleep(1000) ControlClick("RadioBot Client 3.0/Win32", "", "Button2") sleep(1000) ControlClick("RadioBot Client 3.0/Win32", "", "Button14") MsgBox($MB_SYSTEMMODAL, "Please wait...", "The control window will appear to freeze. Please wait for this box to close before continuing.", 30) sleep(1000) run("C:\Program Files (x86)\Mixxx\mixxx.exe") ;MsgBox($MB_SYSTEMMODAL, "Mixx Instructions", "When the Radiobot Client window shows ""You have 15 seconds to connect before I take over..."", click Options->Enable Live Broadcasting", 30) Global $Waiting = True ; your GUI loop While ($Waiting = "True") If $Waiting And WinExists("RadioBot Client 3.0/Win32") Then If StringInStr(WinGetText("[CLASS:#32770]"), "You have 15 seconds") Then ; we got the text, so we know we can go live ; now do whatever you need to do WinActivate ("Mixxx 1.11.0") sleep(1000) Send("{CTRLDOWN}l{CTRLUP}") $Waiting = False EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now