Sign in to follow this  
Followers 0
seanrintel

Looping If Then Statements Using Winwaitclose As The Triggering If Event

3 posts in this topic

G'day,

I am new to programming and AutoIt, but reasonably facile with computers and can code and navigate basic HTML and CSS. So I think I understand my problem and should understand the solution, but I am lacking the basic programming skills to solve it. I hope I can explain it clearly enough.

Let me outline the problem, the task I want AutoIt to do, my current code, and finally my question.

1. The problem

For my Ph.D., I am researching how people learn to use videoconferencing. I want to record videoconferences that between two subjects people on a multi-point bridge. (You can see a diagram of this at http://albany.edu/~er8430/project/1-orient...ecording.shtml). The videoconferencing client, Session 3, is excellent but has one niggle: it will play sound automatically but you have to click a little play button to bring up the video every time. For two people, that means clicking two play buttons each time they log on.

2. The task

I want my subjects to be able to call each other any time. I have a 24/7 recording system and can be logged on to the bridge 24/7, so that's great. But I need one more thing: I want to automate the clicking of the two play buttons each time subjects log on to the bridge. Otherwise I will have to manually click those buttons myself every time I want to record my subjects. Augh!

3. My current code

Session is basically a Java program wrapped inside a Windows or Mac shell (I'm using that term loosely, not in the strict programming sense). I know that Java is a black box as faras AutoIt is concerned, and so I can't get any kind of Control Under Mouse information from it. I can, however, use the 'surface level' technique of waiting for various windows to appear and then using MouseMove and MouseClick to get the buttons clicked. This code seems to work, and is documented step by step:

; Set MouseCoordMode to Window so that the coordinates work.
Opt ("MouseCoordMode", 0)
; Users will be asked to IM one another to check the connection. This gives me an event that makes sure each user is logged on and the play buttons are there before AutoIt tries to do anything.
WinWaitClose("Session IM")
; Wait for the Session - suny1 main videoconferencing window to be active. This is the window with the two play buttons in it.
WinWaitActive ("Session - suny1", "")
; Move the mouse to the first play button.
MouseMove (15, 190)
; Click the play button once, starting the first subject's video.
MouseClick ("left")
; Move the mouse down to the second play button.
MouseMove (15, 215)
; Click the play button once, starting the second subject's video.
MouseClick ("left")

There may be a nicer way of doing that, and I'm very open to suggestions, but my real problem comes next.

4. My problem

The code above solves the video play button problem once, but I obviously want it to happen indefinitely so that the video windows pop up automatically every time users log on to the bridge. Now my total lack of programming skill rears its ugly head, both in terms of my inability to solve it and possible to explain it. As I understand it, I need to wrap the code above in an infinitely looping "if-then" statement that uses WinWaitClose("Session IM") as the triggering "if" event. But I have no idea how to do that.

Any help would be massively appreciated.

Thanks in advance,

Sean

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Welcome to the forums

maybe

; Set MouseCoordMode to Window so that the coordinates work.
Opt("MouseCoordMode", 0)
; Users will be asked to IM one another to check the connection. This gives me an event that makes sure each user is logged on and the play buttons are there before AutoIt tries to do anything.


While 1
    
    If WinActive("Session IM") Then
        WinWaitClose("Session IM")
; Wait for the Session - suny1 main videoconferencing window to be active. This is the window with the two play buttons in it.
        WinWaitActive("Session - suny1", "")
; Move the mouse to the first play button.
        MouseMove(15, 190)
; Click the play button once, starting the first subject's video.
        MouseClick("left")
; Move the mouse down to the second play button.
        MouseMove(15, 215)
; Click the play button once, starting the second subject's video.
        MouseClick("left")
    EndIf
    
    Sleep(100)
WEnd

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

G'day!

Many thanks. It was exactly what I asked for. Now I realize that I asked far too simple a question. Your answer has helped me make sense of the help files and I think I can work on my own for a while. I might have to ask another question or two if I tie myself in a knot. I really appreciate the help.

Until anon,

Sean

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