Jump to content

I need help


Recommended Posts

All right, Problem 1:

I made this script:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Ruben van Os <rubenvanos@gmail.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

Opt("TrayIconDebug", 1)

Opt("MouseCoordMode", 2)

$wijd=@DesktopWidth

Opt("GUICoordMode",2)

If FileExists("C:\Program Files\Extreme Cleaner\EASYCLEANER\") Then
    TrayTip ( "Extreme Cleaner", "EasyCleaner data is gevonden.", 30 , 1)
Else
        #include <GUIConstants.au3>
        GUICreate ( "Extreme Cleaner, EasyCleaner data niet gevonden! Wilt u dit automatish downloaden en installeren?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
        $easycleanerautoja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
        $easycleanerautonee = GUICtrlCreateButton ( "Nee",  0, -1)
        GUISetState (@SW_SHOW)

        While 1
           $msg = GUIGetMsg()
           Select
               Case $msg = $GUI_EVENT_CLOSE
                 Exit
              Case $msg = $GUI_EVENT_MINIMIZE
              Case $msg = $GUI_EVENT_MAXIMIZE
   
              Case $msg = $easycleanerautoja
            GUISetState ( @SW_HIDE , -1 )
            Run("C:\EClea2_0.exe")
            WinWaitActive("EasyCleaner - InstallShield Wizard")
            Sleep("5000")
            Send("{ALTDOWN}")
            Send("{N}")
            Send("{ALTUP}")


        #include <GUIConstants.au3>
        GUICreate ( "Extreme Cleaner, gaat u akkoord met deze licentie overeenkomst?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
        $easycleanerja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
        $easycleanernee = GUICtrlCreateButton ( "Nee",  0, -1)
        GUISetState (@SW_SHOW)

         While 1
            $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    Exit
                Case $msg = $GUI_EVENT_MINIMIZE
                Case $msg = $GUI_EVENT_MAXIMIZE
   
                Case $msg = $easycleanerja
                GUISetState ( @SW_HIDE , -1 )
                Send("{ALTDOWN}")
                Send("{Y}")
                Send("{ALTUP}")
                Sleep("1000")
                Send ( "{ALTDOWN}")
                Send("C")
                Send("{ALTUP}")
                Sleep("5000")
                Send("C:\Program Files\Extreme Cleaner\EASYCLEANER")
                Send("{ENTER}")
                Sleep("1000")
                Send("{ALTDOWN}")
                Send("N")
                Send("{ALTUP}")
                Send("{ALTDOWN}")
                Send("I")
                Send("{ALTUP}")
            EndSelect
         WEnd
          EndSelect
EndIf
but it gives me the following error:

Line 84 (File "C:\Extreme Cleaner\Nieuw - AutoIt v3 Script.au2"):

EndIf

Error: "While" statement has no matching "Wend" statement.

Problem 2: How do I make the script wait until a specified control is hidden?

Help me please!

Go to This site for my best product!

Link to comment
Share on other sites

Add WEnd above the last EndIf

Thank you for the help, I have now discovered an other problem: My GUI's won't show up what means that the script downloads and installs EasyCleaner 2.0 without asking, can anybody help with this?

The updated code:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Ruben van Os <rubenvanos@gmail.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

Opt("TrayIconDebug", 1)

Opt("MouseCoordMode", 2)

$wijd=@DesktopWidth

Opt("GUICoordMode",2)

If FileExists("C:\Program Files\Extreme Cleaner\EASYCLEANER\1") Then
    TrayTip ( "Extreme Cleaner", "EasyCleaner data is gevonden.", 30 , 1)
Else
        #include <GUIConstants.au3>
        GUICreate ( "Extreme Cleaner, EasyCleaner data niet gevonden! Wilt u dit automatish downloaden en installeren?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
        $easycleanerautoja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
        $easycleanerautonee = GUICtrlCreateButton ( "Nee",  0, -1)
        GUISetState (@SW_SHOW)

        While 1
           $msg = GUIGetMsg()
           Select
               Case $msg = $GUI_EVENT_CLOSE
                 Exit
              Case $msg = $GUI_EVENT_MINIMIZE
              Case $msg = $GUI_EVENT_MAXIMIZE
   
              Case $msg = $easycleanerautoja
            GUISetState ( @SW_HIDE , -1 )
            Run("C:\EClea2_0.exe")
            WinWaitActive("EasyCleaner - InstallShield Wizard")
            Sleep("5000")
            Send("{ALTDOWN}")
            Send("{N}")
            Send("{ALTUP}")


        #include <GUIConstants.au3>
        GUICreate ( "Extreme Cleaner, gaat u akkoord met deze licentie overeenkomst?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
        $easycleanerja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
        $easycleanernee = GUICtrlCreateButton ( "Nee",  0, -1)
        GUISetState (@SW_SHOW)

         While 1
            $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    Exit
                Case $msg = $GUI_EVENT_MINIMIZE
                Case $msg = $GUI_EVENT_MAXIMIZE
   
                Case $msg = $easycleanerja
                GUISetState ( @SW_HIDE , -1 )
                Send("{ALTDOWN}")
                Send("{Y}")
                Send("{ALTUP}")
                Sleep("1000")
                Send ( "{ALTDOWN}")
                Send("C")
                Send("{ALTUP}")
                Sleep("5000")
                Send("C:\Program Files\Extreme Cleaner\EASYCLEANER")
                Send("{ENTER}")
                Sleep("1000")
                Send("{ALTDOWN}")
                Send("N")
                Send("{ALTUP}")
                Send("{ALTDOWN}")
                Send("I")
                Send("{ALTUP}")
            EndSelect
         WEnd
     EndSelect
WEnd
EndIf
Edited by Somebody Someware

Go to This site for my best product!

Link to comment
Share on other sites

You were using a style as an extended style. I made some changes to get it working using some gui handles also.

#include <GUIConstants.au3>

Opt("TrayIconDebug", 1)

Opt("MouseCoordMode", 2)

$wijd = @DesktopWidth

Opt("GUICoordMode", 2)

If FileExists(@ProgramFilesDir & "\Extreme Cleaner\EASYCLEANER\1") Then
    TrayTip("Extreme Cleaner", "EasyCleaner data is gevonden.", 30, 1)
Else
    $handle_gui_1 = GUICreate("Extreme Cleaner, EasyCleaner data niet gevonden! Wilt u dit automatish downloaden en installeren?", $wijd, 100, 0, $DS_SETFOREGROUND)
    $easycleanerautoja = GUICtrlCreateButton("Ja", 0, 0, 200, 100, -1, -1)
    $easycleanerautonee = GUICtrlCreateButton("Nee", 0, 0)
    GUISetState(@SW_SHOW, $handle_gui_1)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE

            Case $msg = $easycleanerautoja
                GUISetState(@SW_HIDE, $handle_gui_1)
                Run("C:\EClea2_0.exe")
                WinWaitActive("EasyCleaner - InstallShield Wizard")
                Sleep("5000")
                Send("{ALTDOWN}")
                Send("{N}")
                Send("{ALTUP}")


                $handle_gui_2 = GUICreate("Extreme Cleaner, gaat u akkoord met deze licentie overeenkomst?", $wijd, 100, 0, $DS_SETFOREGROUND)
                $easycleanerja = GUICtrlCreateButton("Ja", -1, -1, 200, 100, -1, -1)
                $easycleanernee = GUICtrlCreateButton("Nee", 0, -1)
                GUISetState(@SW_SHOW, $handle_gui_2)
                GUISwitch($handle_gui_2)
                
                While 1
                    $msg = GUIGetMsg()
                    Select
                        Case $msg = $GUI_EVENT_CLOSE
                            Exit
                        Case $msg = $GUI_EVENT_MINIMIZE
                        Case $msg = $GUI_EVENT_MAXIMIZE

                        Case $msg = $easycleanerja
                            GUISetState(@SW_HIDE, $handle_gui_2)
                            Send("{ALTDOWN}")
                            Send("{Y}")
                            Send("{ALTUP}")
                            Sleep("1000")
                            Send("{ALTDOWN}")
                            Send("C")
                            Send("{ALTUP}")
                            Sleep("5000")
                            Send("C:\Program Files\Extreme Cleaner\EASYCLEANER")
                            Send("{ENTER}")
                            Sleep("1000")
                            Send("{ALTDOWN}")
                            Send("N")
                            Send("{ALTUP}")
                            Send("{ALTDOWN}")
                            Send("I")
                            Send("{ALTUP}")
                    EndSelect
                WEnd
        EndSelect
    WEnd
EndIf

And please consider making use of the gui forum for gui code next time.

:P

Edited by MHz
Link to comment
Share on other sites

Use this code, I fixes several syntax errors:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Ruben van Os <rubenvanos@gmail.com>
;
; Script Function:
;    Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

Opt("TrayIconDebug", 1)
Opt("MouseCoordMode", 2)
$wijd=@DesktopWidth
Opt("GUICoordMode",2)
#include <GUIConstants.au3>


If FileExists("C:\Program Files\Extreme Cleaner\EASYCLEANER\1") Then
    TrayTip ( "Extreme Cleaner", "EasyCleaner data is gevonden.", 30 , 1)
Else
    Downloaden()
    NameThisFunction()
EndIf

Func Downloaden()
GUICreate ( "Extreme Cleaner, EasyCleaner data niet gevonden! Wilt u dit automatish downloaden en installeren?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
$easycleanerautoja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
$easycleanerautonee = GUICtrlCreateButton ( "Nee",  0, -1)
GUISetState (@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE
  
            Case $msg = $easycleanerautoja
                GUISetState ( @SW_HIDE , -1 )
                Run("C:\EClea2_0.exe")
                WinWaitActive("EasyCleaner - InstallShield Wizard")
                Sleep("5000")
                Send("{ALTDOWN}")
                Send("{N}")
                Send("{ALTUP}")
        EndSelect
    WEnd
EndFunc

Func NameThisFunction()
GUICreate ( "Extreme Cleaner, gaat u akkoord met deze licentie overeenkomst?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
$easycleanerja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
$easycleanernee = GUICtrlCreateButton ( "Nee",  0, -1)
GUISetState (@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE
  
            Case $msg = $easycleanerja
                GUISetState ( @SW_HIDE , -1 )
                Send("{ALTDOWN}")
                Send("{Y}")
                Send("{ALTUP}")
                Sleep("1000")
                Send ( "{ALTDOWN}")
                Send("C")
                Send("{ALTUP}")
                Sleep("5000")
                Send("C:\Program Files\Extreme Cleaner\EASYCLEANER")
                Send("{ENTER}")
                Sleep("1000")
                Send("{ALTDOWN}")
                Send("N")
                Send("{ALTUP}")
                Send("{ALTDOWN}")
                Send("I")
                Send("{ALTUP}")
            Case Default
                ;;;;
            EndSelect
         WEnd
EndFunc

You still have some work to do with it, I encapsulated the GUI's for reuseability.

Link to comment
Share on other sites

Use this code, I fixes several syntax errors:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Ruben van Os <rubenvanos@gmail.com>
;
; Script Function:
;    Template AutoIt script.
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here

Opt("TrayIconDebug", 1)
Opt("MouseCoordMode", 2)
$wijd=@DesktopWidth
Opt("GUICoordMode",2)
#include <GUIConstants.au3>
If FileExists("C:\Program Files\Extreme Cleaner\EASYCLEANER\1") Then
    TrayTip ( "Extreme Cleaner", "EasyCleaner data is gevonden.", 30 , 1)
Else
    Downloaden()
    NameThisFunction()
EndIf

Func Downloaden()
GUICreate ( "Extreme Cleaner, EasyCleaner data niet gevonden! Wilt u dit automatish downloaden en installeren?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
$easycleanerautoja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
$easycleanerautonee = GUICtrlCreateButton ( "Nee",  0, -1)
GUISetState (@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE
  
            Case $msg = $easycleanerautoja
                GUISetState ( @SW_HIDE , -1 )
                Run("C:\EClea2_0.exe")
                WinWaitActive("EasyCleaner - InstallShield Wizard")
                Sleep("5000")
                Send("{ALTDOWN}")
                Send("{N}")
                Send("{ALTUP}")
        EndSelect
    WEnd
EndFunc

Func NameThisFunction()
GUICreate ( "Extreme Cleaner, gaat u akkoord met deze licentie overeenkomst?" , $wijd , 100 , 0 , 0 , $DS_SETFOREGROUND, -1 , -1 )
$easycleanerja = GUICtrlCreateButton ( "Ja", -1, -1 , 200 , 100 , -1 , -1 )
$easycleanernee = GUICtrlCreateButton ( "Nee",  0, -1)
GUISetState (@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE
  
            Case $msg = $easycleanerja
                GUISetState ( @SW_HIDE , -1 )
                Send("{ALTDOWN}")
                Send("{Y}")
                Send("{ALTUP}")
                Sleep("1000")
                Send ( "{ALTDOWN}")
                Send("C")
                Send("{ALTUP}")
                Sleep("5000")
                Send("C:\Program Files\Extreme Cleaner\EASYCLEANER")
                Send("{ENTER}")
                Sleep("1000")
                Send("{ALTDOWN}")
                Send("N")
                Send("{ALTUP}")
                Send("{ALTDOWN}")
                Send("I")
                Send("{ALTUP}")
            Case Default
                ;;;;
            EndSelect
         WEnd
EndFunc

You still have some work to do with it, I encapsulated the GUI's for reuseability.

I have tried your code but the only thing it does is restarting the Installshield wizard making it crash.

Go to This site for my best product!

Link to comment
Share on other sites

You were using a style as an extended style. I made some changes to get it working using some gui handles also.

#include <GUIConstants.au3>

Opt("TrayIconDebug", 1)

Opt("MouseCoordMode", 2)

$wijd = @DesktopWidth

Opt("GUICoordMode", 2)

If FileExists(@ProgramFilesDir & "\Extreme Cleaner\EASYCLEANER\1") Then
    TrayTip("Extreme Cleaner", "EasyCleaner data is gevonden.", 30, 1)
Else
    $handle_gui_1 = GUICreate("Extreme Cleaner, EasyCleaner data niet gevonden! Wilt u dit automatish downloaden en installeren?", $wijd, 100, 0, $DS_SETFOREGROUND)
    $easycleanerautoja = GUICtrlCreateButton("Ja", 0, 0, 200, 100, -1, -1)
    $easycleanerautonee = GUICtrlCreateButton("Nee", 0, 0)
    GUISetState(@SW_SHOW, $handle_gui_1)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $GUI_EVENT_MINIMIZE
            Case $msg = $GUI_EVENT_MAXIMIZE

            Case $msg = $easycleanerautoja
                GUISetState(@SW_HIDE, $handle_gui_1)
                Run("C:\EClea2_0.exe")
                WinWaitActive("EasyCleaner - InstallShield Wizard")
                Sleep("5000")
                Send("{ALTDOWN}")
                Send("{N}")
                Send("{ALTUP}")
                $handle_gui_2 = GUICreate("Extreme Cleaner, gaat u akkoord met deze licentie overeenkomst?", $wijd, 100, 0, $DS_SETFOREGROUND)
                $easycleanerja = GUICtrlCreateButton("Ja", -1, -1, 200, 100, -1, -1)
                $easycleanernee = GUICtrlCreateButton("Nee", 0, -1)
                GUISetState(@SW_SHOW, $handle_gui_2)
                GUISwitch($handle_gui_2)
                
                While 1
                    $msg = GUIGetMsg()
                    Select
                        Case $msg = $GUI_EVENT_CLOSE
                            Exit
                        Case $msg = $GUI_EVENT_MINIMIZE
                        Case $msg = $GUI_EVENT_MAXIMIZE

                        Case $msg = $easycleanerja
                            GUISetState(@SW_HIDE, $handle_gui_2)
                            Send("{ALTDOWN}")
                            Send("{Y}")
                            Send("{ALTUP}")
                            Sleep("1000")
                            Send("{ALTDOWN}")
                            Send("C")
                            Send("{ALTUP}")
                            Sleep("5000")
                            Send("C:\Program Files\Extreme Cleaner\EASYCLEANER")
                            Send("{ENTER}")
                            Sleep("1000")
                            Send("{ALTDOWN}")
                            Send("N")
                            Send("{ALTUP}")
                            Send("{ALTDOWN}")
                            Send("I")
                            Send("{ALTUP}")
                    EndSelect
                WEnd
        EndSelect
    WEnd
EndIf

And please consider making use of the gui forum for gui code next time.

:P

Your code was great MHz only the first dialog is missing the "Nee" button

Go to This site for my best product!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...