Sign in to follow this  
Followers 0
Thrust

Install + Button help

7 posts in this topic

Hi, i have creat a GUI to install my apps :)

but the install button don't do that what i want :D

can somebody help me, pls.

THANKS!!

dim $RUN
dim $EXIT
dim $Button_1
dim $APP_CHKBOX[1]
Dim $i


#include <GUIConstants.au3>  ;this is required for a GUI to work

;This creates the inital GUI box
;To Remove any non-needed checkboxes simply remark any of the CHKBOX lines
GUICreate ("Application Launcher",580,400)
GUISetFont(14,600)
GUICtrlCreateLabel("Application Installer",10,5)
GUISetFont(9,400)

$Apps = stringsplit("Acrobat Reader 7.0.8|Lan Net Scan 3.3|Windows Service Pack 2|Windows Update Pack 2.13|VNC 4.1|VLC Media Player|WinRAR|V-Scan 7.1|V-Scan 8.13|Java 5 SP7|Windows Defender|PDF Creator 0.9|Aufräumen|FireFox|Windows GUI anpassen","|")
redim $APP_CHKBOX[$apps[0] +1]
$top = 10
for $i = 1 to $apps[0]
$top = $top + 20
$APP_CHKBOX[$i] = GUICtrlCreateCheckbox($apps[$i],10,$top) ;Checkbox 1
Next


$Button_1 = GUICtrlCreateButton ("Select All",  340, 140, 100)
$Button_2 = GUICtrlCreateButton ( "Desktop Install",  340, 180, 100)
$Button_3 = GUICtrlCreateButton ("Server Install",  340, 220, 100)
$Button_4 = GUICtrlCreateButton ( "Laptop Install",  340, 260, 100)
$Button_5 = GUICtrlCreateButton ( "Clear Checkboxes",  340, 300, 100)
$RUN = GUICtrlCreateButton("Install",10,350,120,20) ;This in the Run button
$EXIT = GUICtrlCreateButton("Exit",450,350,120,20) ;This causes the application to exit
GUISetState()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
 Case $GUI_EVENT_CLOSE
  Exit
 Case $Exit
  Exit
 Case $Button_1
  for $i = 1 to $apps[0]
   GUICtrlSetState($APP_CHKBOX[$i],$GUI_CHECKED)
  next
 Case $Button_5
  for $i = 1 to $apps[0]
   GUICtrlSetState($APP_CHKBOX[$i],$GUI_UNCHECKED)
  next
;~     Switch $Button_1
;~   For $i = 1 to 15
EndSwitch
WEnd

IF Guictrlread($app_chkbox[0]) = $GUI_CHECKED then call ("APP_1")
IF GUICtrlread($app_chkbox[1]) = $GUI_CHECKED then call ("APP_2")
IF GUICtrlread($app_chkbox[2]) = $GUI_CHECKED then call ("APP_3")
IF GUICtrlread($app_chkbox[3]) = $GUI_CHECKED then call ("APP_4")    
IF GUICtrlread($app_chkbox[4]) = $GUI_CHECKED then call ("APP_5")    
IF GUICtrlread($app_chkbox[5]) = $GUI_CHECKED then call ("APP_6")    
IF GUICtrlread($app_chkbox[6]) = $GUI_CHECKED then call ("APP_7")    
IF GUICtrlread($app_chkbox[7]) = $GUI_CHECKED then call ("APP_8")    
IF GUICtrlread($app_chkbox[8]) = $GUI_CHECKED then call ("APP_9")    
IF GUICtrlread($app_chkbox[9]) = $GUI_CHECKED then call ("APP_10")    
IF GUICtrlread($app_chkbox[10]) = $GUI_CHECKED then call ("APP_11")
IF GUICtrlread($app_chkbox[11]) = $GUI_CHECKED then call ("APP_12")
IF GUICtrlread($app_chkbox[12]) = $GUI_CHECKED then call ("APP_13")
IF GUICtrlread($app_chkbox[13]) = $GUI_CHECKED then call ("APP_14")
IF GUICtrlread($app_chkbox[14]) = $GUI_CHECKED then call ("APP_15")
Call ("END_APP") 

;Add Application here
Func APP_1() ;Acrobat 7.0.8
    MsgBox(0, "AcrobatReader get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\AdobeReader\AdbeRdr708.exe /S /v/qn","",@SW_SHOWDEFAULT)
    ProcessWaitClose("Adberdr708.exe")
EndFunc


Func APP_2();Lan Net Scan 3.3
    MsgBox(0, "LanNetScan get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Lannetscan3.3\lannetscan.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("lannetscan.exe")
EndFunc


Func APP_3();Windows Service Pack 2
    Run(@ScriptDir & "\Software\SP2\i386\update\update /passive /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("update.exe")
    MsgBox(0, "SP2 ist installiert", "SP2 ist installiert", 5)
EndFunc


Func APP_4();Windows UpdatePac 2.13
    $inifile = @ScriptDir & "\Software\Updatepack\Data\settings.ini" ;Phat 2 the Update Ini
    $titel = "Winfuture Update-Pack Silentinstaller"

    $main = GUICreate($titel, 410, 270, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))

    GUICtrlCreateGroup("", 10, 10, 390, 80)
    $lb_vers = GUICtrlCreateLabel("Version", 20, 20, 370)
    $lb_date = GUICtrlCreateLabel("Datum", 20, 40, 370)
    $lb_silent = GUICtrlCreateLabel("Silentinstaller", 20, 60, 370)

    GUICtrlCreateGroup("", 10, 90, 390, 120)
    $lb_anzahl = GUICtrlCreateLabel("", 20, 100, 40)
    $lb_file = GUICtrlCreateLabel("Datei: ", 20, 120, 370)
    $lb_description = GUICtrlCreateLabel("Beschreibung: ", 20, 150, 370, 50)

    $progress = GUICtrlCreateProgress(10, 220, 390, 40, $PBS_SMOOTH)
    $step_progress = 0

    GUISetState(@SW_SHOW, $main)
    
    ;Auslesen der settings.ini
    $num = IniRead($inifile, "Main", "Files", "")
    $vers = IniRead($inifile, "Main", "Name", "Es ist etwas schief gelaufen!")
    $date = IniRead($inifile, "Main", "Version", "Es ist etwas schief gelaufen!")

    GUICtrlSetData($lb_vers, $vers)
    GUICtrlSetData($lb_date, $date)
    GUICtrlSetData($lb_anzahl, "0/" & $num)

    ;Errechnen der Fortschrittsbalkengeschwindigkeit
    $step = 100 / $num

    ;Auslesen der einzelnen Sectionen (1-n)
    ;Gleichzeitiges setzen der Infos und ausführen des Scriptes (unsichtbar)
    For $i = 1 To $num
        $file = IniRead($inifile, "File" & $i, "File", "Es ist etwas schief gelaufen!")
        $parameter = IniRead($inifile, "File" & $i, "Parameters", "")
        $description = IniRead($inifile, "File" & $i, "Name", "Es ist etwas schief gelaufen!")
        GUICtrlSetData($lb_anzahl, $i & "/" & $num)
        GUICtrlSetData($lb_file, $file)
        GUICtrlSetData($lb_description, $description)
        RunWait(@ScriptDir & "\Software\Updatepack\Data\" & $file & " " & $parameter, @ScriptDir, @SW_HIDE)
        $step_progress = $step_progress + $step
        GUICtrlSetData($progress, $step_progress)
        Next
EndFunc


Func APP_5();VNC 4.1
    MsgBox(0, "VNC get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\VNC\VNC41.exe /silent","",@SW_SHOWDEFAULT)
    ProcessWaitClose("vnc41.exe")
    Run("regedit /s "& @ScriptDir & "\Software\VNC\VNCOptionen.reg","",@SW_SHOWDEFAULT) ;VNC Passwort und FirewallPorts
EndFunc

Func APP_6();VLC Media Player
    MsgBox(0, "VLC get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\VLC\VLC.exe /S","",@SW_SHOWDEFAULT)
EndFunc

Func APP_7();Winrar
    MsgBox(0, "WinRar get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\WinRar\wrar350d.exe /s","",@SW_SHOWDEFAULT)
    ProcessWaitClose("wrar350d.exe")
EndFunc

Func APP_8();V-Scan7.1
    Run(@ScriptDir & "\Software\VScan7.10\setup.exe /quiet /passive","",@SW_SHOWDEFAULT)
    ProcessWaitClose("setup.exe")
    Superdat()
EndFunc

Func APP_9();V-Scan 8.13
    MsgBox(0, "V-Scan8 get installed", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\VScan8.13\V-Scan8\setup.exe /passive","",@SW_SHOWDEFAULT)
    ProcessWaitClose("setup.exe")
    Run(@ScriptDir & "\Software\VScan8.13\Update8.13\setup.exe /passive","",@SW_SHOWDEFAULT)
    ProcessWaitClose("setup.exe")
    Superdat()
EndFunc

Func Superdat();Superdat vom 21.09
    Run(@ScriptDir & "\Software\VScan-Superdat\sdat4857.exe /SILENT","",@SW_SHOWDEFAULT)
EndFunc

Func APP_10();Java 5 Sp7
    Run(@ScriptDir & "\Software\Java\java.exe /S /v/qn","",@SW_SHOWDEFAULT)
    ProcessWaitClose("java.exe")    
EndFunc

Func APP_11();Windows Defender
    MsgBox(0, "Windows Defender get installed", "Bitte Warten...", 5)
    RunWait("msiexec /i WindowsDefender.msi /qb" , @ScriptDir & "\Software\WindowsDefender")
    Sleep(1500)
    WinWait("Windows Defender (Beta 2)", "Banner Panel")
    WinClose("Windows Defender (Beta 2)")
EndFunc

Func APP_12();PDF Creator 0.9
    MsgBox(0, "PDF Creator 0.9 get installed", "Bitte Warten...", 5)
    RunWait(@ScriptDir & "\Software\PDFCreator0.9\PDFCreator.msi /verysilent /norestart","",@SW_SHOWDEFAULT)
    ProcessWaitClose("PDFCreator.msi")
EndFunc

Func APP_13();Aufräumen
    MsgBox(0, "Time 2 Clean", "Bitte Warten...", 5)
    Run(@ScriptDir & "\Software\Aufraeum.bat","",@SW_SHOWDEFAULT)
    ProcessWaitClose("Aufraeum.bat")
EndFunc

Func APP_14();Firefox
    Run(@ScriptDir & "\Software\FireFox\.exe -ma","",@SW_SHOWDEFAULT)
EndFunc

Func APP_15();Windows GUI anpassen
    ; Klassisches Startmenü
    
    Run("rundll32.exe shell32.dll,Options_RunDLL 1")
    WinWait("Eigenschaften von Taskleiste und Startmenü")
    send("^{tab}")
    send("!k")
    send("{enter}")

    ; Desktop einrichten

    Run(@COMSPEC & " /c desk.cpl")
    winwait("Eigenschaften von Anzeige")
    send("{shiftdown}")
    send("{tab}")
    send("{shiftup}")
    send("{right}")
    send("!e")
    winwait("Desktopelemente")
    send("!e")
    send("!i")
    send("!r")
    send("!d")
    send("{enter}")
    winwait("Eigenschaften von Anzeige")
    send("{enter}")
EndFunc

Func APP_16(); Selectall
$title = "Application Launcher"
ControlClick("$title")

EndFunc


Func END_APP()
    MsgBox(4096,"Complete","All Selected Applications Installed")
EndFunc

Share this post


Link to post
Share on other sites



But the $RUN button isn't used anywhere is it?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

yeah but how can i make that the if the cheakbox is cheaked and i press install the functions starts?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

...
 Case $RUN
  for $i = 1 to $apps[0]
   If IsChecked($APP_CHKBOX[$i]) Then RunWait($apps[$i])
  next
...
  
Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFuncoÝ÷ Ù±!?Û¬y«­¢+Ø%%Í
¡­ ÀÌØíAA}
!-  =alÀÌØí¥t¤Q¡¸
±° ÅÕ½ÐíÁÁ|ÅÕ½ÐìµÀìÀÌØí¤

Edited by Zedna

Share this post


Link to post
Share on other sites

...
 Case $RUN
  for $i = 1 to $apps[0]
   If IsChecked($APP_CHKBOX[$i]) Then RunWait($apps[$i])
  next
...
  
Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFuncoÝ÷ Ù±!?Û¬y«­¢+Ø%%Í
¡­ ÀÌØíAA}
!-  =alÀÌØí¥t¤Q¡¸
±° ÅÕ½ÐíÁÁ|ÅÕ½ÐìµÀìÀÌØí¤
can you pls. post where i must set the code or copy my code and edit the code and post again here :)

sry but i am a beginner :D

Share this post


Link to post
Share on other sites

can you pls. post where i must set the code or copy my code and edit the code and post again here :)

sry but i am a beginner :D

your upper code :

dim $RUN
dim $EXIT
dim $Button_1
dim $APP_CHKBOX[1]
Dim $i


#include <GUIConstants.au3>  ;this is required for a GUI to work

;This creates the inital GUI box
;To Remove any non-needed checkboxes simply remark any of the CHKBOX lines
GUICreate ("Application Launcher",580,400)
GUISetFont(14,600)
GUICtrlCreateLabel("Application Installer",10,5)
GUISetFont(9,400)

$Apps = stringsplit("Acrobat Reader 7.0.8|Lan Net Scan 3.3|Windows Service Pack 2|Windows Update Pack 2.13|VNC 4.1|VLC Media Player|WinRAR|V-Scan 7.1|V-Scan 8.13|Java 5 SP7|Windows Defender|PDF Creator 0.9|Aufräumen|FireFox|Windows GUI anpassen","|")
redim $APP_CHKBOX[$apps[0] +1]
$top = 10
for $i = 1 to $apps[0]
$top = $top + 20
$APP_CHKBOX[$i] = GUICtrlCreateCheckbox($apps[$i],10,$top) ;Checkbox 1
Next


$Button_1 = GUICtrlCreateButton ("Select All",  340, 140, 100)
$Button_2 = GUICtrlCreateButton ( "Desktop Install",  340, 180, 100)
$Button_3 = GUICtrlCreateButton ("Server Install",  340, 220, 100)
$Button_4 = GUICtrlCreateButton ( "Laptop Install",  340, 260, 100)
$Button_5 = GUICtrlCreateButton ( "Clear Checkboxes",  340, 300, 100)
$RUN = GUICtrlCreateButton("Install",10,350,120,20) ;This in the Run button
$EXIT = GUICtrlCreateButton("Exit",450,350,120,20) ;This causes the application to exit
GUISetState()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
 Case $GUI_EVENT_CLOSE
  Exit
 Case $Exit
  Exit
 Case $Button_1
  for $i = 1 to $apps[0]
   GUICtrlSetState($APP_CHKBOX[$i],$GUI_CHECKED)
  next
 Case $Button_5
  for $i = 1 to $apps[0]
   GUICtrlSetState($APP_CHKBOX[$i],$GUI_UNCHECKED)
  next
;~     Switch $Button_1
;~   For $i = 1 to 15
EndSwitch
WEnd
oÝ÷ ٩ݶ§i×_ºw-ìºeç[ɨ§Ê«{-jY[ºÛh¨v^vv¬r^jëh×6for $i = 1 to $apps[0]
   If IsChecked($APP_CHKBOX[$i]) Then RunWait($apps[$i])
  next

should work .....

Share this post


Link to post
Share on other sites

Thrust, thanks for posting your work. I'm trying to modify your script to suit my needs for Post imaging installs. You have created a much nicer control. Where I was simply stitching multiple installs together, your example lets me use the boxes to pick individual apps, instead of loading the whole lot.

However, ScriptUSER -

You lost me on this. Looks like I am able to run the first app checked, but when it finishes it loops back and starts the first app again, instead of going to the next one checked.

I've played with it for a while, but I know when I should stop messing with the stuff that works and ask for help.

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