BatMan22

WinWaitActive changing window name

5 posts in this topic

#1 ·  Posted

I am trying to make a script with the command WinWaitActive where it looks for a window that changes the name.. ie. "Reprocess: xxxxxx". For example something like WinWaitActive("Reprocess:"+*****)

 

Thanks!

Share this post


Link to post
Share on other sites



#2 ·  Posted

Read about Window Titles and Text (Advanced) in Helpfile. If it's the only window beginning with "Reprocess:" you can use

Opt("WinTitleMatchMode", 1)

$hWnd=WinWaitActive("Reprocess:","",10) ;waiting max 10 sec for activating
If $hWnd=0 Then Exit MsgBox(16,"Error","Window not found")

or you can trying to do it by matching Title defined by a regular expression.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

Sorry man, first time programming in decades, you will probably laugh at my script but... It's super simple, fast, it works and its saved me a TON of time. Thanks for your help! I don't honestly understand why  WinWaitActive("Reprocess:","") means Reprocess: *****, but your code works great. Which the error box is great.. If I DIDNT want to put in the timeout delay... Could  I replace it with JUST  WinWaitActive("Reprocess:","")? Either way, thanks a ton!

$repeat = inputbox("Beep", "how many times should it repeat?", "")
While $repeat ;repeat $number of times
    Sleep(100)
    WinWaitActive("Chromatogram open")
    Send("!B"); send to batch
    WinWaitActive("To Batch")
    Send("!K"); hit ok
    WinWaitActive("IC Net")
    Send("!Y"); hit yes
      Opt("WinTitleMatchMode", 1)
         $hWnd=WinWaitActive("Reprocess:","",10) ;waiting max 10 sec for activating
         If $hWnd=0 Then Exit MsgBox(16,"Error","Window not found")
    Send("!O"); Go to Report Options
    WinWaitActive("Report options")
    Send("!U"); Go to Custom Report Text bot
    Send("export.exe") ; type export.exe
    Send("!A"); Hit the accept button
    Opt("WinTitleMatchMode", 1)
         $hWnd=WinWaitActive("Reprocess:","",10) ;waiting max 10 sec for activating
         If $hWnd=0 Then Exit MsgBox(16,"Error","Window not found")
    Send("!R"); Hit the report button
    WinWaitActive("IC Net")
    Send("!FOC"); OPenChromatogramWindowAgain
    WinWaitActive("Chromatogram open")
    Send("{DOWN}")
    $repeat -= 1
wend
MsgBox(1,"Reported","OK")

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Get the handle...it doesn't change, even when the title does:

$h = WinGetHandle

Then you can loop until the title changes:

WinGetTitle( $h, ""

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

33 minutes ago, BatMan22 said:

If I DIDNT want to put in the timeout delay... Could  I replace it with JUST  WinWaitActive("Reprocess:","")?

Without a timeout maybe script waiting since next power interrupt. But if you think 10 sec are to short use a longer timeout value.

Edited by AutoBert

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