Jump to content
Sign in to follow this  
PhaseChange

Complicated If Then Statement

Recommended Posts

PhaseChange

Hi all! I'm new to the AutoIt scene and I'm a bit stumped on a script I am writing.

I'm grasping the AutoIt syntax pretty well and restarted on a little project that I put away for a couple years. I can't get too specific on what it is, but I will try to explain to the best of my ability.

Anyways...

The AutoIt script that I have writen so far Runs a program that tests the config for another program then runs that program and another program that hides it's window.

Run("C:\Mushrooms\Tops\Program1.exe") ;Run the Testing/Launching program for Program2
WinWaitActive("Program1")
ControlClick("Program1", "", "[CLASS:Button; TEXT:Run Test; INSTANCE:3]") ;Start Tester
WinWaitActive("Tester")
ControlClick("Tester", "", "[CLASS:Button; TEXT:Done; INSTANCE:1]") ;Acknowledge Competion of Test
WinWaitClose("Tester")
ControlClick("Program1", "", "[CLASS:Button; TEXT:Start!; INSTANCE:11]") ;Launch Both Programs
oÝ÷ Ø2¢çǦ·­·+"^±Êâ¦Ø§Êj°µêêºO®+jmjºlµªí²êmí©®+jkºÚ¶ë²«¨´ú趦ګ¨¶Ú%¢
'¶¬z»Þ­«­¢+Ø)]¥¹]¥ÑÑ¥Ù ÅÕ½ÐíAɽɴÈÅÕ½Ðì¤)M±À àÀÀÀ¤íÁÁɽà¸Ñ¥µ½È±½¥¸ÍɸѼ±½)M¹ ÅÕ½ÐíUÍɹµÅÕ½Ðì¤í¹ÑÈ¥¸ÕÍɹµ)M¹ ÅÕ½ÐííQ ôÅÕ½Ðì¤)M¹ ÅÕ½ÐíAÍÍݽÉÅÕ½Ðì¤í¹ÑÈ¥¸AÍÍݽÉ)M¹ ÅÕ½Ðíí9QIôÅÕ½Ðì¤)M±À ÐÀÀÀ¤í]¥Ð½ÈMÉÙÈ
½¹¥ÉµÑ¥½¸)M¹ ÅÕ½Ðíí9QIôÅÕ½Ðì¤í­¹½Ý±MÉÙÈ
½¹¹Ñ¥½¸)M±À ÐÀÀÀ¤íÁÁɽà¸Ý¥ÐÑ¥µ½È!¥¸]¥¹½ÜѼ½ÁÁɱ(oÝ÷ Ø{-Yoz¼¬jezÇ+b^­è¬Â«xZu©b¶Ù^n+h~Úè¹¹^nëmè(¡Ýý¢X^âëÂg­º.aÊ'yhZ´­ ]¡ë!z·¢²^§âæò¦·¬²)à¶×^h§v7ö˧¦åyÓ©zvî¶Ú'ºâ.¥«-jwZ­Ó:§Â)Ý£-·*^²)íçâéhq«b¢v§vv¦zØ^ÉbrK-ê)zvî¶Ú'û^®Ø^~)^«yé塧^t­ i­ë,zËaxxuéÖwhÃlºyZnWJÖ«´­¶ÚºÚ"µÍÛÛÛÛXÚÊ    ][ÝÖÐÓTÔÎÚ[ÝÜÑÜÌLÚ[ÝËI][ÝË ][ÝÉ][ÝË    ][ÝÖÐÓTÔÎÚ[ÝÜÑÜÌLUÓÈSÕSÑNI][ÝÊHÐÛXÚÈÛY[Ú[ÝÉÌÎNÜÈ[XY   ][ÝÓÜ[][ÝÈ]ÛÚ[ØZ]]][ÝÓÜ[][ÝÊBÛY

HÑÜÛÛYXÛÛHÚ[ØZ]ÈÝÛÈ[ÝYÚYÜH[ÂÙ[
    ][ÝÐÎÌLÓ]ÚÛÛÉÌLÐÝÛÌK[ ][ÝÊBÛÛÛÛXÚÊ    ][ÝÓÜ[][ÝË ][ÝÉ][ÝË    ][ÝÖÐÓTÔÎ]ÛÈV[ÓÜ[ÈSÕSÑNI][ÝÊHÐÛXÚÈHÜ[]ÛÚ[ØZ]ÛÜÙJ  ][ÝÓÜ[][ÝÊBÛY

HÒÝHØY^HXØ]][ÛÈXZÙHÝH[ÜÈ[Û[ÛÝÛÛÛÛXÚÊ ][ÝÖÐÓTÔÎÚ[ÝÜÑÜÌLÚ[ÝËI][ÝË ][ÝÉ][ÝË    ][ÝÖÐÓTÔÎÚ[ÝÜÑÜÌLUÓÈSÕSÑNI][ÝÊHÐÛXÚÈÛY[Ú[ÝÉÌÎNÜÈ[XY   ][ÝÔÝ    ][ÝÈ]Û

This is the part where I'm stumped.

In the hidden window there is a text field that constantly update's the progress of Program1's reaction to the xml file. After Program1 processes the xml file it tells the Hidden Window that it is done.

Finally my question:

How do I tell AutoIt to wait (Rather:continuously check) for the Hidden Window's text box to say "Done!"?

The Hidden Window constantly writes a .log file that I can parse, but I'd rather just take the information straight from the Hidden Window's text field.

Thanks in advanced for any help!

Edited by PhaseChange

Share this post


Link to post
Share on other sites
Achilles

Hi all! I'm new to the AutoIt scene and I'm a bit stumped on a script I am writing.

I'm grasping the AutoIt syntax pretty well and restarted on a little project that I put away for a couple years. I can't get too specific on what it is, but I will try to explain to the best of my ability.

Finally my question:

How do I tell AutoIt to wait (Rather:continuously check) for the Hidden Window's text box to say "Done!"?

The Hidden Window constantly writes a .log file that I can parse, but I'd rather just take the information straight from the Hidden Window's text field.

Thanks in advanced for any help!

Try WinGetText()... look it up in the helpfile. Also look at the included AutoItWindow info, if that can't see the text your looking for when the window is visible then WinGetText probably won't work...

Welcome to the forum!

Edit: The code will look something like this if WinGetText works:

$pass = False
Do 
    Sleep(50) 
    If WinGetText('your window') = 'Done' then $pass = True
Until $pass = True
Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
herewasplato

Or you might try:

Opt("WinDetectHiddenText",1)
WinWait("title", "Done")


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
PhaseChange

Thanks for the help, but unfortunatly it did not work... however you gave me an idea.

Is it possible to direct the WinGetText() to a specific instance in the window?

For example the window would be:

[CLASS:WindowsForms10.window.8.app.0.*******]

and the Text Field is:

[CLASS:WindowsForms10.EDIT.app.0.*******; INSTANCE:1]

Share this post


Link to post
Share on other sites
PhaseChange

Or you might try:

Opt("WinDetectHiddenText",1)
WinWait("title", "Done")

Actually that worked... :) however it will say "Done!" many times so I'll have to find a way around that!

Thank you guys so much!

Share this post


Link to post
Share on other sites
herewasplato

...it will say "Done!" many times so I'll have to find a way around that!...

try this:
; The "title" was removed from the WinWait and WinExists lines
; to enable you to run/test the code from within SciTE.
Opt("WinDetectHiddenText", 1)

; wait for the first "Done"
WinWait("", "Done")
$var = 0

; loop looking for "Done"
; if another window without "Done" appears,
; set $var to zero and start the count again.
Do
    ;Sleep(10) ; you might not want a sleep in this loop
    If WinExists("", "Done") Then
        $var += 1
    Else
        $var = 0
    EndIf
    ; ToolTip is just for debug
    ToolTip($var)
Until $var = 75 ;adjust this a

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×