Jump to content

Recommended Posts

Posted (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"

Both.png

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
; -----------------------------------------------
; 6/27/2026 6:23:08 AM
; -----------------------------------------------
#include <MsgBoxConstants.au3>
#include "ExtMsgBox.au3"
; -----------------------------------------------
Opt("MustDeclareVars", 1)
Opt("MouseCoordMode", 0)
; -----------------------------------------------
Global $iEMBWidth = 1000
Global $iMsgDelay = 2
; ---------------------
Global $iTimeOut = 100
; ---------------------
Global $hSAWSTUDIO_MAIN = "[CLASS:SAWSTUDIO_MAIN]"
Global $hSAWSTUDIO_SHOWCTRL = "[CLASS:SAWSTUDIO_SHOWCTRL]"
; -----------------------------------------------
IntroNotice()
InvokeFirstItem()
MyFunc()
OutroNotice()
; -----------------------------------------------
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()
    ; Set the coordinates of the pixel to check
    Local $x = 786
    Local $y = 114
    ; Set the color you want to detect
    Local $targetColor = 0x2F3A46
    ; Infinite loop to continuously check the pixel color
    While True
        ; Get the color of the pixel at the specified coordinates
        Local $currentColor = PixelGetColor($x, $y)
        ; Check if the current color matches the target color
        If $currentColor = $targetColor Then
            ; Close the window with the specified title, for testing only!
;~          WinClose("Show Control")
            ExitLoop ; Exit the loop after closing the window
        EndIf
        Sleep(100) ; Wait for a short period before checking again
    WEnd
        ; ConsoleWrite("The view is now exited..."}
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
; -----------------------------------------------

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 by mr-es335

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
×
×
  • Create New...