trashy Posted March 10, 2014 Share Posted March 10, 2014 Would like to add this Progresss Bar to my script. Can't nest Functions and I have no Idea how to proceed. I noted the begining and end of the progress Bar except for line 79, contains parameters passed from previous function. ($Combo1 is it a parameter or a variable) This is part of a bigger program and earlier in the process I put Double Driver in the same location as Dpinst compiled the Progress Bar and called it as an external exe. Can't figure this one out. Help Please. expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Best Driver Import.ico #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Fileversion=1.5.0.0 #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Tidy_Stop_OnError=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Import() Func Import() GUICreate("Import all Drivers", 400, 400, -1, -1, BitOR($WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) $ListView = GUICtrlCreateListView("FileSystem | Drive | ", 50, 40, 300, 190) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $aDrives = DriveGetDrive("Fixed") For $i = 1 To UBound($aDrives) - 1 $sData = DriveGetFileSystem($aDrives[$i]) & " | " & StringUpper($aDrives[$i]) & "" & DriveGetLabel($aDrives[$i]) GUICtrlCreateListViewItem($sData, $ListView) Next $Label1 = GUICtrlCreateLabel("List of Available Drives to Import From", 60, 20, 275, 24) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Select Drive from dropdown list below", 65, 230, 275, 24) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Combo1 = GUICtrlCreateCombo("", 100, 260, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("OK", 100, 350, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Cancel", 220, 350, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) For $i = 10 To 99 If DriveStatus(Chr($i) & ':') = 'READY' Then If DriveGetType(Chr($i) & ":") = 'FIXED' Then GUICtrlSetData($Combo1, Chr($i) & ':') EndIf Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button2 Exit Case $Button1 $version = StringLeft(FileGetVersion(GUICtrlRead($Combo1) & "\Windows\system32\WinVer.exe"), 3) If StringLeft($version, 3) = "6.1" Then $version = "WIN7" ElseIf StringLeft($version, 3) = "6.0" Then $version = "VISTA" ElseIf StringLeft($version, 3) = "5.1" Then $version = "XP" EndIf $arch = (GUICtrlRead($Combo1) & "\Program Files (x86)") If Not FileExists($arch) Then $arch = "_x86" ElseIf FileExists($arch) Then $arch = "_x64" EndIf $1 = MsgBox(262144 + 4 + 32, "OSVersion & Arch", (GUICtrlRead($Combo1) & $version & $arch) & @CRLF & "Do you wish to continue?") If $1 = 6 Then ; Begin nested Func $dir = False GUICreate("Marquee Progress RTL", 500, 50, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) $Progress = GUICtrlCreateProgress(10, 10, 480, 25, 0x08, 0x500) GUICtrlSendMsg($Progress, 0x040A, 1, 10) GUISetState() AdlibRegister("Reverse_Dir", 1550) Do RunWait("Dpinst.exe /path " & (GUICtrlRead($Combo1) & "\Windows")) ;Parameters passed from previous Function (this line from original script Until GUIGetMsg() = $GUI_EVENT_CLOSE Exit Func Reverse_Dir() If $dir Then GUICtrlSetStyle($Progress, 0x08, 0x500) $dir = False Else GUICtrlSetStyle($Progress, 0x08, $WS_EX_LAYOUTRTL) $dir = True EndIf EndFunc ;==>Reverse_Dir ; End nested func Exit EndIf EndSwitch WEnd EndFunc ;==>Import Link to comment Share on other sites More sharing options...
Danyfirex Posted March 10, 2014 Share Posted March 10, 2014 I Think, first You should look into the help file to see how AutoIt Works. Saludos  Danysys.com     AutoIt...  UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection  PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut   Link to comment Share on other sites More sharing options...
Solution trashy Posted March 10, 2014 Author Solution Share Posted March 10, 2014 I've only been working with Autoit for a couple months and I,m doing things that are still a bit beyond my comprehension. My terminology isn't always correct and makes it harder to communicate. I've spent hours studying the help file and even more online research so thanks for stating the obvious. This isn't as cool but it works and I have more control of Progress Bar. expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> #include <SendMessage.au3> Import() Func Import() GUICreate("Import all Drivers", 400, 400, -1, -1, BitOR($WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU), BitOR($WS_EX_OVERLAPPEDWINDOW, $WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) $ListView = GUICtrlCreateListView("FileSystem | Drive | ", 50, 40, 300, 190) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $aDrives = DriveGetDrive("Fixed") For $i = 1 To UBound($aDrives) - 1 $sData = DriveGetFileSystem($aDrives[$i]) & " | " & StringUpper($aDrives[$i]) & "" & DriveGetLabel($aDrives[$i]) ; $sData = DriveGetFileSystem($aDrives[$i]) & "|" & StringUpper($aDrives[$i]) & "|" & DriveGetLabel($aDrives[$i]) & "|" GUICtrlCreateListViewItem($sData, $ListView) Next $Label1 = GUICtrlCreateLabel("List of Available Drives to Import From", 60, 20, 275, 24) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Select Drive from dropdown list below", 65, 230, 275, 24) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Combo1 = GUICtrlCreateCombo("", 100, 260, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("OK", 100, 350, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Cancel", 220, 350, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) For $i = 10 To 99 If DriveStatus(Chr($i) & ':') = 'READY' Then If DriveGetType(Chr($i) & ":") = 'FIXED' Then GUICtrlSetData($Combo1, Chr($i) & ':') EndIf Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button2 Exit Case $Button1 $version = StringLeft(FileGetVersion(GUICtrlRead($Combo1) & "\Windows\system32\WinVer.exe"), 3) If StringLeft($version, 3) = "6.1" Then $version = "WIN7" ElseIf StringLeft($version, 3) = "6.0" Then $version = "VISTA" ElseIf StringLeft($version, 3) = "5.1" Then $version = "XP" EndIf $arch = (GUICtrlRead($Combo1) & "\Program Files (x86)") If Not FileExists($arch) Then $arch = "_x86" ElseIf FileExists($arch) Then $arch = "_x64" EndIf $1 = MsgBox(262144 + 4 + 32, "OSVersion & Arch", (GUICtrlRead($Combo1) & $version & $arch) & @CRLF & "Do you wish to continue?") If $1 = 6 Then $hGUI = GUICreate("Test", 400, 20, -1, 250, $WS_POPUP, $WS_EX_TOPMOST) $idProgress = GUICtrlCreateProgress(0, 0, 400, 20, BitOR($PBS_MARQUEE, $PBS_SMOOTH)) $hProgress = GUICtrlGetHandle($idProgress) _SendMessage($hProgress, $PBM_SETMARQUEE, True, 20) ; final parameter is update time in ms GUISetState() Do RunWait("Dpinst.exe /path " & (GUICtrlRead($Combo1) & "\Windows")) Exit Until GUIGetMsg() = $GUI_EVENT_CLOSE Exit EndIf EndSwitch WEnd EndFunc ;==>Import Link to comment Share on other sites More sharing options...
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