Sign in to follow this  
Followers 0
afzalw

Check no new dilog box opens for 10 minutes then proceed

17 posts in this topic

#1 ·  Posted (edited)

To close a running application if no new dilog box opens for 10 minute.

New dilog box Tittle: Title of this dilog box is always is "XXXXXX Report" where XXXXXX keeps on changing for every dilog box but word Report is common in all windows.

A total of 27 dilog box will open and it could take 3 hour for opening them therfore I want a script to check every 10 minutes if nothing new opened than proceed.

I know about WinWaitClose ( "title" [, "text" [, timeout]] ) I am not sure if this should work.

As I need something that should keep checking for 10 minutes and if no new dolog box opens for 10 minutes its should proceed then.

Thanks

Edited by afzalw

Share this post


Link to post
Share on other sites



Something like that:

$Timer_Start = TimerInit()

$i = 0
Do
    $i += 1
Until TimerDiff($Timer_Start) >= 600000 ;10 minutes

MsgBox(0,"","10 minutes elapsed!")

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
AdLibRegister(_WinCheck, 1000*60*10)
While 1
  Sleep(10)
WEnd

Func WinCheck()
  If WinExists(" Report") Then
    ; Do what you need to do if the popup appears
  EndIf
EndFunc

Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
AdLibRegister(_WinCheck, 1000*60*10)
While 1
Sleep(10)
WEnd

Func WinCheck()
If WinExists(" Report") Then
; Do what you need to do if the popup appears
EndIf
EndFunc

Its running when I remove _ from line which becomes : AdLibRegister("WinCheck", 1000*60*10)

Edited by afzalw

Share this post


Link to post
Share on other sites

This is the correct code:

Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
AdlibRegister("_WinCheck", 1000*60*10)
While 1
    Sleep(10)
WEnd

Func _WinCheck()
    If WinExists(" Report") Then
        ; Do what you need to do if the popup appears
    EndIf
EndFunc   ;==>_WinCheck

But if i understand well you DONT need to check this windows every 10 minutes, but you need to check the windows FOR 10 minutes. So my code should do what you want ;)

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

This is the correct code:

Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
AdlibRegister("_WinCheck", 1000*60*10)
While 1
    Sleep(10)
WEnd

Func _WinCheck()
    If WinExists(" Report") Then
        ; Do what you need to do if the popup appears
    EndIf
EndFunc ;==>_WinCheck

But if i understand well you DONT need to check this windows every 10 minutes, but you need to check the windows FOR 10 minutes. So my code should do what you want ;)

Hi!

Yes, you are right it should keep checking FOR 10 minutes and if no dialog box with "Report" name exist then proceed.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

What about this:

Opt("WinTitleMatchMode", 2)

Global $fShow = False

$Timer_Start = TimerInit()

Do
    If WinExists(" Report") Then
        $fShow = True
        ExitLoop
    EndIf
Until TimerDiff($Timer_Start) >= 600000 ;10 minutes

If $fShow = True Then
    MsgBox(0, "", "Dialog box showed!")
    $fShow = False ;Just reset the flag
Else
    MsgBox(0, "", "No dialog box showed.")
    ;Do what you want.
EndIf

Hi!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

This is the correct code:

Opt("WinTitleMatchMode", 2) ; Perform a string-in-string type search for window titles.
AdlibRegister("_WinCheck", 1000*60*10)
While 1
    Sleep(10)
WEnd

Func _WinCheck()
    If WinExists(" Report") Then
        ; Do what you need to do if the popup appears
    EndIf
EndFunc ;==>_WinCheck

But if i understand well you DONT need to check this windows every 10 minutes, but you need to check the windows FOR 10 minutes. So my code should do what you want ;)

Hi!

Here regarding ; Do what you need to do if the popup appears I don't want to do any thing if Pop appears. I only want to check if there is a Pop up. And if no popup appears for 10 minutes than proceed...

Share this post


Link to post
Share on other sites

Here regarding ; Do what you need to do if the popup appears I don't want to do any thing if Pop appears. I only want to check if there is a Pop up. And if no popup appears for 10 minutes than proceed...

Look to my previous post ;)

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Look to my previous post ;)

Hi!

It works only problem is that when it sees a dialog box it gives the message and script ends, it should keep running for 10 minutes If it sees a dialog box.

Edited by afzalw

Share this post


Link to post
Share on other sites

It works only problem is that when it sees a dialog box it gives the message and script ends, it should keep running for 10 minutes If it sees a dialog box.

Just remove the ExitLoop

Opt("WinTitleMatchMode", 2)

Global $fShow = False

$Timer_Start = TimerInit()

Do
    If WinExists(" Report") Then
        $fShow = True
    EndIf
Until TimerDiff($Timer_Start) >= 600000 ;10 minutes

If $fShow = True Then
    MsgBox(0, "", "Dialog box showed!")
    $fShow = False ;Just reset the flag
Else
    MsgBox(0, "", "No dialog box showed.")
    ;Do what you want.
EndIf

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

i see... sorry for misunderstanding. So what do you want to do if no dialogue box shows up?


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Just remove the ExitLoop

Opt("WinTitleMatchMode", 2)

Global $fShow = False

$Timer_Start = TimerInit()

Do
If WinExists(" Report") Then
$fShow = True
EndIf
Until TimerDiff($Timer_Start) >= 600000 ;10 minutes

If $fShow = True Then
MsgBox(0, "", "Dialog box showed!")
$fShow = False ;Just reset the flag
Else
MsgBox(0, "", "No dialog box showed.")
;Do what you want.
EndIf

Okay, so this works fine but it leaves some gap in the process.

I needed something that frequently check for 10 minutes and ONLY move forward if it does not see any dialog box during all these 10 minutes.

or Other way could we can only proceed if no new dialog box appears for a DURATION of 10 minutes.

Share this post


Link to post
Share on other sites

Okay, so this works fine but it leaves some gap in the process.

I needed something that frequently check for 10 minutes and ONLY move forward if it does not see any dialog box during all these 10 minutes.

or Other way could we can only proceed if no new dialog box appears for a DURATION of 10 minutes.

Opt("WinTitleMatchMode", 2)

Global $fShow = False

$Timer_Start = TimerInit()

Do
If WinExists(" Report") Then
$fShow = True
EndIf
Until TimerDiff($Timer_Start) >= 600000 ;10 minutes

If $fShow = False Then
;Do what you want.
EndIf

Somethig like that? At the end of 10 minutes if no dialog box was showed do what you want ;)

Hi!


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Every 10 minutes that passes, it looks for the dialogue. If a dialogue is found, it resets the 10 minute timer and continues the loop. If no dialogue is found, it breaks from the loop and continues on.

Opt("WinTitleMatchMode", 2)

Local $hTimer = TimerInit()
While 1
    If TimerDiff($hTimer) >= 600000 Then
        If WinExists(" Report") Then
            $hTimer = TimerInit()
            ContinueLoop
        Else
            ExitLoop
        EndIf
    EndIf
WEnd

; Next command

EDIT:

An alternative (because having it skip in 10 minute intervals doesn't sound logical to me for your use...) can be to just break from the loop if for any span of 10 minutes DOES NOT see a dialogue box.

Opt("WinTitleMatchMode", 2)

Local $hTimer = TimerInit()
While 1
    If WinExists(" Report") Then
        $hTimer = TimerInit()
        ContinueLoop
    Else
        If TimerDiff($hTimer) >= 600000 Then ExitLoop
    EndIf

WEnd

; Next command

NOTE: I hope you are doing something with those dialogue boxes if they popup...

Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

These dialog box pops and hides like every minutes and there are times when there is not dialog box but the process is still running, hence something that could check no dialog box had appeared throughout 10 minutes.

I am not doing anything with dialog box, it just indication that if no dialog box appears than my process ends and I have to start the other script.

I only want to know when this process ends and indication is when no dialog box appears for 10 consecutive minutes (throughout 10 minutes)

1) I guess we can check it for every one minute for 10 minutes.

2) Add 1 value in some variable every time no dialog box appeared after 1 minute.

3) If the variable is equal to 10 then proceed, means no dialog box for 10 minutes.

4) Otherwise (If dialog box appeared made variable = 0 and restart script)

Thanks guys you have been really helpful.

Share this post


Link to post
Share on other sites

Then use my 'Alternative' code from my last post. It does exactly as you described.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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