Sign in to follow this  
Followers 0
nickp

Order of execution

4 posts in this topic

Hi

I'm pretty new with AutoIT. And no programming skills...

So far i managed to make a script with checkboxes, if a checkbox is enabled the script needs to be executed. If multiple checkboxes are selected, they need to start one after the other.

Problem is that if i select a checkbox on the left side and the rightside, they are started on the same moment, resulting with installation errors..

#RequireAdmin
;===============================================================================
;
; Description:      Fix IT Solutions Installer
; Syntax:           beta2.au3
; Parameter(s):     none
; Requirement(s):   AutoIT
; Return Value(s):  Logfile
; Author(s):        Nick Pieters
; Last Modified:    04/02/2010
;
;===============================================================================
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\nick.fixitsolutions\desktop\test\beta\form1_1.kxf
Global $Form1_1 = GUICreate("Form1", 675, 456, 464, 312)
Global $Label1 = GUICtrlCreateLabel("Selecteer de programma's die geïnstalleerd moeten worden ...", 16, 8, 548, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Tahoma")
Global $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 24, 66, 17, 17)
Global $Label2 = GUICtrlCreateLabel("Adobe Reader 9.3", 51, 66, 129, 17)
Global $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 24, 81, 17, 17)
Global $Label3 = GUICtrlCreateLabel("Firefox 3.6", 51, 81, 129, 17)
Global $button1 = GUICtrlCreateButton("Start", 152, 416, 297, 25, $WS_GROUP)
Global $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 24, 96, 17, 17)
Global $Label4 = GUICtrlCreateLabel("Flash Player IE", 51, 96, 129, 17)
Global $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 24, 111, 17, 17)
Global $Label5 = GUICtrlCreateLabel("Flash Player Firefox", 51, 111, 129, 17)
Global $jav = GUICtrlCreateCheckbox("java", 24, 126, 17, 17)
Global $Java = GUICtrlCreateLabel("Java", 51, 126, 129, 17)
Global $fileformatcheck = GUICtrlCreateCheckbox("Fileformat converters Office 2007", 24, 141, 17, 17)
Global $Fileformatconv = GUICtrlCreateLabel("Fileformat converters Office 2007", 51, 141, 200, 17)
Global $carpedie = GUICtrlCreateCheckbox("carpediem", 432, 68, 17, 17)
Global $CarpeDiem = GUICtrlCreateLabel("Carpe Diem", 459, 68, 129, 17)
Global $win2pdfcheck = GUICtrlCreateCheckbox("win2pdf", 432, 83, 17, 17)
Global $Win2PDF = GUICtrlCreateLabel("Win2PDF", 459, 83, 129, 17)
Global $navisionztm = GUICtrlCreateCheckbox("navisionztm", 432, 98, 17, 17)
Global $Navision = GUICtrlCreateLabel("Navision Zoutman", 458, 98, 129, 17)
Global $Label10 = GUICtrlCreateLabel("Standaard applicaties", 24, 40, 127, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
Global $Label11 = GUICtrlCreateLabel("Clewatra", 461, 38, 55, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
Global $win2p = GUICtrlCreateCheckbox("IETS ANDERS", 432, 113, 17, 17)
Global $Label6 = GUICtrlCreateLabel("IETS ANDERS", 458, 113, 129, 17)
Global $navdesote = GUICtrlCreateCheckbox("navdesotec", 432, 128, 17, 17)
Global $navdesotec = GUICtrlCreateLabel("Navision Desotec", 458, 128, 144, 17)
Global $office2003 = GUICtrlCreateCheckbox("office2003", 432, 143, 17, 17)
Global $Office = GUICtrlCreateLabel("Office 2003", 459, 143, 144, 17)
Global $office2007check = GUICtrlCreateCheckbox("office2007", 432, 158, 17, 17)
Global $office2007lbl = GUICtrlCreateLabel("Office 2007", 459, 158, 144, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button1
            $fSelected = False
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
                ; Define $Adobereader
                $Adobereader = "Adobereader.exe /sPB /rs"
                ; Run installer
                Run($Adobereader)
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
                ; Define $FireFox
                $FireFox = "Firefox_Setup_3_6.exe -ms"
                ; Run installer
                Run($FireFox)
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) Then
                ; Define $flashie
                $flashie = "flashie.exe /S"
                ; Run installer
                Run($flashie)
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($Checkbox4), $GUI_CHECKED) Then
                ; Define $flashff
                $flashff = "flashff.exe /S"
                ; Run installer
                Run($flashff)
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($fileformatcheck), $GUI_CHECKED) Then
                $installfileformatcon = "FileFormatConverters.exe /quiet /passive /norestart"
                Run($installfileformatcon)
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($win2pdfcheck), $GUI_CHECKED) Then
                Run("w2pdf_setup.exe")
                WinWait("Setup - Win2PDF", "Click Next to continue, or Cancel to exit Setup.")
                ControlClick("Setup - Win2PDF", "Click Next to continue, or Cancel to exit Setup.", "&Next >")
                WinWait("Setup - Win2PDF", "License Agreement")
                ControlClick("Setup - Win2PDF", "License Agreement", "I &accept the agreement")
                ControlClick("Setup - Win2PDF", "License Agreement", "&Next >")
                WinWait("Setup - Win2PDF", "Win2PDF Font Helper add-on")
                ControlClick("Setup - Win2PDF", "Win2PDF Font Helper add-on", "&Download and install the Win2PDF Font Helper add-on now")
                ControlClick("Setup - Win2PDF", "Win2PDF Font Helper add-on", "&Next >")
                WinWait("Setup - Win2PDF", "Ready to Install")
                ControlClick("Setup - Win2PDF", "Ready to Install", "&Install")
                WinWait("Setup - Win2PDF", "Information")
                ControlClick("Setup - Win2PDF", "Information", "&Next >")
                WinWait("Setup - Win2PDF", "Completing the Win2PDF Setup Wizard")
                ControlClick("Setup - Win2PDF", "Completing the Win2PDF Setup Wizard", "&Finish")
                ProcessClose("hh.exe")
                Run("C:\Windows\System32\spool\drivers\w32x86\3\WIN2PDF.EXE")
                WinWait("Dane Prairie Systems LLC", "Enter License Code")
                Sleep(100)
                ControlClick("Dane Prairie Systems LLC", "Enter License Code", "Enter License Code")
                Sleep(100)
                Send("{TAB}{TAB}")
                Sleep(100)
                Send("Clewatra {tab}")
                Sleep(100)
                Send("Clewatra {tab}")
                Sleep(100)
                Send("xxxxxxxxxxxxxxxxxxxx")
                Sleep(100)
                Send("{TAB} {ENTER}")
                $fSelected = True
            EndIf

            If BitAND(GUICtrlRead($jav), $GUI_CHECKED) Then
                Run("java.exe /qb IEXPLORER=1 REBOOT=Suppress WEBSTARTICON=0 JAVAUPDATE=0 SYSTRAY=0")
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($office2003), $GUI_CHECKED) Then
                Run("office2003\setup.exe")
                WinWait("Microsoft Office 2003 Setup", "Product Key")
                Sleep(50)
                Send("xxxx")
                Sleep(50)
                Send("xxxx")
                Sleep(50)
                Send("xxxx")
                Sleep(50)
                Send("xxxx")
                Sleep(50)
                Send("xxxx")
                Sleep(100)
                ControlClick("Microsoft Office 2003 Setup", "Product Key", "V&olgende >")
                WinWait("Microsoft Office 2003 Setup", "Gebruikersgegevens")
                Send("Clewatra{TAB}{TAB}")
                Send("Clewatra")
                ControlClick("Microsoft Office 2003 Setup", "Gebruikersgegevens", "V&olgende >")

                WinWait("Microsoft Office 2003 Setup", "Gebruiksrechtovereenkomst")
                ControlClick("Microsoft Office 2003 Setup", "Gebruiksrechtovereenkomst", "Button1")
                ControlClick("Microsoft Office 2003 Setup", "Gebruiksrechtovereenkomst", "V&olgende >")
                ControlClick("Microsoft Office 2003 Setup", "Gebruiksrechtovereenkomst", "Wor&d")

                WinWait("Microsoft Office 2003 Setup", "Type installatie")
                ControlClick("Microsoft Office 2003 Setup", "Type installatie", "&Aangepaste installatie")
                ControlClick("Microsoft Office 2003 Setup", "Type installatie", "V&olgende >")
                WinWait("Microsoft Office 2003 Setup", "Aangepaste installatie")
                ControlClick("Microsoft Office 2003 Setup", "Aangepaste installatie", "Pu&blisher")
                ControlClick("Microsoft Office 2003 Setup", "Aangepaste installatie", "V&olgende >")

                WinWait("Microsoft Office 2003 Setup", "Overzicht")
                ControlClick("Microsoft Office 2003 Setup", "Overzicht", "&Installeren")
                WinWait("Microsoft Office 2003 Setup", "Setup is voltooid")
                ControlClick("Microsoft Office 2003 Setup", "Setup is voltooid", "&Voltooien")
                $fSelected = True
            EndIf
            If BitAND(GUICtrlRead($office2007check), $GUI_CHECKED) Then
                Run("office2007\setup.exe /adminfile clewatra.msp")
                $fSelected = True
            EndIf
            If $fSelected = False Then MsgBox(0, "error", "Nothing was selected!")
            ;### Tidy Error -> "endswitch" is closing previous "while" on line 41
    EndSwitch
WEnd

See attached file program.jpg.

Could someone help me out so everything works like it should?

Thx!

post-55799-12657142040178_thumb.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

to simply fix your problem, use the command "RunWait" instead of Run

From personal experience, there is also a slightly better way to do this...

if you use ShellExecuteWait(Executblepath, Parameters), then vista will not ask you for permission to have the programs have admin privlages needed for install.

One more thing, I noticed that you have separate IE and Firefox flash installers. Adobe does release a combined installer somewhere that may save you some effort.

Edit: Typo

Edited by NerdFencer

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Share this post


Link to post
Share on other sites

they are started on the same moment

You could try to replace the Run() with RunWait(). The Script will wait, until the Setup of your Program is finished.

Share this post


Link to post
Share on other sites

Thx to both of you! Glad there's an active community helping the new users...

Nerdfencer, have you some kind of source for that?

thx again!

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