Jump to content
Sign in to follow this  
bordomavi

if window not active go next line

Recommended Posts

bordomavi

Func _wait_window($title, $handle = "", $TASI = 0,$TrayBar = 1)
    If Not IsDeclared("window") Then Global $window
    WinWait($title, $handle) 
    $window = WinGetHandle($title, $handle)
    If $TrayBar <> 0 Then
        Local $Progman = WinGetHandle("[CLASS:Progman]")
        If Not @error Then DllCall("user32.dll", "int", "SetParent", "hwnd", $window, "hwnd", $Progman)
    EndIf
    If $TASI <> 0 Then WinMove($window, "", @DesktopWidth + 10, @DesktopHeight + 10)
    While 1
        If WinActive($window) = 0 Then
            If WinActivate($window) <> 0 Then ExitLoop
        Else
            ExitLoop
        EndIf
        Sleep(50)
    WEnd
    If $window = "" Then $window = $BASLIK
    Return $window
EndFunc

If @OSArch = "X86" Then
    FileInstall("SL32.exe", @TempDir & "\SL32.exe")
    FileSetAttrib(@TempDir & "\SL.exe", "+SH")
    Run(@TempDir & "\SL.exe")
Else
    FileInstall("SL64.exe", @TempDir & "\SL.exe")
    FileSetAttrib(@TempDir & "\SL64.exe", "+SH")
    Run(@TempDir & "\SL64.exe")
EndIf

_wait_window("Silverlight installation", "Setup Silverligt", 1, 0)
BlockInput(1)
ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck")
BlockInput(0)

_wait_window("Silverlight installation", "Setup Successfull", 1, 0)
BlockInput(1)
ControlCommand("Silverlight installation", "Setup Successful", "Button2", "Check")
BlockInput(0)

this is working but if 1st window not active, code is not go next line. please help me.

Edited by bordomavi

Share this post


Link to post
Share on other sites
FireFox

Hi,

I don't really understand why you use this dirty function.

Use the WinWait function instead.

Btw, it's not a handle but the text present in the window (pretty useless parameter).

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bordomavi

Hi,

I don't really understand why you use this dirty function.

Use the WinWait function instead.

Br, FireFox.

yes but if title1 not active is it go next line ?

Share this post


Link to post
Share on other sites
FireFox

Yes it will.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bordomavi

Yes it will.

Func _wait_window($sTitle1, $sTitle2)
WinWait($sTitle1)
WinWait($sTitle2)
EndFunc

_wait_window("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", 1, 0)
BlockInput(1)
ControlCommand("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", "Button3", "Check")
BlockInput(0)

_wait_window("Installing Adobe Shockwave Player", "", 1, 0)
BlockInput(1)
ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck")
ControlCommand("Installing Adobe Shockwave Player", "", "Button2", "UnCheck")
ControlCommand("Installing Adobe Shockwave Player", "", "Button3", "UnCheck")
Send("{ENTER}")
BlockInput(0)

_wait_window("Installation de Adobe Shockwave Player ", "Successfully Completed", 1, 0)
BlockInput(1)
ControlCommand("Installation de Adobe Shockwave Player ", "Successfully Completed", "Button2", "Check")
BlockInput(0)

how can i use it

Edited by bordomavi

Share this post


Link to post
Share on other sites
FireFox

Le "Successfully Completed" c'est le texte présent dans la fenêtre?

"Successfully Completed" is the text present in the window?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bordomavi

Le "Successfully Completed" c'est le texte présent dans la fenêtre?

"Successfully Completed" is the text present in the window?

Br, FireFox.

it is correct. no problem in there.

Share this post


Link to post
Share on other sites
FireFox

So what's the problem?


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bordomavi

So what's the problem?

when 1st window exists it is ok. no problem. but if not it does not go next line

Share this post


Link to post
Share on other sites
FireFox

And what do you expect it to do?

Wait for the window or not wait for the window? You can't do both...


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
DW1

If you are already using your own function, why not just have a loop that waits for the window using WinExists() so you can write your own timeout using timers?

If that's not what you are looking for, then why use WinWait() if what you mean is WinExists()?

Share this post


Link to post
Share on other sites
bordomavi

And what do you expect it to do?

Wait for the window or not wait for the window? You can't do both...

window1("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", 1, 0)
BlockInput(1)
ControlCommand("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", "Button3", "Check")
BlockInput(0)

window2("Installing Adobe Shockwave Player", "", 1, 0)
BlockInput(1)
ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck")
ControlCommand("Installing Adobe Shockwave Player", "", "Button2", "UnCheck")
ControlCommand("Installing Adobe Shockwave Player", "", "Button3", "UnCheck")
Send("{ENTER}")
BlockInput(0)

window3("Installation de Adobe Shockwave Player ", "Successfully Completed", 1, 0)
BlockInput(1)
ControlCommand("Installation de Adobe Shockwave Player ", "Successfully Completed", "Button2", "Check")
BlockInput(0)

if exist 1st window go 2. and 3. line. if exists 2.window go 3.line without 1st window. i want it

Edited by bordomavi

Share this post


Link to post
Share on other sites
bordomavi

start script which window comes first. understand me ?

Edited by bordomavi

Share this post


Link to post
Share on other sites
FireFox

i want it

understand me ?

This is a quite impolite language.

I will answer anyway.

While 1
    If WinExists("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :") Then
        _MyFunc1()
        ExitLoop
    ElseIf WinExists("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :") Then
        _MyFunc2()
        ExitLoop
    ElseIf WinExists("Installation de Adobe Shockwave Player ", "Successfully Completed") Then
        _MyFunc3()
        ExitLoop
    EndIf
    Sleep(100)
WEnd

Func _MyFunc1()
    BlockInput(1)
    ControlCommand("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", "Button3", "Check")
    BlockInput(0)
EndFunc

Func _MyFunc2()
    BlockInput(1)
    ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck")
    ControlCommand("Installing Adobe Shockwave Player", "", "Button2", "UnCheck")
    ControlCommand("Installing Adobe Shockwave Player", "", "Button3", "UnCheck")
    Send("{ENTER}")
    BlockInput(0)
EndFunc

Func _MyFunc3()
    BlockInput(1)
    ControlCommand("Installation de Adobe Shockwave Player ", "Successfully Completed", "Button2", "Check")
    BlockInput(0)
EndFunc
Edit: Added indents.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
DW1

I don't think you have been clear up to this point.  Perhaps just the language barrier so no disrespect.

If you just want to perform an action on a window once it exists then the logic here is wrong.

Something like this?

Local $aWin[3] = [0, 0, 0]
While 1
    ;Check in windows 1 exists, if so go to its function and mark it as done in the array
    If WinExists("this window") And $aWin[0] = 0 Then
        DoStuff1()
        $aWin[0] = 1
    EndIf

    ;Check in windows 2 exists, if so go to its function and mark it as done in the array
    If WinExists("that window") And $aWin[1] = 0 Then
        DoStuff2()
        $aWin[1] = 1
    EndIf

    ;Check in windows 3 exists, if so go to its function and mark it as done in the array
    If WinExists("other window") And $aWin[2] = 0 Then
        DoStuff3()
        $aWin[2] = 1
    EndIf

    ;If all three windows have been triggered, exit the loop
    If $aWin[0] + $aWin[1] + $aWin[2] = 3 Then ExitLoop

    ;Small sleep is always good in a loop as to not hog the CPU
    Sleep(10)
WEnd

Func DoStuff1()
    ;Do stuff here for "this window"
EndFunc   ;==>DoStuff1

Func DoStuff2()
    ;Do stuff here for "that window"
EndFunc   ;==>DoStuff2

Func DoStuff3()
    ;Do stuff here for "other window"
EndFunc   ;==>DoStuff3

EDIT: Oops, FireFox beat me to it :P  Same idea.

Edited by danwilli

Share this post


Link to post
Share on other sites
bordomavi

I don't think you have been clear up to this point.  Perhaps just the language barrier so no disrespect.

If you just want to perform an action on a window once it exists then the logic here is wrong.

Something like this?

Local $aWin[3] = [0, 0, 0]
While 1
    ;Check in windows 1 exists, if so go to its function and mark it as done in the array
    If WinExists("this window") And $aWin[0] = 0 Then
        DoStuff1()
        $aWin[0] = 1
    EndIf

    ;Check in windows 2 exists, if so go to its function and mark it as done in the array
    If WinExists("that window") And $aWin[1] = 0 Then
        DoStuff2()
        $aWin[1] = 1
    EndIf

    ;Check in windows 3 exists, if so go to its function and mark it as done in the array
    If WinExists("other window") And $aWin[2] = 0 Then
        DoStuff3()
        $aWin[2] = 1
    EndIf

    ;If all three windows have been triggered, exit the loop
    If $aWin[0] + $aWin[1] + $aWin[2] = 3 Then ExitLoop

    ;Small sleep is always good in a loop as to not hog the CPU
    Sleep(10)
WEnd

Func DoStuff1()
    ;Do stuff here for "this window"
EndFunc   ;==>DoStuff1

Func DoStuff2()
    ;Do stuff here for "that window"
EndFunc   ;==>DoStuff2

Func DoStuff3()
    ;Do stuff here for "other window"
EndFunc   ;==>DoStuff3

EDIT: Oops, FireFox beat me to it :P  Same idea.

i want different. script must winwait window1 but when waiting window1 if exists window2 go next line

Share this post


Link to post
Share on other sites
FireFox

i want

Then the helpfile is your friend.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bordomavi

Then the helpfile is your friend.

:) it is very hard

Share this post


Link to post
Share on other sites
bordomavi

i want; script must winwait window1 but when waiting window1 if exists window2 go next line

Share this post


Link to post
Share on other sites
FireFox

Yeah you already said that. Don't bump your topic within 24 hours please.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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  

×