Neo2102 Posted July 9, 2012 Posted July 9, 2012 Hello,I try to do my first AutoIT application (User Backup Tool)Everyting work great exept when I click on the button Backup ($Pic3)When I click on the button "Backup" My idea is the 2 button Exit ($Pic2) & Backup ($Pic3) is removed and replace by a progressBarThe problem is when I click on the Backup button I see the progressbar is present but I don't know why the Button Exit & Backup stay on GUI on the progressbar....Here it's a screenshot of the application befor clicking on Backup (Look great)And this screenshot it's after I click on Backup ... As you can see the fuck*** button are present on GUI and on the ProgressBARHere the code:It's my first autoit script so maybe it's not coded perfectly but it's work exept this problem with the button...WHo can help me ?expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> LOCAL $objObject, $SINK_OnObjectReady, $objAsyncContext, $i, $Pic2, $Pic3, $CancelBut, $UserProfileSize $strComputer = "." $objWMIServices = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $sink = ObjCreate("WbemScripting.SWbemSink") ObjEvent($sink,"SINK_") $objWMIServices.ExecNotificationQueryAsync ($sink, "SELECT * FROM __InstanceOperationEvent WITHIN 5 WHERE " & "TargetInstance ISA 'Win32_LogicalDisk'") $UserProfileSize=DirGetSize("C:\Users\"&@UserName) $aArray = DriveGetDrive("REMOVABLE") If @Error Then #Region ### START Koda GUI section ### Form= $Main = GUICreate(".: DG CNECT - User Backup Tool :.", 653, 543, 192, 124) GUISetBkColor(0x4191EB) $Pic1 = GUICtrlCreatePic("\\s-infso-landesk\packages\BackupTool\Header.jpg", 0, 0, 652, 100) $Group1 = GUICtrlCreateGroup("INFOS", 8, 128, 305, 137) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label6 = GUICtrlCreateLabel("Welcome :", 16, 160, 74, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label7 = GUICtrlCreateLabel("Computer name :", 16, 192, 117, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label8 = GUICtrlCreateLabel("Last backup :", 16, 224, 92, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label11 = GUICtrlCreateLabel(""&@ComputerName, 140, 192, 164, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label12 = GUICtrlCreateLabel(""&@UserName, 100, 160, 132, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label20 = GUICtrlCreateLabel("Last Backup Value", 112, 224, 119, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 8, 264, 305, 161) $Label1 = GUICtrlCreateLabel("This tool will backup the following :", 16, 280, 238, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label2 = GUICtrlCreateLabel("- All your local documents", 16, 312, 164, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label3 = GUICtrlCreateLabel("- Your Internet Explorer Favorites", 16, 336, 215, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label4 = GUICtrlCreateLabel("- Your Desktop", 16, 384, 97, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label5 = GUICtrlCreateLabel("- Your Mozilla Firefox Favorites", 16, 360, 195, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label9 = GUICtrlCreateLabel("Please save and close all your documents and applications before continue.", 48, 448, 553, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Pic2 = GUICtrlCreateButton("Exit", 224, 488, 75, 40, $BS_ICON) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Exit.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) $Pic3 = 9999 $CancelBut = 9999 $Label10 = GUICtrlCreateLabel("Current date and time :", 360, 104, 153, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label13 = GUICtrlCreateLabel(""&@MDAY&"/"&@MON&"/"&@YEAR&" | "&@HOUR&":"&@MIN, 515, 105, 125, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Group3 = GUICtrlCreateGroup("USB Key Infos", 336, 128, 297, 297) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label14 = GUICtrlCreateLabel("NO USB Device found ! Please Insert USB", 344, 168, 285, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label18 = GUICtrlCreateLabel("", 448, 208, 141, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label19 = GUICtrlCreateLabel("", 496, 248, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label22 = GUICtrlCreateLabel("", 472, 288, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label24 = GUICtrlCreateLabel("", 432, 392, 100, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) $UserProfileSize=DirGetSize(@UserProfileDir) #EndRegion ### END Koda GUI section ### Else For $i = 1 To $aArray[0] If DriveSpaceTotal(StringUpper($aArray[$i])) < "16000" And DriveSpaceTotal(StringUpper($aArray[$i])) > "0" Then $Freespace = DriveSpaceFree($aArray[$i]) $Totalspace = DriveSpaceTotal($aArray[$i]) $Main = GUICreate(".: DG CNECT - User Backup Tool :.", 653, 543, 192, 124) GUISetBkColor(0x4191EB) $Pic1 = GUICtrlCreatePic("\\s-infso-landesk\packages\BackupTool\Header.jpg", 0, 0, 652, 100) $Group1 = GUICtrlCreateGroup("INFOS", 8, 128, 305, 137) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) If FormatFileSize($UserProfileSize) > FormatFileSize($Freespace) Then $Label24 = GUICtrlCreateLabel("No USB Free Space Available", 432, 392, 200, 20) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Pic3 = GUICtrlCreateButton("Backup", 312, 488, 75, 40, $BS_ICON) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Backup.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) Else $Label24 = GUICtrlCreateLabel("USB Free Space OK", 432, 392, 200, 20) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Pic3 = GUICtrlCreateButton("Backup", 312, 488, 75, 40, $BS_ICON) GUICtrlSetState(-1, $GUI_ENABLE) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Backup.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) EndIf $Label6 = GUICtrlCreateLabel("Welcome :", 16, 160, 74, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label7 = GUICtrlCreateLabel("Computer name :", 16, 192, 117, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label8 = GUICtrlCreateLabel("Last backup :", 16, 224, 92, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label11 = GUICtrlCreateLabel(""&@ComputerName, 140, 192, 164, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label12 = GUICtrlCreateLabel(""&@UserName, 100, 160, 132, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label20 = GUICtrlCreateLabel("Last Backup Value", 112, 224, 119, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 8, 264, 305, 161) $Label1 = GUICtrlCreateLabel("This tool will backup the following :", 16, 280, 238, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label2 = GUICtrlCreateLabel("- All your local documents", 16, 312, 164, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label3 = GUICtrlCreateLabel("- Your Internet Explorer Favorites", 16, 336, 215, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label4 = GUICtrlCreateLabel("- Your Desktop", 16, 384, 97, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label16 = GUICtrlCreateLabel("Total USB Free Space: ", 344, 248, 151, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label5 = GUICtrlCreateLabel("- Your Mozilla Firefox Favorites", 16, 360, 195, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label9 = GUICtrlCreateLabel("Please save and close all your documents and applications before continue.", 48, 448, 553, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Pic2 = GUICtrlCreateButton("Exit", 224, 488, 75, 40, $BS_ICON) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Exit.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label10 = GUICtrlCreateLabel("Current date and time :", 360, 104, 153, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label13 = GUICtrlCreateLabel(""&@MDAY&"/"&@MON&"/"&@YEAR&" | "&@HOUR&":"&@MIN, 515, 105, 125, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Group3 = GUICtrlCreateGroup("USB Key Infos", 336, 128, 297, 297) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label14 = GUICtrlCreateLabel("USB Device found on " & $aArray[$i] & " drive", 344, 168, 285, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label15 = GUICtrlCreateLabel("Total USB Size: ", 344, 208, 107, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label18 = GUICtrlCreateLabel(FormatFileSize($Totalspace), 448, 208, 141, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label19 = GUICtrlCreateLabel(FormatFileSize($Freespace), 496, 248, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label21 = GUICtrlCreateLabel("Total Backup Size: ", 344, 288, 127, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label22 = GUICtrlCreateLabel(FormatFileSize($UserProfileSize), 472, 288, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label23 = GUICtrlCreateLabel("Data Check:", 344, 392, 85, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) $CancelBut = 9999 $UserProfileSize=DirGetSize(@UserProfileDir) #EndRegion ### END Koda GUI section ### EndIf Next EndIf Func SINK_OnObjectReady($objObject, $objAsyncContext) If $objObject.TargetInstance.DriveType = 2 Then Select Case $objObject.Path_.Class()="__InstanceCreationEvent" $UserProfileSize=DirGetSize(@UserProfileDir) $Label14 = GUICtrlCreateLabel("USB Device found on " & $objObject.TargetInstance.DeviceId & " drive", 344, 168, 285, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Freespace = DriveSpaceFree($objObject.TargetInstance.DeviceId) $Totalspace = DriveSpaceTotal($objObject.TargetInstance.DeviceId) If FormatFileSize($UserProfileSize) < FormatFileSize($Freespace) Then $Label24 = GUICtrlCreateLabel("No USB Free Space Available", 432, 392, 200, 20) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Pic3 = GUICtrlCreateButton("Backup", 312, 488, 75, 40, $BS_ICON) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Backup.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) Else $Pic3 = GUICtrlCreateButton("Backup", 312, 488, 75, 40, $BS_ICON) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Backup.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label24 = GUICtrlCreateLabel("USB Free Space OK", 432, 392, 200, 20) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) EndIf $Label19 = GUICtrlCreateLabel(FormatFileSize($Freespace), 496, 248, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label18 = GUICtrlCreateLabel(FormatFileSize($Totalspace), 448, 208, 141, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label15 = GUICtrlCreateLabel("Total USB Size: ", 344, 208, 107, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label16 = GUICtrlCreateLabel("Total USB Free Space: ", 344, 248, 151, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label21 = GUICtrlCreateLabel("Total Backup Size: ", 344, 288, 127, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label22 = GUICtrlCreateLabel(FormatFileSize($UserProfileSize), 472, 288, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label23 = GUICtrlCreateLabel("Data Check:", 344, 392, 85, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) ;$Pic3 = GUICtrlCreateButton("Backup", 312, 488, 75, 40, $BS_ICON) ;GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Backup.ico", -1) ;GUICtrlCreateGroup("", -99, -99, 1, 1) Case $objObject.Path_.Class()="__InstanceDeletionEvent" #Region ### START Koda GUI section ### Form= $UserProfileSize=DirGetSize(@UserProfileDir) ;$Main = GUICreate(".: DG CNECT - User Backup Tool :.", 653, 543, 192, 124) ;GUISetBkColor(0x4191EB) $Pic1 = GUICtrlCreatePic("\\s-infso-landesk\packages\BackupTool\Header.jpg", 0, 0, 652, 100) $Group1 = GUICtrlCreateGroup("INFOS", 8, 128, 305, 137) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label6 = GUICtrlCreateLabel("Welcome :", 16, 160, 74, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label7 = GUICtrlCreateLabel("Computer name :", 16, 192, 117, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label8 = GUICtrlCreateLabel("Last backup :", 16, 224, 92, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label11 = GUICtrlCreateLabel(""&@ComputerName, 140, 192, 164, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label12 = GUICtrlCreateLabel(""&@UserName, 100, 160, 132, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label15 = GUICtrlCreateLabel("", 344, 208, 107, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label16 = GUICtrlCreateLabel("", 344, 248, 151, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label21 = GUICtrlCreateLabel("", 344, 288, 127, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label20 = GUICtrlCreateLabel("Last Backup Value", 112, 224, 119, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 8, 264, 305, 161) $Label1 = GUICtrlCreateLabel("This tool will backup the following :", 16, 280, 238, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label2 = GUICtrlCreateLabel("- All your local documents", 16, 312, 164, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label3 = GUICtrlCreateLabel("- Your Internet Explorer Favorites", 16, 336, 215, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label4 = GUICtrlCreateLabel("- Your Desktop", 16, 384, 97, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label5 = GUICtrlCreateLabel("- Your Mozilla Firefox Favorites", 16, 360, 195, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label9 = GUICtrlCreateLabel("Please save and close all your documents and applications before continue.", 48, 448, 553, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Pic2 = GUICtrlCreateButton("Exit", 224, 488, 75, 40, $BS_ICON) GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Exit.ico", -1) GUICtrlCreateGroup("", -99, -99, 1, 1) $Pic3 = GUICtrlCreateLabel("", 312, 488, 75, 40) ;GUICtrlCreateGroup("", -99, -99, 1, 1) ;$Pic3 = 12345 ;GUICtrlCreateLabel("", 312, 488, 75, 40, $BS_ICON) ;GUICtrlSetImage(-1, "\\s-infso-landesk\packages\BackupTool\Bouton-Backup.ico", -1) ;GUICtrlCreateGroup("", -99, -99, 1, 1) $Label10 = GUICtrlCreateLabel("Current date and time :", 360, 104, 153, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label13 = GUICtrlCreateLabel(""&@MDAY&"/"&@MON&"/"&@YEAR&" | "&@HOUR&":"&@MIN, 515, 105, 125, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Group3 = GUICtrlCreateGroup("USB Key Infos", 336, 128, 297, 297) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label14 = GUICtrlCreateLabel("NO USB Device found ! Please Insert USB", 344, 168, 285, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label18 = GUICtrlCreateLabel("", 448, 208, 141, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label19 = GUICtrlCreateLabel("", 496, 248, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label22 = GUICtrlCreateLabel("", 472, 288, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label23 = GUICtrlCreateLabel("", 344, 392, 85, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label24 = GUICtrlCreateLabel("", 432, 392, 200, 20) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label24 = GUICtrlCreateLabel("", 432, 392, 100, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) GUICtrlCreateGroup("", -99, -99, 1, 1) ;GUISetState(@SW_SHOW) ;$Pic3 = 12345 ;GUICtrlCreateLabel("", 312, 488, 75, 40, $BS_ICON) #EndRegion ### END Koda GUI section ### EndSelect EndIf EndFunc Func FormatFileSize($iSizeInBytes) Local $iSize, $i $iSize = $iSizeInBytes $i = 0 While $iSize >= 1024 ;split value, you can set lower number like 900 for earlier switch (0.98 MB) $iSize /= 1024 ;this must be always 1024 $i += 1 WEnd $iSize = Round($iSize, 2) & " "; enter how many decimals you want, here it's '1' Switch $i Case 1 $iSize = $iSize & "G" Case 2 $iSize = $iSize & "M" Case 3 $iSize = $iSize & "G" Case 4 $iSize = $iSize & "T" EndSwitch Return $iSize & "B" EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Pic2 ExitLoop Case $msg = $CancelBut ExitLoop Case $msg = $Pic3 $Progress1 = GUICtrlCreateProgress(40, 496, 495, 33) $Pic2 = GUICtrlCreateLabel("", 224, 488, 75, 40, $BS_ICON) $Pic3 = GUICtrlCreateLabel("", 312, 488, 75, 40, $BS_ICON) $Pic1 = GUICtrlCreatePic("\\s-infso-landesk\packages\BackupTool\Header.jpg", 0, 0, 652, 100) $Group1 = GUICtrlCreateGroup("INFOS", 8, 128, 305, 137) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label6 = GUICtrlCreateLabel("Welcome :", 16, 160, 74, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label7 = GUICtrlCreateLabel("Computer name :", 16, 192, 117, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label8 = GUICtrlCreateLabel("Last backup :", 16, 224, 92, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label11 = GUICtrlCreateLabel(""&@ComputerName, 140, 192, 164, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label12 = GUICtrlCreateLabel(""&@UserName, 100, 160, 132, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label20 = GUICtrlCreateLabel("Last Backup Value", 112, 224, 119, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 8, 264, 305, 161) $Label1 = GUICtrlCreateLabel("This tool will backup the following :", 16, 280, 238, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label2 = GUICtrlCreateLabel("- All your local documents", 16, 312, 164, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label3 = GUICtrlCreateLabel("- Your Internet Explorer Favorites", 16, 336, 215, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label4 = GUICtrlCreateLabel("- Your Desktop", 16, 384, 97, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label16 = GUICtrlCreateLabel("Total USB Free Space: ", 344, 248, 151, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label5 = GUICtrlCreateLabel("- Your Mozilla Firefox Favorites", 16, 360, 195, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label9 = GUICtrlCreateLabel("Backup in Progress ! Please Wait ... Do NOT Remove USB Key", 48, 448, 553, 20) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $CancelBut = GUICtrlCreateButton("CANCEL", 560, 496, 73, 33) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFC0000) $Label10 = GUICtrlCreateLabel("Current date and time :", 360, 104, 153, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label13 = GUICtrlCreateLabel(""&@MDAY&"/"&@MON&"/"&@YEAR&" | "&@HOUR&":"&@MIN, 515, 105, 125, 20) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Group3 = GUICtrlCreateGroup("USB Key Infos", 336, 128, 297, 297) GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFF00) $Label15 = GUICtrlCreateLabel("Total USB Size: ", 344, 208, 107, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label18 = GUICtrlCreateLabel(FormatFileSize($Totalspace), 448, 208, 141, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label19 = GUICtrlCreateLabel(FormatFileSize($Freespace), 496, 248, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label21 = GUICtrlCreateLabel("Total Backup Size: ", 344, 288, 127, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label22 = GUICtrlCreateLabel(FormatFileSize($UserProfileSize), 472, 288, 109, 18) GUICtrlSetFont(-1, 9, 400, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) $Label23 = GUICtrlCreateLabel("Data Check:", 344, 392, 85, 18) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0xFFFFFF) $Label24 = GUICtrlCreateLabel("USB Free Space OK", 432, 392, 200, 20) GUICtrlSetFont(-1, 9, 800, 0, "Verdana") GUICtrlSetColor(-1, 0x49fc77) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndSelect WEnd
Moderators Melba23 Posted July 9, 2012 Moderators Posted July 9, 2012 Neo2102,When you press the "BackUp" button, you run this code:Case $msg = $Pic3 $Progress1 = GUICtrlCreateProgress(40, 496, 495, 33) $Pic2 = GUICtrlCreateLabel("", 224, 488, 75, 40, $BS_ICON) $Pic3 = GUICtrlCreateLabel("", 312, 488, 75, 40, $BS_ICON)The first line indeed creates a progress control, but the second and third lines do not do what you think they do. All they do is to create 2 new controls - they do not replace the existing controls whose ControlIDs are stored in those variables. What you need to so is to hide the existing controls like this:Case $msg = $Pic3 $Progress1 = GUICtrlCreateProgress(40, 496, 495, 33) GUICtrlSetState($Pic2, $GUI_HIDE) GUICtrlSetState($Pic3, $GUI_HIDE)Then when your progress bar is no longer required, you can delete it and make the buttons reappear with $GUI_SHOW.All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
LarsJ Posted July 9, 2012 Posted July 9, 2012 Use commands like GUICtrlSetState( $Pic2, $GUI_HIDE ) GUICtrlSetState( $Pic3, $GUI_HIDE ) and GUICtrlSetState( $Pic2, $GUI_SHOW ) GUICtrlSetState( $Pic3, $GUI_SHOW ) to hide and show your controls. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions
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