Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Progress bar during installation


  • Please log in to reply
8 replies to this topic

#1 curiouslearner

curiouslearner

    Seeker

  • Active Members
  • 10 posts

Posted 12 January 2011 - 07:05 PM

I'm trying to have a progress bar track progress while its installing everything that was selected.
It's not working, what am i doing wrong?

Plain Text         
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5, $Checkbox6, $Checkbox7 Global $Radio1, $Radio2, $Radio3, $Radio4, $Radio5, $Radio6, $Radio7, $Radio8, $Radio9 Global $Button1, $Button2, $Button3, $ProgDiv, $ProgAdd, $ProgressBar, $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") _Main() Func _Main()     $Form1_1 = GUICreate("Flash Drive Launcher 3.1", 633, 447)     GUISetIcon("Stuff\USB2.ico")     GUICtrlCreateLabel("Select which programs you would like to install.", 128, 8, 379, 24)     GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")     GUICtrlCreateGroup("Anti-Virus Protection", 16, 40, 233, 153)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio1 = GUICtrlCreateRadio("Microsoft Security Essentials", 24, 64, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox1 = GUICtrlCreateCheckbox("Malwarebytes Anti-Malware", 24, 88, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Radio2 = GUICtrlCreateRadio("Norton 360 Downloader", 24, 112, 161, 17)     $Radio3 = GUICtrlCreateRadio("Norton 360 Installer", 24, 136, 161, 17)     $Radio4 = GUICtrlCreateRadio("AVG", 24, 160, 161, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Standard Programs", 16, 208, 233, 129)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox2 = GUICtrlCreateCheckbox("&Adobe", 32, 232, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox3 = GUICtrlCreateCheckbox("&Java", 32, 256, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox4 = GUICtrlCreateCheckbox("&K-Lite Codec Pack", 32, 280, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox5 = GUICtrlCreateCheckbox("&WinRAR", 32, 304, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Burning Software", 272, 40, 345, 105)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio5 = GUICtrlCreateRadio("Auto Detect", 288, 64, 137, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Radio6 = GUICtrlCreateRadio("Nero 7 Ultra Edition", 288, 88, 137, 17)     $Radio7 = GUICtrlCreateRadio("Roxio Creator DE 10.2", 288, 112, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Word Processors", 272, 160, 345, 105)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio8 = GUICtrlCreateRadio("OpenOffice", 288, 184, 137, 17)     $Radio9 = GUICtrlCreateRadio("Microsoft Office 2007", 288, 208, 137, 17)     $Checkbox6 = GUICtrlCreateCheckbox("Notepad++", 288, 232, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Backup Software", 272, 280, 345, 57)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox7 = GUICtrlCreateCheckbox("Acronis TrueImage", 288, 304, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     $Button1 = GUICtrlCreateButton("&Install", 280, 368, 75, 25, $WS_GROUP)     $Button2 = GUICtrlCreateButton("Ad&vanced", 528, 368, 75, 25, $WS_GROUP)     $Button3 = GUICtrlCreateButton("&Simple", 32, 368, 75, 25, $WS_GROUP)     GUICtrlSetState($Button3, $GUI_DISABLE) ;$Button3 will be disabled     $Progress1 = GUICtrlCreateProgress(8, 416, 614, 17)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $Button1                 If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio1) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio2) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio3) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio4) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio5) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio6) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio7) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio8) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Radio9) = $GUI_CHECKED Then                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                 EndIf                 If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio5) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio6) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio7) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio8) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio9) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio1) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio2) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio3) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio4) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)     WEnd EndFunc   ;==>_Main Func ProgressbarData()     $ProgressBar = $ProgAdd / $ProgDiv EndFunc   ;==>ProgressbarData Func TogglePause()     $Paused = Not $Paused     While $Paused         Sleep(100)         ToolTip('Script is "Paused"', 0, 0)     WEnd     ToolTip("") EndFunc   ;==>TogglePause Func Terminate()     Exit 0 EndFunc   ;==>Terminate


Edited by curiouslearner, 05 February 2011 - 04:38 PM.








#2 bylly122001

bylly122001

    Seeker

  • Active Members
  • 5 posts

Posted 09 February 2011 - 11:26 AM

hey this is my first post here ...
i managed to do something about your installer so this is a rough version ...
AutoIt         
#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3>; #include <Math.au3> #NoTrayIcon #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #NoTrayIcon #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> ;#include <_Animate_Window_UDF.au3> #include <inet.au3> #include <ie.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #AutoIt3Wrapper_icon=asd.ico Global $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5, $Checkbox6, $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10 ,$Checkbox11 ,$Checkbox12 Global $Radio1, $Radio2, $Radio3, $Radio4, $Radio5, $Radio6, $Radio7, $Radio8, $Radio9 Global $Button1, $Button2, $Button3, $ProgDiv, $ProgAdd, $ProgressBar, $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") _Main() Func _Main()                  $Form1_1 = GUICreate(" Flash Drive Launcher 3.1", 633, 447)     GUISetIcon("Stuff\USB2.ico")     GUICtrlCreateLabel("Select which programs you would like to install.", 128, 8, 379, 24)     GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")     GUICtrlCreateGroup("Drivers", 16, 40, 233, 123)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox1 = GUICtrlCreateCheckbox( "Audio Driver ", 24, 64, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox2 = GUICtrlCreateCheckbox("Chipset Driver ", 24, 88, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox3 = GUICtrlCreateCheckbox("Lan Driver ", 24, 112, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox4 = GUICtrlCreateCheckbox("Video Driver ", 24, 136, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -90, -90, 1, 1) ;close group     GUICtrlCreateGroup("Programe Standard ", 16, 175, 233, 175)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox5 = GUICtrlCreateCheckbox("&VLC", 32, 200, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox6 = GUICtrlCreateCheckbox("&Adobe Flash player", 32, 224, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox7 = GUICtrlCreateCheckbox("&Java", 32, 248, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox8 = GUICtrlCreateCheckbox("&Winamp", 32, 272, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox9 = GUICtrlCreateCheckbox("W&inrar", 32, 296, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox10 = GUICtrlCreateCheckbox("&KMPlayer", 32, 320, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group       $Button1 = GUICtrlCreateButton("&Install", 280, 368, 75, 25, $WS_GROUP)     $Button2 = GUICtrlCreateButton("Ad&vanced", 528, 368, 75, 25, $WS_GROUP)     $Button3 = GUICtrlCreateButton("&Simple", 32, 368, 75, 25, $WS_GROUP)     GUICtrlSetState($Button3, $GUI_DISABLE) ;$Button3 will be disabled     $Progress1 = GUICtrlCreateProgress(8, 416, 614, 17)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $Button1                   If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                   Run (@ScriptDir &"\drv\" & $31 &"\s\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                  If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                     Run (@ScriptDir &"\drv\" & $31 &"\c\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                  If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                   Run (@ScriptDir &"\drv\" & $31 &"\r\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                   Run (@ScriptDir &"\drv\" & $31 &"\v\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then         $_Pid1 =  Run (@ScriptDir &'\prg\ai.exe'); ai.exe = Aimp2                   $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 5                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 Sleep ( 3000 )                                   If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                    While ProcessExists ( $_Pid1 )                     Sleep ( 100 )                     WEnd         $_Pid2 =  Run (@ScriptDir &'\prg\cd.exe');cd.exe= cdburner xp                 $ProgDiv = $ProgDiv + 1                 $ProgAdd = $ProgAdd + 10                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                      While ProcessExists ( $_Pid2 )                     Sleep ( 100 )                 WEnd         $_Pid3 =  Run (@ScriptDir &'\prg\av.exe');av.exe= avast antivirus                 $ProgDiv = $ProgDiv + 1                 $ProgAdd = $ProgAdd + 15                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox8) = $GUI_CHECKED Then                   While ProcessExists ( $_Pid3 )                     Sleep ( 100 )                 WEnd         $_Pid4 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                 $ProgDiv = $ProgDiv + 1                 $ProgAdd = $ProgAdd + 20                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox9) = $GUI_CHECKED Then                   Run (@ScriptDir &"\prg\ai.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox10) = $GUI_CHECKED Then                   Run (@ScriptDir &"\prg\ai.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio5) = $GUI_CHECKED Then                     MsgBox(0, "Install", "Installing burning software based on your OEM...") ;RunWait("Path of File")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio6) = $GUI_CHECKED Then                     RunWait("Nero\nero7.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio7) = $GUI_CHECKED Then                     RunWait("Roxio\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio8) = $GUI_CHECKED Then                     RunWait("OpenOffice\OOo_3.2.1_Win_x86_install-wJRE_en-US-oppenoffice3.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio9) = $GUI_CHECKED Then                     RunWait("Office\OfficeEnterpriseEdition2007.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox11) = $GUI_CHECKED Then                     RunWait(@ComSpec & " /c " & 'start Notepad++\npp.5.8.6.Installer.exe /S', "", @SW_HIDE)                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                     EndSwitch     WEnd     EndFunc   ;==>_Main  Func ProgressbarData()     $ProgressBar = $ProgAdd / $ProgDiv EndFunc   ;==>ProgressbarData Func TogglePause()     $Paused = Not $Paused     While $Paused         Sleep(100)         ToolTip('Script is "Paused"', 0, 0)     WEnd     ToolTip("") EndFunc   ;==>TogglePause Func Terminate()     Exit 0 EndFunc   ;==>Terminate



it would be cool to add a /quiet switch after the exe "$_Pid2 = Run (@ScriptDir &'\prg\cd.exe /q')"
but than the pid 2 doesent see pid 1 so ... i`m still trying to emprove it ..
, and don`t mind the tons of include at the beginning i didn't know what i would need so i inserted them all

#3 bylly122001

bylly122001

    Seeker

  • Active Members
  • 5 posts

Posted 09 February 2011 - 01:35 PM

AutoIt         
#include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3>; #include <Math.au3> #NoTrayIcon #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #NoTrayIcon #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> ;#include <_Animate_Window_UDF.au3> #include <inet.au3> #include <ie.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #AutoIt3Wrapper_icon=bylly.ico Global $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5, $Checkbox6, $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10 ,$Checkbox11 ,$Checkbox12 Global $Radio1, $Radio2, $Radio3, $Radio4, $Radio5, $Radio6, $Radio7, $Radio8, $Radio9 Global $Button1, $Button2, $Button3, $ProgDiv, $ProgAdd, $ProgressBar, $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") _Main() Func _Main()                  $Form1_1 = GUICreate(" Flash Drive Launcher 3.1", 633, 447)     GUISetIcon("Stuff\USB2.ico")     GUICtrlCreateLabel("Select which programs you would like to install.", 128, 8, 379, 24)     GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")     GUICtrlCreateGroup("Drivers", 16, 40, 233, 123)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox1 = GUICtrlCreateCheckbox( "Audio Driver ", 24, 64, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox2 = GUICtrlCreateCheckbox("Chipset Driver ", 24, 88, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox3 = GUICtrlCreateCheckbox("Lan Driver ", 24, 112, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox4 = GUICtrlCreateCheckbox("Video Driver ", 24, 136, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -90, -90, 1, 1) ;close group     GUICtrlCreateGroup("Programe Standard ", 16, 175, 233, 175)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox5 = GUICtrlCreateCheckbox("&VLC", 32, 200, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox6 = GUICtrlCreateCheckbox("&Adobe Flash player", 32, 224, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox7 = GUICtrlCreateCheckbox("&Java", 32, 248, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox8 = GUICtrlCreateCheckbox("&Winamp", 32, 272, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox9 = GUICtrlCreateCheckbox("W&inrar", 32, 296, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox10 = GUICtrlCreateCheckbox("&KMPlayer", 32, 320, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group       $Button1 = GUICtrlCreateButton("&Install", 280, 368, 75, 25, $WS_GROUP)     $Button2 = GUICtrlCreateButton("Ad&vanced", 528, 368, 75, 25, $WS_GROUP)     $Button3 = GUICtrlCreateButton("&Simple", 32, 368, 75, 25, $WS_GROUP)     GUICtrlSetState($Button3, $GUI_DISABLE) ;$Button3 will be disabled     $Progress1 = GUICtrlCreateProgress(8, 416, 614, 17)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $Button1                   If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                   Run (@ScriptDir &"\drv\" & $31 &"\s\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                  If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                     Run (@ScriptDir &"\drv\" & $31 &"\c\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                  If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                   Run (@ScriptDir &"\drv\" & $31 &"\r\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                   Run (@ScriptDir &"\drv\" & $31 &"\v\setup.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then                     $_Pid1 =  Run (@ScriptDir &'\prg\ai.exe'); ai.exe = Aimp2                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 5                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                     $_Pid2 =  Run (@ScriptDir &'\prg\cd.exe');cd.exe= cdburner xp                         While ProcessExists ( $_Pid2 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 10                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                     $_Pid3 =  Run (@ScriptDir &'\prg\av.exe');av.exe= avast antivirus                         While ProcessExists ( $_Pid3 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 18                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox8) = $GUI_CHECKED Then                     $_Pid4 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 25                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox9) = $GUI_CHECKED Then                   Run (@ScriptDir &"\prg\ai.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox10) = $GUI_CHECKED Then                   Run (@ScriptDir &"\prg\ai.exe")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                         EndSwitch     WEnd     EndFunc   ;==>_Main  Func ProgressbarData()     $ProgressBar = $ProgAdd / $ProgDiv EndFunc   ;==>ProgressbarData Func TogglePause()     $Paused = Not $Paused     While $Paused         Sleep(100)         ToolTip('Script is "Paused"', 0, 0)     WEnd     ToolTip("") EndFunc   ;==>TogglePause Func Terminate()     Exit 0 EndFunc   ;==>Terminate


sorry about the double post don`t know why but i cant edit my post

#4 kaotkbliss

kaotkbliss

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,440 posts

Posted 09 February 2011 - 03:18 PM

If you are not sure which includes you need, you can comment them out (put ; in front of the include line) then run the syntax checker. If it returns errors, then you need that include.

8yyxkx.jpg010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My first project  Allin1 Program launcher

Bill Calculator

Got <Insert problem here>? There's an AutoIt script for that!


#5 bylly122001

bylly122001

    Seeker

  • Active Members
  • 5 posts

Posted 09 February 2011 - 09:15 PM

If you are not sure which includes you need, you can comment them out (put ; in front of the include line) then run the syntax checker. If it returns errors, then you need that include.



thanks for the advice will try ...

#6 Oviyaa

Oviyaa

    Seeker

  • Active Members
  • 7 posts

Posted 10 February 2011 - 09:50 AM

Its good update

#7 bylly122001

bylly122001

    Seeker

  • Active Members
  • 5 posts

Posted 11 February 2011 - 10:07 AM

hy back with improvements but still has a 'glitch' as programs get installed the progress bar should go from 0 to 100 instead it goes to 100 after the first program is installed and decreases as more programs get installed ... any ideas on why ? (my math sucks so i`m guessing that`s my problem but...)
AutoIt         
#AutoIt3Wrapper_icon=baubau.ico ;#include <ButtonConstants.au3> ;#include <GUIConstantsEx.au3> ;#include <ProgressConstants.au3> ;#include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3>; #include <Math.au3> #NoTrayIcon #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #NoTrayIcon #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> ;#include <_Animate_Window_UDF.au3> #include <inet.au3> #include <ie.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet('{esc}', '_exit') Global Const $AC_SRC_ALPHA = 1 Global $old_string = "", $runthis = "" Global $launchDir = 'C:\' ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir &"\icons\lo-2.png" $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("bylly", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($GUI, $hImage, 0) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($GUI, "", 1) ;fade in png background For $i = 0 To 255 Step 10     Sleep(10)     SetBitmap($GUI, $hImage, $i) Next     Sleep(2000) For $i = 255 To 0 Step -10     Sleep(20)     SetBitmap($GUI, $hImage, $i) Next WinSetOnTop($GUI, "", 1) Func SetBitmap($hGUI, $hImage, $iOpacity)     Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend     $hScrDC = _WinAPI_GetDC(0)     $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)     $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)     $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)     $tSize = DllStructCreate($tagSIZE)     $pSize = DllStructGetPtr($tSize)     DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))     DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))     $tSource = DllStructCreate($tagPOINT)     $pSource = DllStructGetPtr($tSource)     $tBlend = DllStructCreate($tagBLENDFUNCTION)     $pBlend = DllStructGetPtr($tBlend)     DllStructSetData($tBlend, "Alpha", $iOpacity)     DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)     _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)     _WinAPI_ReleaseDC(0, $hScrDC)     _WinAPI_SelectObject($hMemDC, $hOld)     _WinAPI_DeleteObject($hBitmap)     _WinAPI_DeleteDC($hMemDC) EndFunc Func _Exit()     Exit EndFunc  GUIDelete($GUI) Global $host Global $make Global $model Global $processortype Global $processorspeed Global $memory $host = "localhost" Call("MakeModel") $txt_Report = FileOpen("%windir%\SIR.txt", 2) FileWriteLine($txt_Report, "Host Name: " & $host & "") FileWriteLine($txt_Report, "") FileClose($txt_Report) Func MakeModel()   $vbs = FileOpen("c:\MakeModel.vbs", 2)   FileWriteLine($vbs, "")   FileWriteLine($vbs, "On Error Resume Next")   FileWriteLine($vbs, 'Set FSO = CreateObject("Scripting.FileSystemObject")')   FileWriteLine($vbs, 'Set MakeModel = FSO.CreateTextFile("c:\model.txt", True)')   FileWriteLine($vbs, 'strComputer = "' & $host & '"')   FileWriteLine($vbs, 'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")')   FileWriteLine($vbs, 'Set colItems2 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)')   FileWriteLine($vbs, "")   FileWriteLine($vbs, "For Each objItem in colItems2")   FileWriteLine($vbs, "")   FileWriteLine($vbs, "Model = objItem.Model")   FileWriteLine($vbs, "MakeModel.WriteLine Model")   FileWriteLine($vbs, "")   FileWriteLine($vbs, "Next")   FileClose($vbs)   Run("wscript.exe c:\MakeModel.vbs")   Sleep(2000)   $txt_MakeModel = FileOpen("c:\model.txt", 0) ; MakeModel Variables   $model1 = FileReadLine($txt_MakeModel, 1) FileClose($txt_MakeModel) EndFunc Global $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5, $Checkbox6, $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10 ,$Checkbox11 ,$Checkbox12 Global $Radio1, $Radio2, $Radio3, $Radio4, $Radio5, $Radio6, $Radio7, $Radio8, $Radio9 Global $Button1, $Button2, $Button3, $ProgDiv, $ProgAdd, $ProgressBar, $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") _Main() Func _Main()           $model1 = FileReadLine('c:\model.txt', 1)    If( $model1 = "8212W98") Then        $31=("gx280")    EndIf         If( $model1 = "OptiPlex GX280               ") Then     $31=("gx280")    EndIf         If( $model1 = "OptiPlex GX270               ") Then        $31=("gx270")    EndIf     If( $model1 = "8212W98") Then        $31=(" gx280")    EndIf        $Form1_1 = GUICreate(" Flash Drive Launcher 3.1" & $31, 633, 447)     GUISetIcon("Stuff\USB2.ico")     GUICtrlCreateLabel("Select which programs you would like to install.", 128, 8, 379, 24)     GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")     GUICtrlCreateGroup("Drivers", 16, 40, 233, 123)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox1 = GUICtrlCreateCheckbox( "Audio Driver ", 24, 64, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox2 = GUICtrlCreateCheckbox("Chipset Driver ", 24, 88, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox3 = GUICtrlCreateCheckbox("Lan Driver ", 24, 112, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox4 = GUICtrlCreateCheckbox("Video Driver ", 24, 136, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -90, -90, 1, 1) ;close group     GUICtrlCreateGroup("Programe Standard ", 16, 175, 233, 175)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox5 = GUICtrlCreateCheckbox("&VLC", 32, 200, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox6 = GUICtrlCreateCheckbox("&Adobe Flash player", 32, 224, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox7 = GUICtrlCreateCheckbox("&Dock", 32, 248, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox8 = GUICtrlCreateCheckbox("&Winamp", 32, 272, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox9 = GUICtrlCreateCheckbox("W&inrar", 32, 296, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox10 = GUICtrlCreateCheckbox("&KMPlayer", 32, 320, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Antivirus", 272, 40, 345, 105)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio5 = GUICtrlCreateRadio("Auto Detect", 288, 64, 137, 17)     $Radio6 = GUICtrlCreateRadio("Avast", 288, 88, 137, 17)     $Radio7 = GUICtrlCreateRadio("AVG", 288, 112, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Procesoare Word ", 272, 160, 345, 105)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio8 = GUICtrlCreateRadio("OpenOffice", 288, 184, 137, 17)     $Radio9 = GUICtrlCreateRadio("SSuite Office - Personal Edition 4.0", 288, 208, 137, 17)     $Checkbox11 = GUICtrlCreateCheckbox("Notepad++", 288, 232, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Backup Software", 272, 280, 345, 57)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox12 = GUICtrlCreateCheckbox("Acronis TrueImage", 288, 304, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     $Button1 = GUICtrlCreateButton("&Install", 280, 368, 75, 25, $WS_GROUP)     $Button2 = GUICtrlCreateButton("Ad&vanced", 528, 368, 75, 25, $WS_GROUP)     $Button3 = GUICtrlCreateButton("&Simple", 32, 368, 75, 25, $WS_GROUP)     GUICtrlSetState($Button3, $GUI_DISABLE) ;$Button3 will be disabled     $Progress1 = GUICtrlCreateProgress(8, 416, 614, 17)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $Button1             If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                 $_Pid1 =   Run (@ScriptDir &"\drv\" & $31 &"\s\setup.exe -s");Audio Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                                       ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf             If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                 $_Pid2 =   Run (@ScriptDir &"\drv\" & $31 &"\c\setup.exe -s");Chipset Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf             If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                 $_Pid3 =   Run (@ScriptDir &"\drv\" & $31 &"\r\setup.exe -s");Network Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                                       ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                  $_Pid4 =   Run (@ScriptDir &"\drv\" & $31 &"\v\setup.exe -s");Graphics Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                                       ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                 If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then                     $_Pid5 =  Run (@ScriptDir &'\prg\vl.exe -s'); ai.exe = Aimp2                         While ProcessExists ( $_Pid5 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                     $_Pid6 =  Run (@ScriptDir &'\prg\af.exe -s');cd.exe= cdburner xp                         While ProcessExists ( $_Pid6 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                     $_Pid7 =  Run (@ScriptDir &'\prg\dock.bat');av.exe= avast antivirus                         While ProcessExists ( $_Pid7 )                         Sleep ( 100 )                         WEnd                     $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox8) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\wp.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid8 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox9) = $GUI_CHECKED Then              $_Pid9 =  Run (@ScriptDir &'\prg\wr.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid9 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox10) = $GUI_CHECKED Then                  $_Pid10 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid10 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio5) = $GUI_CHECKED Then                     MsgBox(0, "Install", "Installing antivirus software based on your OEM...") ;RunWait("Path of File")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio6) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\av.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio7) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio8) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio9) = $GUI_CHECKED Then                 $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox11) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                             If GUICtrlRead($Checkbox12) = $GUI_CHECKED Then                    $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgDiv = $ProgDiv + 1                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                               EndSwitch     WEnd     EndFunc   ;==>_Main  Func ProgressbarData()     $ProgressBar = (100 / ($ProgDiv * $ProgAdd ) EndFunc   ;==>ProgressbarData Func TogglePause()     $Paused = Not $Paused     While $Paused         Sleep(100)         ToolTip('Script is "Paused"', 0, 0)     WEnd     ToolTip("") EndFunc   ;==>TogglePause Func Terminate()     Exit 0 EndFunc   ;==>Terminate  


@kaotkbliss , i started to add ; before include but than i drifted to the rest of the code ...

#8 bylly122001

bylly122001

    Seeker

  • Active Members
  • 5 posts

Posted 11 February 2011 - 03:36 PM

AutoIt         
#AutoIt3Wrapper_icon=baubau.ico ;#include <ButtonConstants.au3> ;#include <GUIConstantsEx.au3> ;#include <ProgressConstants.au3> ;#include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3>; #include <Math.au3> #NoTrayIcon #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #NoTrayIcon #include <GDIPlus.au3> #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> ;#include <_Animate_Window_UDF.au3> #include <inet.au3> #include <ie.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet('{esc}', '_exit') Global Const $AC_SRC_ALPHA = 1 Global $old_string = "", $runthis = "" Global $launchDir = 'C:\' ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir &"\icons\lo-2.png" $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("bylly", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($GUI, $hImage, 0) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($GUI, "", 1) ;fade in png background For $i = 0 To 255 Step 10     Sleep(10)     SetBitmap($GUI, $hImage, $i) Next     Sleep(2000) For $i = 255 To 0 Step -10     Sleep(20)     SetBitmap($GUI, $hImage, $i) Next WinSetOnTop($GUI, "", 1) Func SetBitmap($hGUI, $hImage, $iOpacity)     Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend     $hScrDC = _WinAPI_GetDC(0)     $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)     $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)     $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)     $tSize = DllStructCreate($tagSIZE)     $pSize = DllStructGetPtr($tSize)     DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))     DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))     $tSource = DllStructCreate($tagPOINT)     $pSource = DllStructGetPtr($tSource)     $tBlend = DllStructCreate($tagBLENDFUNCTION)     $pBlend = DllStructGetPtr($tBlend)     DllStructSetData($tBlend, "Alpha", $iOpacity)     DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)     _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)     _WinAPI_ReleaseDC(0, $hScrDC)     _WinAPI_SelectObject($hMemDC, $hOld)     _WinAPI_DeleteObject($hBitmap)     _WinAPI_DeleteDC($hMemDC) EndFunc Func _Exit()     Exit EndFunc  GUIDelete($GUI) Global $host Global $make Global $model Global $processortype Global $processorspeed Global $memory $host = "localhost" Call("MakeModel") $txt_Report = FileOpen("%windir%\SIR.txt", 2) FileWriteLine($txt_Report, "Host Name: " & $host & "") FileWriteLine($txt_Report, "") FileClose($txt_Report) Func MakeModel()   $vbs = FileOpen("c:\MakeModel.vbs", 2)   FileWriteLine($vbs, "")   FileWriteLine($vbs, "On Error Resume Next")   FileWriteLine($vbs, 'Set FSO = CreateObject("Scripting.FileSystemObject")')   FileWriteLine($vbs, 'Set MakeModel = FSO.CreateTextFile("c:\model.txt", True)')   FileWriteLine($vbs, 'strComputer = "' & $host & '"')   FileWriteLine($vbs, 'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")')   FileWriteLine($vbs, 'Set colItems2 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)')   FileWriteLine($vbs, "")   FileWriteLine($vbs, "For Each objItem in colItems2")   FileWriteLine($vbs, "")   FileWriteLine($vbs, "Model = objItem.Model")   FileWriteLine($vbs, "MakeModel.WriteLine Model")   FileWriteLine($vbs, "")   FileWriteLine($vbs, "Next")   FileClose($vbs)   Run("wscript.exe c:\MakeModel.vbs")   Sleep(2000)   $txt_MakeModel = FileOpen("c:\model.txt", 0) ; MakeModel Variables   $model1 = FileReadLine($txt_MakeModel, 1) FileClose($txt_MakeModel) EndFunc Global $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5, $Checkbox6, $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10 ,$Checkbox11 ,$Checkbox12 Global $Radio1, $Radio2, $Radio3, $Radio4, $Radio5, $Radio6, $Radio7, $Radio8, $Radio9 Global $Button1, $Button2, $Button3, $ProgDiv, $ProgAdd, $ProgressBar, $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") _Main() Func _Main()           $model1 = FileReadLine('c:\model.txt', 1)    If( $model1 = "8212W98") Then        $31=("gx280")    EndIf         If( $model1 = "OptiPlex GX280               ") Then     $31=("gx280")    EndIf         If( $model1 = "OptiPlex GX270               ") Then        $31=("gx270")    EndIf     If( $model1 = "8212W98") Then        $31=(" gx280")    EndIf        $Form1_1 = GUICreate(" Flash Drive Launcher 3.1" & $31, 633, 447)     GUISetIcon("Stuff\USB2.ico")     GUICtrlCreateLabel("Select which programs you would like to install."& $ProgAdd , 128, 8, 379, 24)     GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")     GUICtrlCreateGroup("Drivers", 16, 40, 233, 123)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox1 = GUICtrlCreateCheckbox( "Audio Driver ", 24, 64, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox2 = GUICtrlCreateCheckbox("Chipset Driver ", 24, 88, 161, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox3 = GUICtrlCreateCheckbox("Lan Driver ", 24, 112, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox4 = GUICtrlCreateCheckbox("Video Driver ", 24, 136, 161, 17)         GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -90, -90, 1, 1) ;close group     GUICtrlCreateGroup("Programe Standard ", 16, 175, 233, 175)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox5 = GUICtrlCreateCheckbox("&VLC", 32, 200, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox6 = GUICtrlCreateCheckbox("&Adobe Flash player", 32, 224, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox7 = GUICtrlCreateCheckbox("&Dock", 32, 248, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox8 = GUICtrlCreateCheckbox("&Winamp", 32, 272, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox9 = GUICtrlCreateCheckbox("W&inrar", 32, 296, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     $Checkbox10 = GUICtrlCreateCheckbox("&KMPlayer", 32, 320, 113, 17)     GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Antivirus", 272, 40, 345, 105)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio5 = GUICtrlCreateRadio("Auto Detect", 288, 64, 137, 17)     $Radio6 = GUICtrlCreateRadio("Avast", 288, 88, 137, 17)     $Radio7 = GUICtrlCreateRadio("AVG", 288, 112, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Procesoare Word ", 272, 160, 345, 105)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Radio8 = GUICtrlCreateRadio("OpenOffice", 288, 184, 137, 17)     $Radio9 = GUICtrlCreateRadio("SSuite Office - Personal Edition 4.0", 288, 208, 137, 17)     $Checkbox11 = GUICtrlCreateCheckbox("Notepad++", 288, 232, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     GUICtrlCreateGroup("Backup Software", 272, 280, 345, 57)     GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")     $Checkbox12 = GUICtrlCreateCheckbox("Acronis TrueImage", 288, 304, 137, 17)     GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group     $Button1 = GUICtrlCreateButton("&Install", 280, 368, 75, 25, $WS_GROUP)     $Button2 = GUICtrlCreateButton("Ad&vanced", 528, 368, 75, 25, $WS_GROUP)     $Button3 = GUICtrlCreateButton("&Simple", 32, 368, 75, 25, $WS_GROUP)     GUICtrlSetState($Button3, $GUI_DISABLE) ;$Button3 will be disabled     $Progress1 = GUICtrlCreateProgress(8, 416, 614, 17)     GUISetState(@SW_SHOW)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $Button1 If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox8) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox9) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox10) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1             EndIf If GUICtrlRead($Checkbox11) = $GUI_CHECKED Then                 $ProgDiv = $ProgDiv + 1                  EndIf                                             If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then                 $_Pid1 =   Run (@ScriptDir &"\drv\" & $31 &"\s\setup.exe -s");Audio Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                                         $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf             If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then                 $_Pid2 =   Run (@ScriptDir &"\drv\" & $31 &"\c\setup.exe -s");Chipset Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf             If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then                 $_Pid3 =   Run (@ScriptDir &"\drv\" & $31 &"\r\setup.exe -s");Network Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgAdd = $ProgAdd + 1                                       ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then                  $_Pid4 =   Run (@ScriptDir &"\drv\" & $31 &"\v\setup.exe -s");Graphics Driver                         While ProcessExists ( $_Pid1 )                         Sleep ( 100 )                         WEnd                     $ProgAdd = $ProgAdd + 1                                       ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                 If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then                     $_Pid5 =  Run (@ScriptDir &'\prg\vl.exe -s'); ai.exe = Aimp2                         While ProcessExists ( $_Pid5 )                         Sleep ( 100 )                         WEnd                     $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then                     $_Pid6 =  Run (@ScriptDir &'\prg\af.exe -s');cd.exe= cdburner xp                         While ProcessExists ( $_Pid6 )                         Sleep ( 100 )                         WEnd                     $ProgAdd = $ProgAdd + 1                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox7) = $GUI_CHECKED Then                     $_Pid7 =  Run (@ScriptDir &'\prg\dock.bat');av.exe= avast antivirus                         While ProcessExists ( $_Pid7 )                         Sleep ( 100 )                         WEnd                     $ProgAdd = $ProgAdd + 1                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox8) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\wp.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid8 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                         ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox9) = $GUI_CHECKED Then              $_Pid9 =  Run (@ScriptDir &'\prg\wr.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid9 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                   If GUICtrlRead($Checkbox10) = $GUI_CHECKED Then                  $_Pid10 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid10 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio5) = $GUI_CHECKED Then                     MsgBox(0, "Install", "Installing antivirus software based on your OEM...") ;RunWait("Path of File")                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio6) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\av.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio7) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio8) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Radio9) = $GUI_CHECKED Then                 $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                 If GUICtrlRead($Checkbox11) = $GUI_CHECKED Then                     $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                     GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                             If GUICtrlRead($Checkbox12) = $GUI_CHECKED Then                    $_Pid8 =  Run (@ScriptDir &'\prg\km.exe');km.exe=kmplayer                         While ProcessExists ( $_Pid4 )                         Sleep ( 100 )                         WEnd                                $ProgAdd = $ProgAdd + 1                     ProgressbarData()                                         GUICtrlSetData($Progress1, $ProgressBar)                 EndIf                                               EndSwitch     WEnd     EndFunc   ;==>_Main  Func ProgressbarData()     $ProgressBar = (100/$ProgDiv) * $ProgAdd     ToolTip('ProgAdd='&$ProgAdd & 'ProgDiv=' & $ProgDiv , 200, 200 ) EndFunc   ;==>ProgressbarData Func TogglePause()     $Paused = Not $Paused     While $Paused         Sleep(100)         ToolTip('Script is "Paused"', 0, 0)     WEnd     ToolTip("") EndFunc   ;==>TogglePause Func Terminate()     Exit 0 EndFunc   ;==>Terminate

Edited by bylly122001, 11 February 2011 - 05:02 PM.


#9 imbrija

imbrija

    Seeker

  • Active Members
  • 5 posts

Posted 11 April 2012 - 12:48 PM

Hi there!

I found this topic interesting and used piece of code for progress bar.
But, in my app progress bar was going from 100 percent to 0. That wasn't good for me, so.... trick was in this:

Func ProgressbarData() $ProgressBar = $ProgAdd / 0.1 EndFunc   ;==>ProgressbarData


Function written like this makes progress bar go from 0 to 100 ;)

Hope this will be helpfull for someone :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users