Carm01 Posted May 19, 2014 Posted May 19, 2014 (edited) Hello All, I have a installer that I put together and am having difficulty with getting the X to close the window and exit the installer to function. I have tried a ' while ' statement as well as a $msg = GUIGetMsg() in there as well, but just can't seem to get this to close when hitting the X. I also tried the Opt("GUIOnEventMode", 1) with no avail, its prob right in front of my face, Other than that the script works as I want it to, a bit long handed, but never the less works Any assistance is appreciated Thank You in Advance expandcollapse popup#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GUIEdit.au3> #include <ColorConstants.au3> #include <WinAPI.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) $Title = "Installing Applications" $Form1 = GUICreate($Title, 315, 390, -1, -1,bitor($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX)) ;BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Progress1 = GUICtrlCreateProgress(24, 40, 272, 16) $font = "Comic Sans MS" ; sets the $font to comic sans ms GUISetFont(10, 700, 1, $font) GUICtrlSetDefColor(0xFFFF00) GUICtrlCreateLabel(@OSVersion & " " & @OSArch & " " & @ComputerName, 24, 10, 190) GUISetState(@SW_SHOW) GUISetBkColor(0x000000); black background ;Sleep(100) ;Flash Active X $dsa = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'msiexec /i "install_flash_player_13_active_x.msi" /qn' ; Reader $dsb = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'AdbeRdr11007_en_US.exe /msi EULA_ACCEPT=YES /qn' ;Flash Plugin $dsc = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'msiexec /i "install_flash_player_13_plugin.msi" /qn' ;java 64 $dsd = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'jre-7u55-windows-x64.exe /s' ;java 32 $dse = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'jre-7u55-windows-i586.exe /s' ;uninstall Flash $dsf = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'uninstall_flash_player.exe -uninstall' ; install Adobe Air $dsg = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'AdobeAIRInstaller.exe - silent' ; install SilverLight32 $dsh = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'Silverlight.exe /q' ; install SilverLight64 $dsi = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'Silverlight_x64.exe /q' ; below statement sets the installs for 32 to $a and for 64 bit $a +1 IF @OSArch <> "x64" Then $a = 8 ElseIf @OSArch = "x64" then $a = 9 EndIF ;$a = 3 ; Number of Programs to be installed $e = 100 / $a ; this divides the incriments of the progress bar by a$ so the progress bar will show uniform progress as each program is installed $b = 0; sets the count to zero for the gui progress bar ;Filling Browsers GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Now Closing Browsers", 24, 60, 287) RunWait('"' & @ComSpec & '" /c ' & "taskkill.exe /im Firefox.exe /f", @SystemDir, @SW_HIDE) RunWait('"' & @ComSpec & '" /c ' & "taskkill.exe /im iexplore.exe /f", @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Browsers Closed", 24, 60, 287) Sleep(100) ;Uninstall Flash Player GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("UnInstalling ALL Flash Player Version", 24, 80, 287) RunWait('"' & @ComSpec & '" /c ' & $dsf, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Flash Players Uninstalled", 24, 80, 287) Sleep(100) ;Flash IE GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe Flash 13.0.0.214 IE", 24, 100, 287) RunWait('"' & @ComSpec & '" /c ' & $dsa, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Flash IE 13.0.0.214 Completed", 24, 100, 287) Sleep(100) ;Flash Plugin GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe Flash 13.0.0.214 FireFox", 24, 120, 287) RunWait('"' & @ComSpec & '" /c ' & $dsc, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Flash Firefox 13.0.0.214 Completed", 24, 120, 287) Sleep(100) ;Adobe reader GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe Reader 11.0.07", 24, 140, 287) RunWait('"' & @ComSpec & '" /c ' & $dsb, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Reader 11.0.07 Completed", 24, 140, 287) Sleep(100) ;Adobe air GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe AIR", 24, 160, 287) RunWait('"' & @ComSpec & '" /c ' & $dsg, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe AIR Completed", 24, 160, 287) Sleep(100) ; determines OS type IF @OSArch <> "x64" Then Call(Jav32) ElseIf @OSArch = "x64" then Call(jav64) EndIF Func Jav32() GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Java 32 bit", 24, 180, 287) RunWait('"' & @ComSpec & '" /c ' & $dse, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Java 32 bit Completed", 24, 180, 287) Sleep(100) ;Silverlight32 GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing SilverLight", 24, 200, 287) RunWait('"' & @ComSpec & '" /c ' & $dsh, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Silverlight Completed", 24, 200, 287) Sleep(100) EndFunc Func Jav64() GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Java 64 bit", 24, 180, 287) RunWait('"' & @ComSpec & '" /c ' & $dsd, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Java 64 bit Completed", 24, 180, 287) Sleep(100) ; Java 32 bit install after 64 bit run GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Java 32 bit", 24, 200, 287) RunWait('"' & @ComSpec & '" /c ' & $dse, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Java 32 bit Completed", 24, 200, 287) Sleep(100) ;SilverlightX64 GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing SilverLight x64", 24, 220, 287) RunWait('"' & @ComSpec & '" /c ' & $dsi, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Silverlight x64 Completed", 24, 220, 287) Sleep(100) EndFunc Sleep(1200) MsgBox(64, "says:", "Your Runtimes are up to date") Edited May 19, 2014 by Carm01
Solution Carm01 Posted May 19, 2014 Author Solution Posted May 19, 2014 (edited) Disregard i figured it out sorry expandcollapse popup#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GUIEdit.au3> #include <ColorConstants.au3> #include <WinAPI.au3> #include <MsgBoxConstants.au3> $Title = "Installing Applications" $Form1 = GUICreate($Title, 315, 390, -1, -1,bitor($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX)) ;BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Progress1 = GUICtrlCreateProgress(24, 40, 272, 16) $font = "Comic Sans MS" ; sets the $font to comic sans ms GUISetFont(10, 700, 1, $font) GUICtrlSetDefColor(0xFFFF00) GUICtrlCreateLabel(@OSVersion & " " & @OSArch & " " & @ComputerName, 24, 10, 190) GUISetState(@SW_SHOW) GUISetBkColor(0x000000); black background Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton") ;Sleep(100) ;Flash Active X $dsa = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'msiexec /i "install_flash_player_13_active_x.msi" /qn' ; Reader $dsb = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'AdbeRdr11007_en_US.exe /msi EULA_ACCEPT=YES /qn' ;Flash Plugin $dsc = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'msiexec /i "install_flash_player_13_plugin.msi" /qn' ;java 64 $dsd = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'jre-7u55-windows-x64.exe /s' ;java 32 $dse = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'jre-7u55-windows-i586.exe /s' ;uninstall Flash $dsf = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'uninstall_flash_player.exe -uninstall' ; install Adobe Air $dsg = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'AdobeAIRInstaller.exe - silent' ; install SilverLight32 $dsh = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'Silverlight.exe /q' ; install SilverLight64 $dsi = 'pushd \\server1\zp\_Important Documents\_Flash\Runtimes && ' & _ 'Silverlight_x64.exe /q' ; below statement sets the installs for 32 to $a and for 64 bit $a +1 IF @OSArch <> "x64" Then $a = 8 ElseIf @OSArch = "x64" then $a = 9 EndIF ;$a = 3 ; Number of Programs to be installed $e = 100 / $a ; this divides the incriments of the progress bar by a$ so the progress bar will show uniform progress as each program is installed $b = 0; sets the count to zero for the gui progress bar ;Filling Browsers GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Now Closing Browsers", 24, 60, 287) RunWait('"' & @ComSpec & '" /c ' & "taskkill.exe /im Firefox.exe /f", @SystemDir, @SW_HIDE) RunWait('"' & @ComSpec & '" /c ' & "taskkill.exe /im iexplore.exe /f", @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Browsers Closed", 24, 60, 287) Sleep(100) ;Uninstall Flash Player GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("UnInstalling ALL Flash Player Version", 24, 80, 287) RunWait('"' & @ComSpec & '" /c ' & $dsf, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Flash Players Uninstalled", 24, 80, 287) Sleep(100) ;Flash IE GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe Flash 13.0.0.214 IE", 24, 100, 287) RunWait('"' & @ComSpec & '" /c ' & $dsa, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Flash IE 13.0.0.214 Completed", 24, 100, 287) Sleep(100) ;Flash Plugin GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe Flash 13.0.0.214 FireFox", 24, 120, 287) RunWait('"' & @ComSpec & '" /c ' & $dsc, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Flash Firefox 13.0.0.214 Completed", 24, 120, 287) Sleep(100) ;Adobe reader GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe Reader 11.0.07", 24, 140, 287) RunWait('"' & @ComSpec & '" /c ' & $dsb, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe Reader 11.0.07 Completed", 24, 140, 287) Sleep(100) ;Adobe air GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Adobe AIR", 24, 160, 287) RunWait('"' & @ComSpec & '" /c ' & $dsg, @SystemDir, @SW_HIDE) Sleep(100) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Adobe AIR Completed", 24, 160, 287) Sleep(100) ; determines OS type IF @OSArch <> "x64" Then Call(Jav32) ElseIf @OSArch = "x64" then Call(jav64) EndIF Func Jav32() GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Java 32 bit", 24, 180, 287) RunWait('"' & @ComSpec & '" /c ' & $dse, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Java 32 bit Completed", 24, 180, 287) Sleep(100) ;Silverlight32 GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing SilverLight", 24, 200, 287) RunWait('"' & @ComSpec & '" /c ' & $dsh, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Silverlight Completed", 24, 200, 287) Sleep(100) EndFunc Func Jav64() GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Java 64 bit", 24, 180, 287) RunWait('"' & @ComSpec & '" /c ' & $dsd, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Java 64 bit Completed", 24, 180, 287) Sleep(100) ; Java 32 bit install after 64 bit run GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing Java 32 bit", 24, 200, 287) RunWait('"' & @ComSpec & '" /c ' & $dse, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Java 32 bit Completed", 24, 200, 287) Sleep(100) ;SilverlightX64 GUISetFont(10, 400, 1, $font) GUICtrlSetDefColor(0xE65CE6) GUICtrlCreateLabel("Installing SilverLight x64", 24, 220, 287) RunWait('"' & @ComSpec & '" /c ' & $dsi, @SystemDir, @SW_HIDE) $b = $b + 1 $p = $e * $b GUICtrlSetData($Progress1, $p) GUICtrlSetDefColor(0x00CC00) GUICtrlCreateLabel("Silverlight x64 Completed", 24, 220, 287) Sleep(100) EndFunc Sleep(1200) MsgBox(64, "says:", "Your Runtimes are up to date") Func CLOSEButton() ; Note: At this point @GUI_CtrlId would equal $GUI_EVENT_CLOSE, ; and @GUI_WinHandle would equal $hMainGUI MsgBox(0, "GUI Event", "You selected CLOSE! Exiting...") Exit EndFunc ;==>CLOSEButton Edited May 19, 2014 by Carm01
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now