Jump to content

Detect window until it closes in a loop, if it terminates then do


Recommended Posts

Quote

 

$CitrixWindowExists = "?"
    While 1
        If WinExists($CitrixWindowExists) Then
            $CitrixExists = 1
        Else
                MsgBox(0, "Ruh Roh", "Citrix Window Closed.", 30)
                Shutdown(0) ;logoff here
                Exit
        Sleep(200)
    WEnd

 

This is something simple, but me being a newbie to AutoIT, I'd REALLY appreciate some help..

I really just need to monitor for a Citrix Window that closes, I know I can target that window title when it's active, but in my testing I am having trouble making it consistent and I am sure it's something I am doing wrong, in addition to this being a learning process for me.

Any clarification or wisdom is appreciated. I just need to actively and continuously monitor when the window closes and then perform the logoff..as long s the window is active, nothing needs to be done.

Edited by engagewithrage
Link to post
Share on other sites

64 is the info symbol, one of a few values I know by heart.

30 is the timout value for the MsgBox()

As @OJBakker mentioned already, pls have a look at the documentation for MsgBox()

 

A very nice tool is the Message Box Code Wizzard, available by pressing  [alt]+[w] from SciTE editor. There you can set a lot of things to design your message boxes. Many things are done through this numeric, fist value to be passed to the MsgBox() function. The wizzard will calculate the value as needed to match your selections.

 

And finally a suggestion:

 

MsgBox(64"blahblah"m30) is messed up, broken sample code. Pls. try to be precisely!

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to post
Share on other sites
On 11/10/2022 at 5:14 AM, rudi said:

Hello

 

$CitrixTitle="TextOfCitrixWindowTitle"

while WinExists($CitrixTitle)
    Sleep 200
WEnd

MsgBox(64,"Citrix Window closed","Going to logoff",30)
Shutdown(0)

 

This is not consistent enough, sometimes it detects when the window closes, often times not..

I've been reading the below, so we'll see if I can find a way to always target the window and perform the logoff when it closes..we'll see how it goes lol

https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm

Edited by engagewithrage
Link to post
Share on other sites
28 minutes ago, engagewithrage said:
$CitrixWindowTitle = "Something - More Something Stuffs"
While WinExists("[TITLE:$CitrixWindowTitle; CLASS:Transparent Windows Client; INSTANCE:1]", "")
    Sleep(500)
WEnd

Are there escape characters I need to use a variable in the advanced window titles thingy? Or do I need to use plain text?

 

$CitrixWindowTitle = "Something - Something Else"
While WinExists("[TITLE:" & $CitrixWindowTitle & "; CLASS:Transparent Windows Client; INSTANCE:1]", "")
    Sleep(500)
WEnd

?

Edited by engagewithrage
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...