mr-es335 Posted June 27 Posted June 27 (edited) Good day, I have a script that requires a "view" that has no employable "control" data. - other than the title of the view and a "listbox". Following is an example of that "view" Observations 1. As can be observed, the LED at [A] is "disabled", whilst the LED at is "enabled. 2. The listbox contains a "list of songs" which each song, for the most part, consisting of a time period of 3 minutes each - though for the particular "test", I have truncated the songs down to 20 seconds each. 3. My main issue was how to exit the script when the song list had completed. • Initially I inserted a Sleep command which consisted of some 105000 ms..and though this "worked" I really wanted something a bit more, shall-I-say, certain! 4. I knew that AutoIt! had the ability to ascertain "pixel colour"..and thus, with the assistance of "Aye-EEE", and some effort on my part, I did manage to come up with the following tid-bit: Spoiler expandcollapse popup; ----------------------------------------------- ; 6/26/2026 4:28:29 PM ; ----------------------------------------------- #include <AutoItConstants.au3> #include "ExtMsgBox.au3" ; ----------------------------------------------- Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) ; ----------------------------------------------- Global $iEMBWidth = 1000 Global $iMsgDelay = 2 ; --------------------- Global $iTimeOut = 100 Global $iExtTimeOut = 2000 Global $iPauseTime = 5000 ;~ Global $iPauseTime = 105000 ; --------------------- Global $hSAWSTUDIO_MAIN = "[CLASS:SAWSTUDIO_MAIN]" Global $hSAWSTUDIO_SHOWCTRL = "[CLASS:SAWSTUDIO_SHOWCTRL]" ; ----------------------------------------------- ToggleSAC() IntroNotice() InvokeFirstItem() MyFunc() OutroNotice() ToggleSAW() ; ----------------------------------------------- Func ToggleSAC() ; SAW > SAC WinActivate($hSAWSTUDIO_MAIN) WinActivate($hSAWSTUDIO_SHOWCTRL) Sleep($iTimeOut) MouseClick($MOUSE_CLICK_RIGHT, 27, 42, 1, 0) ; --------------------- Sleep($iExtTimeOut) EndFunc ;==>ToggleSAC ; ----------------------------------------------- Func IntroNotice() Local $sMsg = "The SessionTest.shw commences..." ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", $iEMBWidth) _ExtMsgBox(64, " ", " Notice!", $sMsg, $iMsgDelay, 995, 140) EndFunc ;==>IntroNotice ; ----------------------------------------------- Func InvokeFirstItem() ; Select first item WinActivate($hSAWSTUDIO_MAIN) WinActivate($hSAWSTUDIO_SHOWCTRL) Sleep($iTimeOut) MouseClick($MOUSE_CLICK_RIGHT, 90, 69, 1, 0) EndFunc ;==>InvokeFirstItem ; ----------------------------------------------- Func MyFunc() Local $x = 786, $y = 114 Local $targetColor = 0x2F3A46 ; --------------------- While True Local $currentColor = PixelGetColor($x, $y) ; --------------------- If $currentColor = $targetColor Then ExitLoop EndIf Sleep($iTimeOut) WEnd EndFunc ;==>MyFunc ; ----------------------------------------------- Func OutroNotice() Local $sMsg = "The SessionTest.shw concludes..." ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", $iEMBWidth) _ExtMsgBox(64, " ", " Notice!", $sMsg, $iMsgDelay, 995, 140) EndFunc ;==>OutroNotice ; ----------------------------------------------- Func ToggleSAW() ; SAC > SAW WinActivate($hSAWSTUDIO_MAIN) WinActivate($hSAWSTUDIO_SHOWCTRL) Sleep($iTimeOut) MouseClick($MOUSE_CLICK_RIGHT, 27, 42, 1, 0) ; --------------------- Sleep($iExtTimeOut) EndFunc ;==>ToggleSAW ; ----------------------------------------------- 5. All of my testing thus far, has come up, "positive" - employing songs of varying duration. In conclusion... It would be greatly appreciated - as always, if someone would "glance over" my offering...to simply obtain a 2nd...or even 3rd opinion. Any assistance in this matter would be greatly appreciated! Edited June 27 by mr-es335 mr-es335 Sentinel Music Studios
Nine Posted June 27 Posted June 27 Take a look at Opt("PixelCoordMode", 0) mr-es335 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mr-es335 Posted June 27 Author Posted June 27 NIne, Totally missed that one! As I would "assume" you have observed, I DO employ "Opt("MouseCoordMode", 0)"...so why NOT employ Opt("PixelCoordMode", 0)!! • ASt times like this I DO feel like "Willoughby..." I really do appreciate you and your efforts Nine! Thanks! mr-es335 Sentinel Music Studios
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