Sign in to follow this  
Followers 0
seanrintel

Using Wingetstate, Else, And Case Statements

15 posts in this topic

G'day,

I sent in a question previously and received a great answer. Now I realize that the problem is a bit more complex than I thought. I'll lay out the issue and then my new problem. I am still not a programmer. :think:

1. The issue

I am researching how people learn to use videoconferencing. I want to record videoconferences between two subjects people on a multi-point bridge. The videoconferencing client, Session 3, will play sound automatically but you have to click a little play button to bring up the video every time. I want to automate the clicking of the two play buttons each time subjects log on to the bridge. Session, BTW, is a java program, so all AutoIt can see in the windows are the titles and the classnames, no text or anything else.

2. The script

Here's what I need the script to do

1. Infinitely

2. Check if a remote video window exists.

3. If it does not, try to click the first play button in the Main window to bring up a video window, infinitely, until one exists.

4. Check the success of the attempt.

5a. If the attempt was not successful, start from 2 again.

5b. If the attempt was successful, try to bring up the second video window, infinitely, until one exists. Then wait until both remote video windows are closed and start from 2 again.

So far I have come up with the following script (non-functional) that mixes real code together with plain English expressions (written between <<< >>>) that stand in for my lack of knowledge. Note, in this code, "video window" is used to refer to classname "com.teraglobal.teramedia.media.RemoteMediaWindow" and "main window" is used to refer to classname "com.teraglobal.teramedia.lite.MainWindow"

While 1

<<< Need statement: WinGetState("classname=com.teraglobal.teramedia.media.RemoteMediaWindow") or WinExists("classname=com.teraglobal.teramedia.media.RemoteMediaWindow") that checks whether 0, 1, or 2 video windows exist>>>

; For 0 video windows
<<<Need statement: If 0 video window statement>>>
WinActivate("classname=com.teraglobal.teramedia.lite.MainWindow")
WinWaitActive("classname=com.teraglobal.teramedia.lite.MainWindow")
MouseMove(14, 182)
MouseClick("left")

; For 1 video window
<<<Need statement: If 1 video window statement>>>
WinActivate("classname=com.teraglobal.teramedia.lite.MainWindow")
WinWaitActive("classname=com.teraglobal.teramedia.lite.MainWindow")
MouseMove(14, 197)
MouseClick("left")

; For 2 video windows
<<<Need statement: If 2 video windows>>>
<<<Need statement: Wait for BOTH video windows to close: some version of WinWaitClose("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")>>>

WEnd

So I think I need to be using WinGetState and Else statements, or perhaps Case statements, but I'm just not sure. I'm also not sure how to get them to determine if there are 0, 1 or 2 windows open.

Any help would be vastly appreciated.

Until anon,

Sean

Share this post


Link to post
Share on other sites



I get too confused w/ your syntax and fluid naming conventions regarding your windows to write meaningful pseudo code for you...

If I'm correctly interpreting what you're saying one way would be nested while loops ; or possibly a while loop with a switch or select statement nested.

i.e.

while winexists(windowA)

_TryToStartWindowA()

while not winexists(windowB) ALTERNATIVE: While WinExists(WinA) AND Not WinExists(WinB)

_TryToStartWindowB()

wend

;now we presumably have a WindowA and WindowB

_DoWhatEverElseWeNeedToDoNow()

wend

Note that winexists() only determines whether A window title matches, not how many. To get how many, one solution would be to rename them as they are created, and detecting them as they are destroyed; incrementing and decrementing a counter as they come and go.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

I'm also not sure how to get them to determine if there are 0, 1 or 2 windows open.

Try WinList in the help file

Try like this

$winnumber = WinList("*Your Window Title*")

Select
         Case $winnumber[0][0] = 0
;Script for 0 windows


         Case $winnumber[0][0] = 1
;Script for 1 window


         Case $winnumber[0][0] = 2 
;Script for 2 windows
EndSelect

As for the button pushing, Does the button have a unique Color? maybe bright red? If so Look for Pixelsearch in the help file andWrite a PixelSearch for your screen for the button color, then do a mouseclick to push the button.

Also, Script shortening sugestion:

Replace:

MouseMove(14, 182)
MouseClick("left")

With:

MouseClick("left", 14, 182, 0)

And to constanly check for a window,

While 1
WinExists("*Window Title*")
Wend

:think:

Good luck!

Share this post


Link to post
Share on other sites

G'day Paulie,

I tried the following version of WinList to test how many windows could be counted but it didn't work:

Opt("WinTitleMatchMode", 4)

While 1

$winnumber = WinList("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")

Select
         Case $winnumber[0][0] = 0
;Script for 0 windows
            MsgBox(0, "", "0 windows found")

         Case $winnumber[0][0] = 1
;Script for 1 window
            MsgBox(0, "", "1 window found")

         Case $winnumber[0][0] = 2
;Script for 2 windows
            MsgBox(0, "", "2 windows found")

        Case Else
;Script for no cases true
            MsgBox(0, "", "No cases true")

EndSelect

WEnd

What's weird is that I know that WinList *can* work at a basic level, because after the failure above I modified the test example from the WinList help file and that worked:

Opt("WinTitleMatchMode", 4) 

$var = WinList("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")

For $i = 1 to $var[0][0]
 ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

Operating in classname mode it returned the titles and handles of any open "com.teraglobal.teramedia.media.RemoteMediaWindow" windows just fine.

Any ideas on how to fix it?

Look for Pixelsearch in the help file andWrite a PixelSearch for your screen for the button color, then do a mouseclick to push the button.

That works very nicely.

Thanks for the help.

Until anon,

Sean

Share this post


Link to post
Share on other sites

I get too confused w/ your syntax and fluid naming conventions regarding your windows to write meaningful pseudo code for you...

Sorry, I'm trying to get a handle on how to even ask my questions. Part of the issue is a lack of programming experience. Do you have any advice on some basic tutorials and/or references?

If I'm correctly interpreting what you're saying one way would be nested while loops ; or possibly a while loop with a switch or select statement nested.

i.e.

while winexists(windowA)

_TryToStartWindowA()

while not winexists(windowB) ALTERNATIVE: While WinExists(WinA) AND Not WinExists(WinB)

_TryToStartWindowB()

wend

;now we presumably have a WindowA and WindowB

_DoWhatEverElseWeNeedToDoNow()

wend

I'm trying both your solution and Paulie's below.

Thanks for the help.

Until anon,

Sean

Share this post


Link to post
Share on other sites

G'day all,

I think this is a more specific version of the problem I found trying to use Paulie's example above.

The WinList example demonstrates WinList showing the titles and handles of all open windows in individual message boxes, and I can get it to do that for windows of a particular class. Great. But how can I get it to show the *number* of visible windows (of a particular class) in a way that could be used later in the script?

The WinList help shows that the first line in the WinList array is $array[0][0] = Number of windows returned. And this is used in this line of the example:

For $i = 1 to $var[0][0]

I understand this to mean "For any number of windows from 1 through the total number of windows..."

So it *can* be used, but for some reason AutoIt doesn't seem to be able to use it in a Case statement. This doesn't work:

$var = WinList("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")

Select
         Case $var[0][0] = 0
;Script for 0 windows
            MsgBox(0, "", "0 windows found")

etc.

Any ideas?

Until anon,

Sean

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Maybe try making a global variable

I don't know if this works, but why not try

if that doesn't work, perfahps you could use If/Then/Else to make it work

or try using it as an actual varibale

Msgbox(0, "How wany Windows?", $var[0][0] & "Windows Found")

Also, just an idea, maybe, one thing that might be messin up the script is the "while" 1 function you have,

i think we shoud be able to control that more so my sugestion for a script might be like this

opt(WinTitleMatchMode,4)

WinWaitActive("classname=com.teraglobal.teramedia.lite.MainWindow")
Global $control = 0

While $control = 0
Global $winnum = WinList("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")
If $winnum[0][0] = 0 then
$control = 1
Endif
If $winnum[0][0] = 1 then
$control = 2
Endif
If $winnum[0][0] = 2 then
$control = 3
Endif
Wend

If $control = 1
     If $winnum[0][0]=0 then
          PushFirstButton() 
          WinWait("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")
          Global $handle_1 = WinGetHandle("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")
          $control = 0
     EndIf
EndIf

If $control = 2
     If $winnum[0][0]=1 then
          PushSecondButton()
          Sleep(1000)
          Winsetstate($handle, "", @SW_HIDE)
          If Winactive("classname=com.teraglobal.teramedia.media.RemoteMediaWindow") then
          Global $handle_2 = WinGetHandle("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")
               Winsetstate($handle, "", @SW_SHOW)
              $control = 0
          EndIf
     EndIf
Endif

If $control = 3
     If $winnum[0][0]=2 then
         WinWaitClose($handle_1)
         WinWaitClose($handle_2)
     $ans = MsgBox(4, "Again?", "Do you want to play videos again?"
         If $ans = 7 then
           $control = 0
         Else
         Exit 0
         EndIf
     EndIf
EndIf

Func PushFirstButton()
Global $pixel = PixelSearch("*","*","*","*", "*1st Button Color*"
          If NOT @error then
               Mouseclick("left","$pixel[0]","$pixel[1]",0) 
          Endif
EndFunc

Func PushSecondButton()
Global $pixel = PixelSearch("*","*","*","*", "*2nd Button Color*"
          If NOT @error then
               Mouseclick("left","$pixel[0]","$pixel[1]",0) 
          Endif
EndFunc

Something like that

The hardest part is distinguishing between the two windows, thats were the error if one exists lies id bet.

also the Winlist part of the script might be a little Disfunctional but hey, its just a general idea

Makesure you fill in screen dementions and button colors

Note:May Need Modifing

Edited by Paulie

Share this post


Link to post
Share on other sites

G'day Paulie,

Setting $winnumber as global variable worked! I now have half a successful script. Just a few more issues to sort out.

The code below works to correctly report the number of and condition of windows. Interestingly, though, I found out that when Project (this computer) is not logged on to the bridge, there are 0 windows. When it is logged on to the bridge with 0 other people, there is 1 window found (ie. the local video exists but is hidden). When 1 person is logged in, there are 2 windows found (local + 1 remote exist, both hidden). Etc. So I'm going to have to account for that in the code. As you can see below, I have included a IN REAL SCRIPT TO COME descriptions of what I'll try to do.

global $winnumber = WinList("classname=com.teraglobal.teramedia.media.RemoteMediaWindow")

Select
         Case $winnumber[0][0] = 0
;Script for 0 windows. Project not logged in to the bridge. TESTING: Return messagebox with info. IN REAL SCRIPT TO COME: Use this result to trigger logging in to the bridge.
            Msgbox(0, "How many Session Video Windows Exist?", $winnumber[0][0] & " windows found. Project is not logged in to bridge.", 3)

         Case $winnumber[0][0] = 1
;Script for 1 window. Local video exists but is not visible (which is OK, it should stay hidden). No other users are logged in. TESTING: Return messagebox with info. IN REAL SCRIPT TO COME: Use this result to trigger nothing.
            Msgbox(0, "How many Session Video Windows Exist? 1", $winnumber[0][0] & " windows found. Project is logged in to the bridge alone. No video should be showing.", 3)

         Case $winnumber[0][0] = 2
;Script for 2 windows. Local video plus 1 remote video exists but 0 are visible. TESTING: Return messagebox with info. IN REAL SCRIPT TO COME: Use this result to trigger opening the first remote video.
            Msgbox(0, "How many Session Video Windows Exist? 2", $winnumber[0][0] & " windows found. Project is logged in to the bridge with 1 subject. 1 subject video windows should be showing.", 3)

        Case Else
;Script for 3 windows. Local video plus 2 remote videos exist but 0 are visible. TESTING: Return messagebox with info. IN REAL SCRIPT TO COME: Use this result to trigger opening the second remote video.
            Msgbox(0, "How many Session Video Windows Exist? 3", $winnumber[0][0] & " windows found. Project is logged in to the bridge with 2 subjects. 2 subject video windows should be showing.", 3)

Case Else
;Script for 4 windows. Local video plus 3 remote videos exist but 0 are visible. This case should never happen.
            Msgbox(0, "How many Session Video Windows Exist? Else", $winnumber[0][0] & " windows found. Project is logged in to the bridge with 3 subjects.", 3)

EndSelect

Now, there is only one problem with this script, and that is adding a While statement. I tried enclosing all of the Select...EndSelect in While 1...WEnd and the script works the first time but then when I change the number of open windows by logging remote subjects on and off the bridge, the script does not update and report the change correctly. It keeps reporting the orginal result. Could the code you suggested above help that?

Thanks for your ongoing help on this, you're saving me.

Until anon,

Sean

Share this post


Link to post
Share on other sites

make sure that you are resetting your variable each time through your while loop.

while 1 
  $condition = stuff that can change
  select
     case 
     case 
     case
  endselect
wend

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Must admit, a bit confused on what your doing, but if you want to return the hwnd of the class that is visible or just return all windows from the class itself, maybe this can help (started playing around with it and this is what I came up with):

$Win = _ReturnWinFromClass('MozillaUIWindowClass'); Notice no second parameter to return a single hwnd visible
MsgBox(0, 'Single WinClass', $Win & @CR & WinGetTitle($Win))

$WinArray = _ReturnWinFromClass('MozillaUIWindowClass', 1); Notice 1 as a parameter to return all hwnd(s) visible or not
If IsArray($WinArray) Then
    For $icount = 1 To UBound($WinArray) - 1
        MsgBox(0, 'Array of WinClasses', $WinArray[$icount] & @CR & WinGetTitle(HWnd($WinArray[$icount]))); Notice HWnd by Valik.. Will need beta
    Next
EndIf
    
Func _ReturnWinFromClass($s_Class, $a_ReturnAll = 0); 0 The one that is active; 1 returns all windows with that class
    $Opt1 = Opt('WinTitleMatchMode', 4)
    $Opt2 = Opt('WinSearchChildren', 1)
    Local $a_WinList = WinList('classname=' & $s_Class), $a_StoreWin = ''
    Opt('WinTitleMatchMode', $Opt1)
    Opt('WinSearchChildren', $Opt2)
    For $xCount = 1 To UBound($a_WinList) - 1
        If $a_ReturnAll = 0 Then
            If $a_WinList[$xCount][0] <> '' And BitAND($a_WinList[$xCount][1], 2) = 2 Then Return $a_WinList[$xCount][1]
        ElseIf $a_ReturnAll = 1 Then
            If $a_WinList[$xCount][0] <> '' Then
                $a_StoreWin &= $a_WinList[$xCount][1] & Chr(01)
            EndIf
        EndIf
    Next
    $a_StoreWin = StringSplit(StringTrimRight($a_StoreWin, 1), Chr(01))
    If IsArray($a_StoreWin) Then Return $a_StoreWin
    Return 0
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

G'day flyingboz,

make sure that you are resetting your variable each time through your while loop.

That's a good idea. I have done that and things are close to working correctly.

Thanks!

Until anon,

Sean

Share this post


Link to post
Share on other sites

G'day SmOke_N,

It's a good idea to use the HWNDs. I've been playing around with that today and it almost works. I'll post again shortly with my current findings.

Until anon,

Sean

Share this post


Link to post
Share on other sites

G'day All

I've been working with everyone's ideas and here is an *almost* working script. It includes a lot of comments about what works and what doesn't:

; Script to start video automatically in Session

; Global script settings

Opt("WinTitleMatchMode", 4); 4 = advanced (Accepts classname rather than titles.)
Opt("MouseCoordMode", 0); 0 = window (Coordinates are based on the active window.)
Opt("PixelCoordMode", 2); 2 = window (Coordinates are based on the active window.)

; Emergency exit!

HotKeySet("{ESC}", "Terminate")

Func Terminate()
    Exit 0
EndFunc

; Main script starts now

$WIN_REMOTEVID = 'ClassName=com.teraglobal.teramedia.media.RemoteMediaWindow'; Define shorter name variable for the remote video windows.
$WIN_MAIN = 'ClassName=com.teraglobal.teramedia.lite.MainWindow'; Define shorter name variable for the main window.
$WIN_CALLERR = 'ClassName=SunAwtDialog'; Define shorter name variable for the outgoing call "Not Registered" error window.

While 1

    $WinList = WinList($WIN_REMOTEVID); Define WinList as just checking the remote video windows.

    $WinCount = $WinList[0][0]; Define a variable that counts the first result in the the WinList array, the number of windows.
    
; 0 WINDOWS: Script for 0 windows. Project is not connected to the bridge. Use this result to trigger connecting to the bridge.
; This section works

    If $WinCount = 0 Then

        Msgbox(0, "How many Video Windows Exist? 0", $WinCount & " windows found. Project is not connected to bridge.", 2)
        
    ; 0 WINDOWS PART 1: Connection check: Check whether the connection to the bridge is up. If not, call it.

        $coord = PixelSearch(280, 58, 280, 58, 0x5B8AC6 ); Search for a light blue phone in an area that should be a red phone if connected.
        Sleep(100)
        If Not @error Then; If light blue phone is found, try to connect. If any other color is found, keep checking.
        MsgBox(48, "Bridge disconnect", "Bridge disconnect detected. Attempting to reconnect in 2 seconds.", 2); This messagebox should technically not be necessary, but for some reason the way it takes and returns Active focus allows AutoIt to Activate the window again. Without it, this script fails. So now it's a nice message that at least lets me track disconnects.
        WinActivate($WIN_MAIN); Light blue phone was found, so Activate the main window.
        WinWaitActive($WIN_MAIN); Wait for main window to be active.
        MouseClick("left", 280, 58); Click the play button once, starting the connection. This is technically more precise than the Send in the previous line, but it steals the mouse cursor.
        EndIf
    
        Sleep(500); Needed to let Session do its work before AutoIt tries to detect anything else

    ; 0 WINDOWS PART 2: Cancel "Not Registered" dialog: If the connection attempt fails because the bridge is temporarily "Not Registered" then automatically click the cancel button in the dialog and return to the Connection check above, which will try to start the connection again.

        If WinActive($WIN_CALLERR) Then; Check if the error box has opened
            $coord = PixelSearch(136, 71, 136, 71, 0xD4D0C8 ); Search for grey in an area that will be grey if this is a successful "trying" dialog but will be black (the last stroke in the "d" of "Registered") if this is the "Not Registered" error dialog.
                If Not @error Then; If grey is found, Send Enter to "Cancel" button. This is the reverse of the normal logic of PixelSearch but for some reason it works. Using black, which would be technically correct, does not work.
                Send("{ENTER}")
                EndIf
        EndIf

        Sleep(500); Needed to let Session do its work before AutoIt tries to detect anything else

; 1 WINDOW: Script for 1 window. Local video exists but is not visible (which is OK, it should stay hidden). No other users are logged in. Use this result to trigger nothing.
; This section works

    ElseIf $WinCount = 1 Then
        
        Msgbox(0, "How many Session Video Windows Exist? 1", $WinCount & " windows found. Project is logged in to the bridge alone. Waiting for subjects.", 2); This is just a holding pattern, waiting for either more or less windows since nothing happens if this case is true.

; 2 WINDOWS: Script for 2 windows. Local video plus 1 remote video exists but 0 are visible. Use this result to trigger opening the first remote video.
; This section works, but could use the HWND (Local $WinHandle2 = $WinList[2][1] etc., like 3 WINDOWS section) to be comparable and perhaps neater?

    ElseIf $WinCount = 2 Then
        
        Msgbox(0, "How many Session Video Windows Exist? 2", $WinCount & " windows found. Project is logged in to the bridge with 2 subjects.", 2)
        
                If Not WinActive($WIN_REMOTEVID) Then; Check if the remote video window is active. It if is NOT, do
                WinActivate($WIN_MAIN) 
                WinWaitActive($WIN_MAIN)
                $coord = PixelSearch(41, 180, 41, 180, 0xFFFFFF)
            ; $coord = PixelSearch(41, 180, 41, 180, 0x000000)
                    If Not @error Then
                ; MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1], 3); test
                    MouseClick("left", 41, 180); Click the first play button once, starting the first remote video if it exists
                    EndIf
            EndIf
            Sleep(500)

            If WinActive($WIN_REMOTEVID) Then
                Msgbox(0, "How many Session Video Windows Exist? 2", $WinCount & " windows found. Project is logged in to the bridge with 2 subjects. 1 video window should be running.", 2)
            EndIf
            Sleep(500)
            
; 3 WINDOWS: Script for 3 windows. Local video plus 2 remote videos exist but 0 are visible. Use this result to trigger opening the second remote video.
; This section half works

    ElseIf $WinCount = 3 Then

    Local $WinHandle3 = $WinList[3][1]; Create a variable that specifically looks to see if there is a handle for the third window (second remote video window) and then use that as a trigger if it exists. This is the only way that I can get the script to pay attention the the third window in particular. Part of the trouble is that Session is a Java program that actually has all the windows Existing and also Visible and sometimes also Active even when you *can't see them*. AUGH! So what happens is that you can see the second person log onto the bridge, but their video is not visible to the human eye. To AutoIt, however, once the second person logs on to the bridge, their video is at least Enabled and Visible. So I need some way of pinning down when the third window (second remote video window) is up and running. Some version of WinGetState and For...Next using HWND. But how?

        Msgbox(0, "How many Session Video Windows Exist? 3", $WinCount & " windows found. Project is logged in to the bridge with 2 subjects.", 2)
        
                WinGetHandle($WinHandle3)
                If @error Then
                MsgBox(4096, "Error", "Could not find third window."); test
                Else
                    WinActivate($WIN_MAIN)
                    WinWaitActive($WIN_MAIN)
                    MouseClick("left", 41, 200); Click the second play button once, starting the second remote video if it exists
                    Sleep(100)
                    
                ; Up to here, everything works OK. But once the second remote video is open I need to somehow stop the script looping back and pushing the button again, turning off the video that I have just turned on. The next few lines try that but don't work because the window won't always activate.
                    
                    WinActivate($WinHandle3) 
                    If WinActive($WinHandle3) Then
                    Msgbox(0, "How many Session Video Windows Exist? 3", $WinCount & " windows found. Project is logged in to the bridge with 2 subjects. 2 video windows should be running.", 2)
                    EndIf

                EndIf

                Sleep(500)

    Else

    Msgbox(0, "How many Session Video Windows Exist? ?", $WinCount & " windows found. Don't panic, but it might be a good idea to put on your peril-sensitive sunglasses.", 2); This line is needed by the script's logic but I don't need anything to happen. However, if I set the 3 WINDOW condition here, the script does not work properly for some reason.

    EndIf

WEnd

The scripts works on a basic level now, but still has a problem.

Here's what works:

1) If the Project computer is not connected to the bridge, it auto- reconnects.

2) If it is the only connected party, it waits for more people.

3) If one more person logs into the bridge, it starts their video, and restarts it if it ever turns off.

Here's what doesn't work:

1) If one person joins and then another joins a few moments later, the script has trouble starting that second person's video, especially if they disconnect and reconnect.

2) I used to have it so that if both parties joined before the script checked, it could start both videos, and that worked OK, but since that is much less likely than the case above, I took it out. However, if this does happen, it would be nice if the script worked.

The big problem is that Session is a Java program that seems to actually have the video windows in existence (Existing, Enabled, and sometimes Visible and Active) even when a human can't see them. Basically whenever someone logs in the bridge, a video connection is started but the video itself is not automatically played. So this creates a sitation in which AutoIt can be fooled by a window Existing and being Enabled even when the video isn't actually being played. I need some way of getting AutoIt to differentiate between a running video window and a non-running video window. My thoughts are to use WinGetState and For...Next but I cant' figure out the syntax. Here is my testing code for that (which doesn't really work but shows my thinking):

Func IsVisible($handle)
  If BitAnd(WinGetState($handle), 2) Then 
    Return 1
  Else
    Return 0
  EndIf
EndFunc

$WIN_REMOTEVID = 'ClassName=com.teraglobal.teramedia.media.RemoteMediaWindow'
$WIN_MAIN = 'ClassName=com.teraglobal.teramedia.lite.MainWindow'

While 1

$WinList = WinList($WIN_REMOTEVID)

$handle = WinGetHandle($WIN_REMOTEVID)

$title = WinGetTitle($WIN_REMOTEVID)

$state = WinGetState($WIN_REMOTEVID)

For $i = 1 to $WinList[0][0]
 ; Only display enabled windows that have a title
  If $WinList[$i][0] <> "" AND IsEnabled($WinList[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $WinList[$i][0] & @LF & "Handle=" & $var[$i][1], 3)
  EndIf
Sleep(500)
Next

This code, using the WinLlist example, sort of works to return the state of the relevant windows, but I need it to specifically work with the $WinHandle3 in the first script above and be able to return meaningful results about when $WinHandle3 Exists and Enabled but is not Visible and Active.

Any help, as always, is greatly appreciated.

Until anon,

Sean

--

Sean Rintel

Department of Communication

University at Albany, State University of New York

1400 Washington Ave

Albany, NY, 12222

USA

p: (518)-442-2603

e: er8430@albany.edu

w: http://www.albany.edu/~er8430

Share this post


Link to post
Share on other sites

#14 ·  Posted

G'day all,

Thanks for the help. I solved my problems and have a working script now!

Until anon,

Sean

Share this post


Link to post
Share on other sites

#15 ·  Posted

G'day all,

Thanks for the help. I solved my problems and have a working script now!

Until anon,

Sean

nice job... Sean

and... nice script for 14 posts

8)


NEWHeader1.png

Share this post


Link to post
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
Sign in to follow this  
Followers 0