Jump to content

My first script - What can i do better the next time?


Recommended Posts

Hello,

i'm an absolute newbie to AutoIt3. I also don't realy know an other programming language.

So i tried to write my first AutoIt3 Script and here you can see the result :whistle:

It's an automatic installer for Office 2003 - German Edition.

The User can choose in a Gui the componets which should be installed.

You have to know that Office2003.exe is a selfextrakting Rar archiv.

I would be happy if someone could habe a look on the code and perhaps give me some hinds what i could do better the next time or if there are big mistakes.

The script works fine for me but i'm sure there is enough space for improvements. :)

It's for me learning by doing...

#include <GUIConstants.au3>


$alreadyinstalled = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Common\InstallRoot", "Path")

If $alreadyinstalled <> "" Then 
    $currentofficepath = StringTrimRight($alreadyinstalled, 9) 
    MsgBox(0, "Office 2003 ist bereits installiert", "Es wurde eine installierte Version von Office 2003 in" & @CRLF & $currentofficepath & " gefunden!" & @CRLF & "Bitte deinstallieren Sie zuerst die gefundene Version," & @CRLF & "um dieses Programm auszuführen.") 
    exit 
EndIf 



$startfrage= MsgBox(1, "Office 2003 Installation", "Dieses Programm installiert Office 2003 automatisiert." & @CRLF & "Während des Setups sind Maus und Tastatur deaktiviert." & @CRLF & "Über den Abschluss der Neuinstallation werden Sie benachrichtigt.", 30)
if $startfrage = 2 Then
    exit
endif
      

$E="Nein"
$P="Nein"
$A="Nein"
$O="Nein"
$I="Nein"
$W="Nein"
$Pu="Nein"

$Countdown = 60

$finalfolder = "c:\temp\Office2003" 
$install = "c:\Programme\Microsoft Office 2003" 
$finalinstall = "c:\Programme\Microsoft Office 2003" 


$Timer = TimerInit()


GUICreate("Komponentenauswahl", 250, 350) 

GUICtrlCreateLabel ("Welche Komponenten sollen installiert werden?",  10, 10, 500) 
GUICtrlCreateLabel ("Speicherort für temporäre Dateien wählen:",  10, 130, 500) 
GUICtrlCreateLabel ("Pfad für die Office 2003 installation wählen:",  10, 220, 500) 


$Word2003 = GUICtrlCreateCheckbox ("Word 2003", 10, 30, 120, 20) 
$Excel2003 = GUICtrlCreateCheckbox ("Excel 2003", 10, 50, 120, 20)
$PP2003 = GUICtrlCreateCheckbox ("PowerPoint 2003", 10, 70, 120, 20)
$Access2003 = GUICtrlCreateCheckbox ("Access 2003", 150, 30, 120, 20)
$Outlook2003 = GUICtrlCreateCheckbox ("Outlook 2003", 150, 50, 120, 20)
$Infopath = GUICtrlCreateCheckbox ("Infopath 2003", 150, 70, 120, 20) 
$Publisher2003 = GUICtrlCreateCheckbox ("Publisher 2003", 10, 90, 120, 20)

$tempdir = GUICtrlCreateInput ( $finalfolder, 10,  150, 200, 20) 
GUICtrlSetTip(-1,"Speicherort für temporäre Dateien manuell eingeben")
$folder = GUICtrlCreateButton ("Ordner wechseln", 85, 180)
GUICtrlSetTip(-1,"Ändert den Speicherort für die temporären Dateien")


$install_input = GUICtrlCreateInput ( $install, 10,  240, 200, 20) 
GUICtrlSetTip(-1,"Office 2003 Installationsort manuell eingeben")
$install = GUICtrlCreateButton ("Ordner wechseln", 85, 270) 
GUICtrlSetTip(-1,"Ändert den Installationsort für Office 2003")

$weiter = GUICtrlCreateButton("Weiter " & $Countdown, 85, 320, 88, 25)
GUICtrlSetTip(-1,"Mit der Installation beginnen")
$info = GUICtrlCreateButton("Info", 220, 335, 30, 15)
GUICtrlSetTip(-1,"Info-Fenster aufrufen")

GUICtrlSetState ($Word2003, 1)
GUICtrlSetState ($Excel2003, 1) 
GUICtrlSetState ($PP2003, 1) 

GUISetState ()  



While 1 
    $TimeDiff = TimerDiff($Timer) 
    $msg = GUIGetMsg() 
    
    If $msg = $folder Then 
        $finalfolder = FileselectFolder ("Ordner Wählen:", "", 1) 
        GUICtrlSetData($tempdir,$finalfolder) 
    EndIf 
    
    If $msg = $install Then 
        $finalinstall = FileselectFolder ("Ordner Wählen:", "", 1) 
        GUICtrlSetData($install_input,$finalinstall) 
    EndIf 
    
    If $finalfolder = "" Then  
        $FinalFolder = "c:\temp\Office2003" 
        GUICtrlSetData($tempdir,$finalfolder)
    EndIf 
    
    If $finalinstall = "" Then  
        $finalinstall = "c:\Programme\Microsoft Office 2003" 
        GUICtrlSetData($install_input,$finalinstall) 
    EndIf 
    
    
    $Countdowntemp = Round($TimeDiff, -1) 
    $Countdowntemp2 = StringTrimRight($Countdowntemp, 3)
    $countdown = "Weiter (" & 60 - $Countdowntemp2 & ")"
            
    GUICtrlSetData($weiter, $Countdown) 
    
    If $msg = $info Then
        MsgBox (0, "Info", "Office 2003 Auto-Installer" & @CRLF & "(C) SpecialK, Cooperation" & @CRLF)
        EndIf
        
    If $TimeDiff > 2000 Then 
        $endcountdown= msgbox (1, "Bestätigung", "Fortfahren und ausgewählte Komponenten installieren?", 10) 
        If $endcountdown = 2 Then Exit 
            $msg = $weiter 
        EndIf 
        
        If $msg = $GUI_EVENT_CLOSE Then Exit 
    
    If $msg = $weiter Then ExitLoop 
    Wend 
    
            


    
If GUICtrlRead ($Word2003) = $GUI_CHECKED Then
        $W="Ja"
endif

If GUICtrlRead ($Excel2003) = $GUI_CHECKED Then
        $E="Ja"
endif

If GUICtrlRead ($PP2003) = $GUI_CHECKED Then
        $P="Ja"
endif

If GUICtrlRead ($Access2003) = $GUI_CHECKED Then
        $A="Ja"
endif

If GUICtrlRead ($Outlook2003) = $GUI_CHECKED Then
        $O="Ja"
endif

If GUICtrlRead ($Infopath) = $GUI_CHECKED Then
        $I="Ja"
endif
    
If GUICtrlRead ($Publisher2003) = $GUI_CHECKED Then
        $Pu="Ja"
endif

$tempdir2 = GUICtrlRead($tempdir) 
$install_input2 = GUICtrlRead($install_input) 
GUIDelete() 

BlockInput(1) 


DirCreate ($tempdir2 & "\Office2003\Quelldatei") 
$space = DriveSpaceFree( $tempdir2 ) 
$spacemb= Round($space, -1)

if $spacemb < 1000 Then
    BlockInput(0)
    MsgBox(0, "Speicherplatz zu gering!", "Der freie Festplattenplatz beträgt " & $spacemb & " MB." & @CRLF & "Für die Installation werden mindestens 1000 MB benötigt." & @CRLF & "Bitte schaffen sie freien Speicherplatz oder installieren Sie einzelne Komponenten manuell.") 
    Exit 
EndIf 

SplashTextOn("Bitte warten", "Benötigte Dateien werden kopiert"    ,400, 50) 



FileInstall ("c:\AutoIt\old\Office2003.exe", $tempdir2 & "\Office2003\Quelldatei\Office2003.exe", 1) 
SplashOff() 
SplashTextOn("Bitte warten", "Dateien werden entpackt" ,400, 50) 


run ($tempdir2 & "\Office2003\Quelldatei\Office2003.exe") 
WinWaitActive ("Selbstentpackendes WinRAR-Archiv", "&Zielverzeichnis")
ControlSend ("Selbstentpackendes WinRAR-Archiv", "&Zielverzeichnis" , 1001 , "^a" & $tempdir2 & "\Office2003") 

ControlClick ("Selbstentpackendes WinRAR-Archiv", "&Zielverzeichnis", 1)
WinWaitClose ("Selbstentpackendes WinRAR-Archiv") 
SplashOff() 
SplashTextOn("Bitte warten", "Office 2003 wird installiert" ,400, 50) 

sleep (10000) 
DirRemove ($tempdir2 & "\Quelldatei", 1)


run ($tempdir2 & "\Office2003\SETUPPRO.EXE") 

WinWaitActive ("Microsoft Office 2003-Setup", "Geben Sie unten in")


Send ("1234")
ControlSend ("Microsoft Office 2003-Setup", "Geben Sie unten in", 2, "abcd")
ControlSend ("Microsoft Office 2003-Setup", "Geben Sie unten in", 4, "efgh")
ControlSend ("Microsoft Office 2003-Setup", "Geben Sie unten in", 6, "ihkl")
ControlSend ("Microsoft Office 2003-Setup", "Geben Sie unten in", 8, "mnop")
Controlclick ("Microsoft Office 2003-Setup", "&Weiter >", "Button1")


WinWaitActive ("Microsoft Office 2003-Setup", "&Benutzername")
Send ("MyName {TAB} {TAB} MyCompany")
Controlclick ("Microsoft Office 2003-Setup", "&Weiter >", "Button1")
WinWaitActive ("Microsoft Office 2003-Setup", "Um die Office-Installation")
Controlclick ("Microsoft Office 2003-Setup", "Ich &stimme den Bedingungen des Lizenzvertrags zu.", "Button1")
Controlclick ("Microsoft Office 2003-Setup", "&Weiter >", "Button3")
WinWaitActive ("Microsoft Office 2003-Setup", "&Typische Installation")
Controlclick ("Microsoft Office 2003-Setup", "&Benutzerdefinierte Installation", "Button5")
Controlclick ("Microsoft Office 2003-Setup", "", 5046)
ControlSend ("Microsoft Office 2003-Setup" , "&Typische Installation" , 5046 , "^a" & $install_input2)


Controlclick ("Microsoft Office 2003-Setup", "&Weiter >", "Button7")


WinWaitActive ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen")

If $O == "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 651, "Check")
    Else 
        ControlCommand  ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 651, "UnCheck")
EndIf

If $Pu = "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 653, "Check")
    Else
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 653, "UnCheck")
EndIf

If $A = "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 648, "Check")
    Else
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 648, "UnCheck")
EndIf

If $I = "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 655, "Check")
    Else
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 655, "UnCheck")
EndIf

If $P = "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 652, "Check")
    Else
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 652, "UnCheck")
EndIf

If $E = "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 650, "Check")
    Else
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 650, "UnCheck")
EndIf

If $W = "Ja" Then
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, "Check")
    Else
        ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, "UnCheck")
    EndIf
    
 

Controlclick ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 4879)


WinWaitActive ("Microsoft Office 2003-Setup", "&Installieren")
Controlclick ("Microsoft Office 2003-Setup", "&Installieren", 4879)
WinWaitActive ("Microsoft Office 2003-Setup", "Microsoft Office 2003-Setup wurde erfolgreich")
Controlclick ("Microsoft Office 2003-Setup", "Microsoft Office 2003-Setup wurde erfolgreich", 5016)
SplashOff()
Blockinput(0)

MsgBox (0, "Installation erfolgreich", "Office 2003 wurde erfolgreich installiert.")

sleep(10000)
DirRemove ($tempdir2 & "\Office2003", 1)
Link to comment
Share on other sites

In GUI Loop use this concept (with functions):

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $button1
         SomeFunc1()
      Case $msg = $button2
         SomeFunc2()
   EndSelect
WEnd

It's much more readable.

Edited by Zedna
Link to comment
Share on other sites

If $W = "Ja" Then

ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, "Check")

Else

ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, "UnCheck")

EndIf

If $W = "Ja" Then
    $pom_check = "Check"
Else
    $pom_check = "UnCheck"
EndIf
ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, $pom_check)
Link to comment
Share on other sites

If $W = "Ja" Then
    $pom_check = "Check"
Else
    $pom_check = "UnCheck"
EndIf
ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, $pom_check)
oÝ÷ Ûú®¢×)»­Â¦jG¢¶j+&¦W±¶§ç²Æ«ÉhrcºËlzÝ7èû´ß 4ߢµËh¶¯j[ªê-
«¨¶êºT(^rJ®¢Ö§vØ^Ú-+ºÚ"µÍÛÛÛÛÛ[X[
    ][ÝÓZXÜÜÛÙÙXÙHËTÙ]    ][ÝË  ][ÝÕù[ÚYHYHZXÜÜÛÙÙXÙHËP[Ù[[Ù[][ÝË
LË ][ÝÐÚXÚÉ][ÝÊBÛÛÛÛÛ[X[
    ][ÝÓZXÜÜÛÙÙXÙHËTÙ]    ][ÝË  ][ÝÕù[ÚYHYHZXÜÜÛÙÙXÙHËP[Ù[[Ù[][ÝË
    ][ÝÐÚXÚÉ][ÝÊBÛÛÛÛÛ[X[
    ][ÝÓZXÜÜÛÙÙXÙHËTÙ]    ][ÝË  ][ÝÕù[ÚYHYHZXÜÜÛÙÙXÙHËP[Ù[[Ù[][ÝË
MK  ][ÝÐÚXÚÉ][ÝÊB]Ë

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Hello,

i'm an absolute newbie to AutoIt3. I also don't realy know an other programming language.

So i tried to write my first AutoIt3 Script and here you can see the result :)

It's an automatic installer for Office 2003 - German Edition.

The User can choose in a Gui the componets which should be installed.

You have to know that Office2003.exe is a selfextrakting Rar archiv.

I would be happy if someone could habe a look on the code and perhaps give me some hinds what i could do better the next time or if there are big mistakes.

The script works fine for me but i'm sure there is enough space for improvements. :)

It's for me learning by doing...

Welcome to AutoIT! :whistle:

In the following parts, avoid language specific binary "Yes/No", "Da/Nyet", "Ja/Nein", and just go with 0 and 1. Also, these variables are completely unnecesary, since you don't have to destroy the gui, just hide it. So instead of these parts:

;...

$E="Nein"
$P="Nein"
$A="Nein"
$O="Nein"
$I="Nein"
$W="Nein"
$Pu="Nein"

;...

If GUICtrlRead ($Word2003) = $GUI_CHECKED Then
    $W="Ja"
endif

If GUICtrlRead ($Excel2003) = $GUI_CHECKED Then
    $E="Ja"
endif

If GUICtrlRead ($PP2003) = $GUI_CHECKED Then
    $P="Ja"
endif

If GUICtrlRead ($Access2003) = $GUI_CHECKED Then
    $A="Ja"
endif

If GUICtrlRead ($Outlook2003) = $GUI_CHECKED Then
    $O="Ja"
endif

If GUICtrlRead ($Infopath) = $GUI_CHECKED Then
    $I="Ja"
endif
    
If GUICtrlRead ($Publisher2003) = $GUI_CHECKED Then
    $Pu="Ja"
endif

; ...

GUIDelete() 

; ...

If $O == "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 651, "Check")
Else 
    ControlCommand  ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 651, "UnCheck")
EndIf

If $Pu = "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 653, "Check")
Else
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 653, "UnCheck")
EndIf

If $A = "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 648, "Check")
Else
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 648, "UnCheck")
EndIf

If $I = "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 655, "Check")
Else
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 655, "UnCheck")
EndIf

If $P = "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 652, "Check")
Else
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 652, "UnCheck")
EndIf

If $E = "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 650, "Check")
Else
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 650, "UnCheck")
EndIf

If $W = "Ja" Then
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, "Check")
Else
    ControlCommand ("Microsoft Office 2003-Setup", "Wählen Sie die Microsoft Office 2003-Anwendungen", 654, "UnCheck")
EndIf
oÝ÷ Ù.r¥uÚ-+ºÚ"µÍÈÕRTÙ]Ý]JÕ×ÒYJHÈÌÍÕÚ[Õ]HH    ][ÝÓZXÜÜÛÙÙXÙHËTÙ]    ][ÝÂÌÍÕÚ[Õ^H ][ÝÕù[ÚYHYHZXÜÜÛÙÙXÙHËP[Ù[[Ù[][ÝÂ[H  ÌÍÐÚXÚÜÖÍ×VÌHHÉÌÍÓÝ]ÛÚÌË ÌÍÔXÚË ÌÍÐXØÙÜÌË   ÌÍÒ[Ü]  ÌÍÔË    ÌÍÑ^Ù[Ë    ÌÍÕÛÜ×VÍLK
LË

MK
L
L
MBÜ    ÌÍØÈHÈ
RYÕRPÝXY
    ÌÍÐÚXÚÜÖÉÌÍØ×VÌJHH ÌÍÑÕRWÐÒPÒÑQ[BIÌÍÐÚXÚÐÛYH    ][ÝÐÚXÚÉ][ÝÂQ[ÙBBIÌÍÐÚXÚÐÛYH ][ÝÕ[ÚXÚÉ][ÝÂQ[YPÛÛÛÛÛ[X[
    ÌÍÕÚ[Õ]K   ÌÍÕÚ[Õ^    ÌÍÐÚXÚÜÖÉÌÍØ×VÌWK  ÌÍÐÚXÚÐÛY
B^

This way, you read the required values straight off the GUI, since there is no need to store that as variables. The 2D array $Checks lists the Gui controls to read from your GUI and the control to change on the installer. Also isolated the long window title and text into their own variables to make it easier to read.

:lmao:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Welcome to AutoIT! :whistle:

In the following parts, avoid language specific binary "Yes/No", "Da/Nyet", "Ja/Nein", and just go with 0 and 1. Also, these variables are completely unnecesary, since you don't have to destroy the gui, just hide it. So instead of these parts:

.

.

.

This way, you read the required values straight off the GUI, since there is no need to store that as variables. The 2D array $Checks lists the Gui controls to read from your GUI and the control to change on the installer. Also isolated the long window title and text into their own variables to make it easier to read.

:)

Hello,

that looks very good. But there is one problem: I don't understand it at all. (I've checked already the manual) And i don't want to copy a code without understanding is. Is it possible for you to explain your second code-sample line by line?

Thank you,

SpecialK

Link to comment
Share on other sites

Hello,

that looks very good. But there is one problem: I don't understand it at all. (I've checked already the manual) And i don't want to copy a code without understanding is. Is it possible for you to explain your second code-sample line by line?

Thank you,

SpecialK

Sure...

GUISetState(@SW_Hide)

I changed your GuiDelete to simply hide the GUI, allowing you to read the conditions of the controls directly from it, instead of saving them to variables.

$Win_Title = "Microsoft Office 2003-Setup"
$Win_Text = "Wählen Sie die Microsoft Office 2003-Anwendungen"

These two lines just take the long, cumbersome strings and make them easier to read variables. Doesn't improve functionality, just readability and maintainability. Any time you find youself typing the same long thing over and over again, consider replacing it with a variable.

Dim $Checks[7][2] = [$Outlook2003, $Publisher2003, $Access2003, $Infopath, $PP2003, $Excel2003, $Word2003][651, 653, 648, 655, 652, 650, 654]

This line declares a 2-dimensional array (or table) with 7 rows (0 thru 6) and 2 colums (0 and 1), and prefills it for each row with the ControlID of your GUI control in column 0, and the matching ControlID in the installer in column 1. So, for instance, in row 0, you get the controlID for $Outlook2003 from column 0 and the ControlID of 651 to check/uncheck from column 1. Moving on to row 1, we get $Publisher2003 and 653, etc..., to row 6, where you get $Word2003 and 654.

We can represent the array this way:

Row ........ Col-0 ....... Col-1
 0      $Outlook2003       651
 1      $Publisher2003   653
 2      $Access2003     648
 3      $Infopath         655
 4      $PP2003         652
 5      $Excel2003       650
 6      $Word2003         654

For $c = 0 To 6
    If GUICtrlRead ($Checks[$c][0]) = $GUI_CHECKED Then
        $CheckCmd = "Check"
    Else
        $CheckCmd = "Uncheck"
    EndIf
    ControlCommand ($Win_Title, $Win_Text, $Checks[$c][1], $CheckCmd)
Next

This is a For/Next loop that goes through the 2D array, one row at a time, and for each row:

a - reads your GUI's ControlID (from column-0)

b - set the variable $CheckCmd to either "Check" or "Uncheck" as appropriate

c - performs a ControlCommand() on the ControlID in the installer GUI (from column-1), giving the command to check or uncheck it.

Hope that helps! :whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thank you very much for your explanation.

Now i think i understand how to handle with the array.

But i'm not able to get this to work.

When i use your code i get this error message when the array function in the script is reached:

SpecialK

Link to comment
Share on other sites

Thank you very much for your explanation.

Now i think i understand how to handle with the array.

But i'm not able to get this to work.

When i use your code i get this error message when the array function in the script is reached:

SpecialK

I can't test at the moment to see if it throws exactly that error, but there should be no space between the name of the array ($Checks) and the dimension indexes ([7][2]). I'll check it from a Windows box later.

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...