Sign in to follow this  
Followers 0
trashy

TabItems

7 posts in this topic

#1 ·  Posted (edited)

This is one long switch and the number of TabItems is growing.

I would like to break it up to make it easier to navigate.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Downloads\Oxygen-Icons.org-Oxygen-Apps-utilities-desktop-extra.ico
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Fileversion=2.1.1.0
#AutoIt3Wrapper_Res_LegalCopyright=@TLC
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Allow_Decompile=n
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\TLC\Desktop\DISM1.kxf
$Form1 = GUICreate("DismGui", 621, 441, 192, 124, -1, ($WS_EX_WINDOWEDGE))
$Tab1 = GUICtrlCreateTab(24, 0, 569, 393)
;Start Mount Tab
$TabSheet1 = GUICtrlCreateTabItem("Mount")
GUICtrlSetState(-1, $GUI_SHOW)
$T1Button1 = GUICtrlCreateButton("Browse", 496, 48, 75, 25)
$T1Button2 = GUICtrlCreateButton("Browse", 496, 208, 75, 25)
$T1Button3 = GUICtrlCreateButton("Mount", 184, 352, 75, 25)
$T1Button4 = GUICtrlCreateButton("UnMount", 424, 352, 75, 25)
$T1Checkbox1 = GUICtrlCreateCheckbox("Commit", 360, 355, 65, 17)
$T1Checkbox2 = GUICtrlCreateCheckbox("ReadOnly", 265, 355, 65, 17)
$T1Label1 = GUICtrlCreateLabel("Mount Image", 272, 32, 66, 17)
$T1Label2 = GUICtrlCreateLabel("Source", 56, 48, 38, 17)
$T1Label3 = GUICtrlCreateLabel("Mount Folder", 45, 208, 62, 17)
$T1Label4 = GUICtrlCreateLabel("Image Index", 40, 352, 62, 17)
$T1Input1 = GUICtrlCreateInput("", 112, 48, 370, 21)
$T1Input2 = GUICtrlCreateInput("", 112, 208, 370, 21)
$T1Input3 = GUICtrlCreateInput("1", 120, 352, 35, 25)
GUICtrlCreateUpdown($T1Input3)
GUICtrlSetLimit(-1, 10, 1)
$T1Edit1 = GUICtrlCreateEdit("", 112, 80, 370, 125)
GUICtrlSetData(-1, "")
$T1Edit2 = GUICtrlCreateEdit("", 112, 240, 370, 110)
GUICtrlSetData(-1, "")
;Start Driver Tab
$TabSheet2 = GUICtrlCreateTabItem("Drivers")
$T2Button0 = GUICtrlCreateButton("Browse", 504, 48, 75, 25)
$T2Button1 = GUICtrlCreateButton("Browse", 416, 298, 75, 25)
$T2Button2 = GUICtrlCreateButton("ADD", 504, 298, 75, 25)
$T2Button3 = GUICtrlCreateButton("Browse", 416, 352, 75, 25)
$T2Button4 = GUICtrlCreateButton("ADD", 504, 352, 75, 25)
$T2Button5 = GUICtrlCreateButton("Driver Info", 504, 245, 75, 25)
$T2Input0 = GUICtrlCreateInput("", 120, 48, 370, 21)
$T2Input1 = GUICtrlCreateInput("", 120, 298, 281, 21)
$T2Input2 = GUICtrlCreateInput("", 120, 352, 281, 21)
$T2Label0 = GUICtrlCreateLabel("Mount Folder", 45, 48, 62, 17)
$T2Label1 = GUICtrlCreateLabel("Single Driver", 56, 298, 64, 17)
$T2Label2 = GUICtrlCreateLabel("Driver Folder", 56, 352, 64, 17)
$T2Label3 = GUICtrlCreateLabel("Retrieve Driver Info from Mounted Image", 300, 245, 200, 17)
$T2Edit1 = GUICtrlCreateEdit("", 120, 80, 370, 155)
GUICtrlSetData(-1, "")
;Tabs not set
$TabSheet3 = GUICtrlCreateTabItem("Packages")
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("EXIT", 272, 408, 75, 25)
$Button2 = GUICtrlCreateButton("Clean", 24, 408, 75, 25)
$Label1 = GUICtrlCreateLabel("Clean Corrupt Mount Points", 104, 408, 69, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Run = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($Run, 2)
$data = StdoutRead($Run)
GUICtrlSetData($T1Edit2, $data)
GUICtrlSetData($T2Edit1, $data)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Button1
            If FileExists("newdism.exe") Then
                $sFileOld = "newdism.exe"
                $sFileRenamed = "dism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
            Exit
        Case $T1Button1
            $of_T1Button1 = FileOpenDialog("Select WIM File : """, @HomeDrive, """WIM Files (*.wim)", 1, "")
            GUICtrlSetData($T1Input1, $of_T1Button1)
            If FileExists("dism.exe") Then
                $sFileOld = "dism.exe"
                $sFileRenamed = "newdism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
            $aRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($aRun, 2)
            $aOutput = StdoutRead($aRun)
            GUICtrlSetData($T1Edit1, $aOutput)
            MsgBox(262144, "Wim Info", $aOutput)
        Case $T1Button2
            $of_T1Button2 = FileSelectFolder("Select Mount Folder", "")
            GUICtrlSetData($T1Input2, $of_T1Button2)
            $bRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($bRun, 2)
            $bdata = StdoutRead($bRun)
            GUICtrlSetData($T1Edit2, $bdata)
        Case $T1Button3
            If GUICtrlRead($T1Input1) = "" Then
                MsgBox(0, "Empty.....", "No WIM File Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            $cRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($cRun, 2)
            $cOutput = StdoutRead($cRun)
            $2 = MsgBox(262144 + 4 + 32, "Wim Info", $cOutput & @CRLF & "Do you wish to continue?")
            If $2 = 6 Then
                If GUICtrlRead($T1Checkbox2) = $GUI_CHECKED Then
                    RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2) & """ /ReadOnly")
                    $dRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($dRun, 2)
                    $ddata = StdoutRead($dRun)
                    GUICtrlSetData($T1Edit2, $ddata)
                Else
                    RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2), "")
                    $eRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($eRun, 2)
                    $edata = StdoutRead($eRun)
                    GUICtrlSetData($T1Edit2, $edata)
                EndIf
            EndIf
        Case $T1Button4
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T1Checkbox1) = $GUI_CHECKED Then
                RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /commit")
                $fRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($fRun, 2)
                $fdata = StdoutRead($fRun)
                GUICtrlSetData($T1Edit2, $fdata)
            Else
                RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /discard")
                $gRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($gRun, 2)
                $gdata = StdoutRead($gRun)
                GUICtrlSetData($T1Edit2, $gdata)
            EndIf
        Case $Button2
            Run(@ComSpec & " /c Dism.exe /Cleanup-wim && Pause")
            ;Begin TabItem2
        Case $T2Button0
            $of_T2Button0 = FileSelectFolder("Select Mount Folder", "")
            GUICtrlSetData($T2Input0, $of_T2Button0)
            $kRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($kRun, 2)
            $kdata = StdoutRead($kRun)
            GUICtrlSetData($T2Edit1, $kdata)
        Case $T2Button1
            $of_T2Button1 = FileOpenDialog("Select INF File : """, @HomeDrive, """INF Files (*.inf)", 1, "")
            GUICtrlSetData($T2Input1, $of_T2Button1)
        Case $T2Button2
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T2Input1) = "" Then
                MsgBox(0, "Empty.....", "No Driver Selected!")
                ContinueLoop
            EndIf
            RunWait(@ComSpec & " /k Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input1), "")
            MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
        Case $T2Button3
            $of_T2Button3 = FileSelectFolder("Select Driver Folder", "")
            GUICtrlSetData($T2Input2, $of_T2Button3)
        Case $T2Button4
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Driver Folder Selected!")
                ContinueLoop
            EndIf
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input2) & """ /Recurse && Pause")
            MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
        Case $T2Button5
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
    EndSwitch
WEnd

This was an attempt to break up the script by TabItems to make it easier to navigate.

But now none of the controls on tab2 work

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Downloads\Oxygen-Icons.org-Oxygen-Apps-utilities-desktop-extra.ico
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Fileversion=2.1.1.0
#AutoIt3Wrapper_Res_LegalCopyright=@TLC
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Allow_Decompile=n
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\TLC\Desktop\DISM1.kxf
$Form1 = GUICreate("DismGui", 621, 441, 192, 124, -1, ($WS_EX_WINDOWEDGE))
$Tab1 = GUICtrlCreateTab(24, 0, 569, 393)
;Start Mount Tab
$TabSheet1 = GUICtrlCreateTabItem("Mount")
GUICtrlSetState(-1, $GUI_SHOW)
$T1Button1 = GUICtrlCreateButton("Browse", 496, 48, 75, 25)
$T1Button2 = GUICtrlCreateButton("Browse", 496, 208, 75, 25)
$T1Button3 = GUICtrlCreateButton("Mount", 184, 352, 75, 25)
$T1Button4 = GUICtrlCreateButton("UnMount", 424, 352, 75, 25)
$T1Checkbox1 = GUICtrlCreateCheckbox("Commit", 360, 355, 65, 17)
$T1Checkbox2 = GUICtrlCreateCheckbox("ReadOnly", 265, 355, 65, 17)
$T1Label1 = GUICtrlCreateLabel("Mount Image", 272, 32, 66, 17)
$T1Label2 = GUICtrlCreateLabel("Source", 56, 48, 38, 17)
$T1Label3 = GUICtrlCreateLabel("Mount Folder", 45, 208, 62, 17)
$T1Label4 = GUICtrlCreateLabel("Image Index", 40, 352, 62, 17)
$T1Input1 = GUICtrlCreateInput("", 112, 48, 370, 21)
$T1Input2 = GUICtrlCreateInput("", 112, 208, 370, 21)
$T1Input3 = GUICtrlCreateInput("1", 120, 352, 35, 25)
GUICtrlCreateUpdown($T1Input3)
GUICtrlSetLimit(-1, 10, 1)
$T1Edit1 = GUICtrlCreateEdit("", 112, 80, 370, 125)
GUICtrlSetData(-1, "")
$T1Edit2 = GUICtrlCreateEdit("", 112, 240, 370, 110)
GUICtrlSetData(-1, "")
;Start Driver Tab
$TabSheet2 = GUICtrlCreateTabItem("Drivers")
$T2Button0 = GUICtrlCreateButton("Browse", 504, 48, 75, 25)
$T2Button1 = GUICtrlCreateButton("Browse", 416, 298, 75, 25)
$T2Button2 = GUICtrlCreateButton("ADD", 504, 298, 75, 25)
$T2Button3 = GUICtrlCreateButton("Browse", 416, 352, 75, 25)
$T2Button4 = GUICtrlCreateButton("ADD", 504, 352, 75, 25)
$T2Button5 = GUICtrlCreateButton("Driver Info", 504, 245, 75, 25)
$T2Input0 = GUICtrlCreateInput("", 120, 48, 370, 21)
$T2Input1 = GUICtrlCreateInput("", 120, 298, 281, 21)
$T2Input2 = GUICtrlCreateInput("", 120, 352, 281, 21)
$T2Label0 = GUICtrlCreateLabel("Mount Folder", 45, 48, 62, 17)
$T2Label1 = GUICtrlCreateLabel("Single Driver", 56, 298, 64, 17)
$T2Label2 = GUICtrlCreateLabel("Driver Folder", 56, 352, 64, 17)
$T2Label3 = GUICtrlCreateLabel("Retrieve Driver Info from Mounted Image", 300, 245, 200, 17)
$T2Edit1 = GUICtrlCreateEdit("", 120, 80, 370, 155)
GUICtrlSetData(-1, "")
;Tabs not set
$TabSheet3 = GUICtrlCreateTabItem("Packages")
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("EXIT", 272, 408, 75, 25)
$Button2 = GUICtrlCreateButton("Clean", 24, 408, 75, 25)
$Label1 = GUICtrlCreateLabel("Clean Corrupt Mount Points", 104, 408, 69, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Run = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($Run, 2)
$data = StdoutRead($Run)
GUICtrlSetData($T1Edit2, $data)
GUICtrlSetData($T2Edit1, $data)

tab1()
Func tab1()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE, $Button1
                If FileExists("newdism.exe") Then
                    $sFileOld = "newdism.exe"
                    $sFileRenamed = "dism.exe"
                    FileMove($sFileOld, $sFileRenamed)
                EndIf
                Exit
            Case $T1Button1
                $of_T1Button1 = FileOpenDialog("Select WIM File : """, @HomeDrive, """WIM Files (*.wim)", 1, "")
                GUICtrlSetData($T1Input1, $of_T1Button1)
                If FileExists("dism.exe") Then
                    $sFileOld = "dism.exe"
                    $sFileRenamed = "newdism.exe"
                    FileMove($sFileOld, $sFileRenamed)
                EndIf
                $aRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($aRun, 2)
                $aOutput = StdoutRead($aRun)
                GUICtrlSetData($T1Edit1, $aOutput)
                MsgBox(262144, "Wim Info", $aOutput)
            Case $T1Button2
                $of_T1Button2 = FileSelectFolder("Select Mount Folder", "")
                GUICtrlSetData($T1Input2, $of_T1Button2)
                $bRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($bRun, 2)
                $bdata = StdoutRead($bRun)
                GUICtrlSetData($T1Edit2, $bdata)
            Case $T1Button3
                If GUICtrlRead($T1Input1) = "" Then
                    MsgBox(0, "Empty.....", "No WIM File Selected!")
                    ContinueLoop
                EndIf
                If GUICtrlRead($T1Input2) = "" Then
                    MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                    ContinueLoop
                EndIf
                $cRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($cRun, 2)
                $cOutput = StdoutRead($cRun)
                $2 = MsgBox(262144 + 4 + 32, "Wim Info", $cOutput & @CRLF & "Do you wish to continue?")
                If $2 = 6 Then
                    If GUICtrlRead($T1Checkbox2) = $GUI_CHECKED Then
                        RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2) & """ /ReadOnly")
                        $dRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                        ProcessWaitClose($dRun, 2)
                        $ddata = StdoutRead($dRun)
                        GUICtrlSetData($T1Edit2, $ddata)
                    Else
                        RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2), "")
                        $eRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                        ProcessWaitClose($eRun, 2)
                        $edata = StdoutRead($eRun)
                        GUICtrlSetData($T1Edit2, $edata)
                    EndIf
                EndIf
            Case $T1Button4
                If GUICtrlRead($T1Input2) = "" Then
                    MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                    ContinueLoop
                EndIf
                If GUICtrlRead($T1Checkbox1) = $GUI_CHECKED Then
                    RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /commit")
                    $fRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($fRun, 2)
                    $fdata = StdoutRead($fRun)
                    GUICtrlSetData($T1Edit2, $fdata)
                Else
                    RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /discard")
                    $gRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($gRun, 2)
                    $gdata = StdoutRead($gRun)
                    GUICtrlSetData($T1Edit2, $gdata)
                EndIf
            Case $Button2
                Run(@ComSpec & " /c Dism.exe /Cleanup-wim && Pause")
                RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
        EndSwitch
    WEnd
EndFunc   ;==>tab1
;Begin TabItem2
Func tab2()
    While 1
        $mMsg = GUIGetMsg()
        Switch $mMsg
            Case $GUI_EVENT_CLOSE, $Button1
                If FileExists("newdism.exe") Then
                    $sFileOld = "newdism.exe"
                    $sFileRenamed = "dism.exe"
                    FileMove($sFileOld, $sFileRenamed)
                EndIf
            Case $T2Button1
                $of_T2Button1 = FileOpenDialog("Select INF File : """, @HomeDrive, """INF Files (*.inf)", 1, "")
                GUICtrlSetData($T2Input1, $of_T2Button1)
            Case $T2Button2
                If GUICtrlRead($T1Input2) = "" Then
                    MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                    ContinueLoop
                EndIf
                If GUICtrlRead($T2Input1) = "" Then
                    MsgBox(0, "Empty.....", "No Driver Selected!")
                    ContinueLoop
                EndIf
                RunWait(@ComSpec & " /k Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input1), "")
                MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
            Case $T2Button3
                $of_T2Button3 = FileSelectFolder("Select Driver Folder", "")
                GUICtrlSetData($T2Input2, $of_T2Button3)
            Case $T2Button4
                If GUICtrlRead($T2Input0) = "" Then
                    MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                    ContinueLoop
                EndIf
                If GUICtrlRead($T2Input0) = "" Then
                    MsgBox(0, "Empty.....", "No Driver Folder Selected!")
                    ContinueLoop
                EndIf
                RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input2) & """ /Recurse && Pause")
                MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
            Case $T2Button5
                If GUICtrlRead($T2Input0) = "" Then
                    MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                    ContinueLoop
                EndIf
                RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
        EndSwitch
    WEnd
EndFunc   ;==>tab2
Edited by trashy

Share this post


Link to post
Share on other sites



I tried this too and most everything works but extremely sluggish.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Downloads\Oxygen-Icons.org-Oxygen-Apps-utilities-desktop-extra.ico
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_Fileversion=2.1.1.0
#AutoIt3Wrapper_Res_LegalCopyright=@TLC
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Allow_Decompile=n
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\TLC\Desktop\DISM1.kxf
$Form1 = GUICreate("DismGui", 621, 441, 192, 124, -1, ($WS_EX_WINDOWEDGE))
$Tab1 = GUICtrlCreateTab(24, 0, 569, 393)
;Start Mount Tab
$TabSheet1 = GUICtrlCreateTabItem("Mount")
GUICtrlSetState(-1, $GUI_SHOW)
$T1Button1 = GUICtrlCreateButton("Browse", 496, 48, 75, 25)
$T1Button2 = GUICtrlCreateButton("Browse", 496, 208, 75, 25)
$T1Button3 = GUICtrlCreateButton("Mount", 184, 352, 75, 25)
$T1Button4 = GUICtrlCreateButton("UnMount", 424, 352, 75, 25)
$T1Checkbox1 = GUICtrlCreateCheckbox("Commit", 360, 355, 65, 17)
$T1Checkbox2 = GUICtrlCreateCheckbox("ReadOnly", 265, 355, 65, 17)
$T1Label1 = GUICtrlCreateLabel("Mount Image", 272, 32, 66, 17)
$T1Label2 = GUICtrlCreateLabel("Source", 56, 48, 38, 17)
$T1Label3 = GUICtrlCreateLabel("Mount Folder", 45, 208, 62, 17)
$T1Label4 = GUICtrlCreateLabel("Image Index", 40, 352, 62, 17)
$T1Input1 = GUICtrlCreateInput("", 112, 48, 370, 21)
$T1Input2 = GUICtrlCreateInput("", 112, 208, 370, 21)
$T1Input3 = GUICtrlCreateInput("1", 120, 352, 35, 25)
GUICtrlCreateUpdown($T1Input3)
GUICtrlSetLimit(-1, 10, 1)
$T1Edit1 = GUICtrlCreateEdit("", 112, 80, 370, 125)
GUICtrlSetData(-1, "")
$T1Edit2 = GUICtrlCreateEdit("", 112, 240, 370, 110)
GUICtrlSetData(-1, "")
;Start Driver Tab
$TabSheet2 = GUICtrlCreateTabItem("Drivers")
$T2Button0 = GUICtrlCreateButton("Browse", 504, 48, 75, 25)
$T2Button1 = GUICtrlCreateButton("Browse", 416, 298, 75, 25)
$T2Button2 = GUICtrlCreateButton("ADD", 504, 298, 75, 25)
$T2Button3 = GUICtrlCreateButton("Browse", 416, 352, 75, 25)
$T2Button4 = GUICtrlCreateButton("ADD", 504, 352, 75, 25)
$T2Button5 = GUICtrlCreateButton("Driver Info", 504, 245, 75, 25)
$T2Input0 = GUICtrlCreateInput("", 120, 48, 370, 21)
$T2Input1 = GUICtrlCreateInput("", 120, 298, 281, 21)
$T2Input2 = GUICtrlCreateInput("", 120, 352, 281, 21)
$T2Label0 = GUICtrlCreateLabel("Mount Folder", 45, 48, 62, 17)
$T2Label1 = GUICtrlCreateLabel("Single Driver", 56, 298, 64, 17)
$T2Label2 = GUICtrlCreateLabel("Driver Folder", 56, 352, 64, 17)
$T2Label3 = GUICtrlCreateLabel("Retrieve Driver Info from Mounted Image", 300, 245, 200, 17)
$T2Edit1 = GUICtrlCreateEdit("", 120, 80, 370, 155)
GUICtrlSetData(-1, "")
;Tabs not set
$TabSheet3 = GUICtrlCreateTabItem("Packages")
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("EXIT", 272, 408, 75, 25)
$Button2 = GUICtrlCreateButton("Clean", 24, 408, 75, 25)
$Label1 = GUICtrlCreateLabel("Clean Corrupt Mount Points", 104, 408, 69, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Run = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
ProcessWaitClose($Run, 2)
$data = StdoutRead($Run)
GUICtrlSetData($T1Edit2, $data)
GUICtrlSetData($T2Edit1, $data)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Button1
            If FileExists("newdism.exe") Then
                $sFileOld = "newdism.exe"
                $sFileRenamed = "dism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
            Exit
        Case $T1Button1
            $of_T1Button1 = FileOpenDialog("Select WIM File : """, @HomeDrive, """WIM Files (*.wim)", 1, "")
            GUICtrlSetData($T1Input1, $of_T1Button1)
            If FileExists("dism.exe") Then
                $sFileOld = "dism.exe"
                $sFileRenamed = "newdism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
            $aRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($aRun, 2)
            $aOutput = StdoutRead($aRun)
            GUICtrlSetData($T1Edit1, $aOutput)
            MsgBox(262144, "Wim Info", $aOutput)
        Case $T1Button2
            $of_T1Button2 = FileSelectFolder("Select Mount Folder", "")
            GUICtrlSetData($T1Input2, $of_T1Button2)
            $bRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($bRun, 2)
            $bdata = StdoutRead($bRun)
            GUICtrlSetData($T1Edit2, $bdata)
        Case $T1Button3
            If GUICtrlRead($T1Input1) = "" Then
                MsgBox(0, "Empty.....", "No WIM File Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            $cRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($cRun, 2)
            $cOutput = StdoutRead($cRun)
            $2 = MsgBox(262144 + 4 + 32, "Wim Info", $cOutput & @CRLF & "Do you wish to continue?")
            If $2 = 6 Then
                If GUICtrlRead($T1Checkbox2) = $GUI_CHECKED Then
                    RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2) & """ /ReadOnly")
                    $dRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($dRun, 2)
                    $ddata = StdoutRead($dRun)
                    GUICtrlSetData($T1Edit2, $ddata)
                Else
                    RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2), "")
                    $eRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($eRun, 2)
                    $edata = StdoutRead($eRun)
                    GUICtrlSetData($T1Edit2, $edata)
                EndIf
            EndIf
        Case $T1Button4
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T1Checkbox1) = $GUI_CHECKED Then
                RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /commit")
                $fRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($fRun, 2)
                $fdata = StdoutRead($fRun)
                GUICtrlSetData($T1Edit2, $fdata)
            Else
                RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /discard")
                $gRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($gRun, 2)
                $gdata = StdoutRead($gRun)
                GUICtrlSetData($T1Edit2, $gdata)
            EndIf
        Case $Button2
            Run(@ComSpec & " /c Dism.exe /Cleanup-wim && Pause")
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
    EndSwitch
    ;Begin TabItem2
    $mMsg = GUIGetMsg()
    Switch $mMsg
        Case $GUI_EVENT_CLOSE, $Button1
            If FileExists("newdism.exe") Then
                $sFileOld = "newdism.exe"
                $sFileRenamed = "dism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
        Case $T2Button1
            $of_T2Button1 = FileOpenDialog("Select INF File : """, @HomeDrive, """INF Files (*.inf)", 1, "")
            GUICtrlSetData($T2Input1, $of_T2Button1)
        Case $T2Button2
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T2Input1) = "" Then
                MsgBox(0, "Empty.....", "No Driver Selected!")
                ContinueLoop
            EndIf
            RunWait(@ComSpec & " /k Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input1), "")
            MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
        Case $T2Button3
            $of_T2Button3 = FileSelectFolder("Select Driver Folder", "")
            GUICtrlSetData($T2Input2, $of_T2Button3)
        Case $T2Button4
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Driver Folder Selected!")
                ContinueLoop
            EndIf
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input2) & """ /Recurse && Pause")
            MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
        Case $T2Button5
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                ContinueLoop
            EndIf
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
    EndSwitch
WEnd

If some one could point me in the right direction I'll figure it out.

Share this post


Link to post
Share on other sites

trashy

Why do you call GUIGetMsg and run a Switch twice inside your idle loop? That means that you stand a 50% chance of a control event not being recognised as it has already been pulled from the queue by the other call. :huh:

Just keep all the Case statements inside the one Switch structure - you can test for the controls for all tabs within this. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

That's what I thought, I was just trying to organize things better,

I'm fixing to add 2 more TabItems.

Can't tell I'm a total noob can ya.

Share this post


Link to post
Share on other sites

trashy,

Perhaps if you kept the code for each tab separate by using functions. You can then call the correct function depending on which control was actioned. :)

This should give you the idea: ;)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <Constants.au3>

$Form1 = GUICreate("DismGui", 621, 441, 192, 124, -1, ($WS_EX_WINDOWEDGE))

$Tab1 = GUICtrlCreateTab(24, 0, 569, 393)

;Start Mount Tab
$TabSheet0 = GUICtrlCreateTabItem("Mount")
GUICtrlSetState(-1, $GUI_SHOW)
; Create a dummy control to get the current ControlID
$iStart_0 = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$T1Button1 = GUICtrlCreateButton("Browse", 496, 48, 75, 25)
$T1Button2 = GUICtrlCreateButton("Browse", 496, 208, 75, 25)
$T1Button3 = GUICtrlCreateButton("Mount", 184, 352, 75, 25)
$T1Button4 = GUICtrlCreateButton("UnMount", 424, 352, 75, 25)
$T1Checkbox1 = GUICtrlCreateCheckbox("Commit", 360, 355, 65, 17)
$T1Checkbox2 = GUICtrlCreateCheckbox("ReadOnly", 265, 355, 65, 17)
$T1Label1 = GUICtrlCreateLabel("Mount Image", 272, 32, 66, 17)
$T1Label2 = GUICtrlCreateLabel("Source", 56, 48, 38, 17)
$T1Label3 = GUICtrlCreateLabel("Mount Folder", 45, 208, 62, 17)
$T1Label4 = GUICtrlCreateLabel("Image Index", 40, 352, 62, 17)
$T1Input1 = GUICtrlCreateInput("", 112, 48, 370, 21)
$T1Input2 = GUICtrlCreateInput("", 112, 208, 370, 21)
$T1Input3 = GUICtrlCreateInput("1", 120, 352, 35, 25)
GUICtrlCreateUpdown($T1Input3)
GUICtrlSetLimit(-1, 10, 1)
$T1Edit1 = GUICtrlCreateEdit("", 112, 80, 370, 125)
GUICtrlSetData(-1, "")
$T1Edit2 = GUICtrlCreateEdit("", 112, 240, 370, 110)
GUICtrlSetData(-1, "")
; Create a dummy control to get the current ControlID
$iEnd_0 = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; All the other controls on this tab must be between those 2 values

;Start Driver Tab
$TabSheet1 = GUICtrlCreateTabItem("Drivers")
$iStart_1 = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$T2Button0 = GUICtrlCreateButton("Browse", 504, 48, 75, 25)
$T2Button1 = GUICtrlCreateButton("Browse", 416, 298, 75, 25)
$T2Button2 = GUICtrlCreateButton("ADD", 504, 298, 75, 25)
$T2Button3 = GUICtrlCreateButton("Browse", 416, 352, 75, 25)
$T2Button4 = GUICtrlCreateButton("ADD", 504, 352, 75, 25)
$T2Button5 = GUICtrlCreateButton("Driver Info", 504, 245, 75, 25)
$T2Input0 = GUICtrlCreateInput("", 120, 48, 370, 21)
$T2Input1 = GUICtrlCreateInput("", 120, 298, 281, 21)
$T2Input2 = GUICtrlCreateInput("", 120, 352, 281, 21)
$T2Label0 = GUICtrlCreateLabel("Mount Folder", 45, 48, 62, 17)
$T2Label1 = GUICtrlCreateLabel("Single Driver", 56, 298, 64, 17)
$T2Label2 = GUICtrlCreateLabel("Driver Folder", 56, 352, 64, 17)
$T2Label3 = GUICtrlCreateLabel("Retrieve Driver Info from Mounted Image", 300, 245, 200, 17)
$T2Edit1 = GUICtrlCreateEdit("", 120, 80, 370, 155)
GUICtrlSetData(-1, "")
$iEnd_1 = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;Tabs not set
$TabSheet2 = GUICtrlCreateTabItem("Packages")
$iStart_2 = GUICtrlCreateDummy() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$iEnd_2 = GUICtrlCreateDummy()
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("EXIT", 272, 408, 75, 25)
$Button2 = GUICtrlCreateButton("Clean", 24, 408, 75, 25)
$Label1 = GUICtrlCreateLabel("Clean Corrupt Mount Points", 104, 408, 69, 33)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Button1
            If FileExists("newdism.exe") Then
                $sFileOld = "newdism.exe"
                $sFileRenamed = "dism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
            Exit
        ; If the value is between the 2 dummy ControlID on this tab
        Case $iStart_0 To $iEnd_0 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            ; The control must have been on this tab
            _Tab_0($nMsg)
        Case $iStart_1 To $iEnd_1
            _Tab_1($nMsg)
        Case $iStart_2 To $iEnd_2
            _Tab_2($nMsg)
    EndSwitch
WEnd

; Run teh actions for controls on this tab
Func _Tab_0($nMsg) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Switch $nMsg
        Case $T1Button1
            $of_T1Button1 = FileOpenDialog("Select WIM File : """, @HomeDrive, """WIM Files (*.wim)", 1, "")
            GUICtrlSetData($T1Input1, $of_T1Button1)
            If FileExists("dism.exe") Then
                $sFileOld = "dism.exe"
                $sFileRenamed = "newdism.exe"
                FileMove($sFileOld, $sFileRenamed)
            EndIf
            $aRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($aRun, 2)
            $aOutput = StdoutRead($aRun)
            GUICtrlSetData($T1Edit1, $aOutput)
            MsgBox(262144, "Wim Info", $aOutput)
        Case $T1Button2
            $of_T1Button2 = FileSelectFolder("Select Mount Folder", "")
            GUICtrlSetData($T1Input2, $of_T1Button2)
            $bRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($bRun, 2)
            $bdata = StdoutRead($bRun)
            GUICtrlSetData($T1Edit2, $bdata)
        Case $T1Button3
            If GUICtrlRead($T1Input1) = "" Then
                MsgBox(0, "Empty.....", "No WIM File Selected!")
                Return
            EndIf
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                Return
            EndIf
            $cRun = Run(@ComSpec & " /c Dism.exe /Get-WimInfo /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            ProcessWaitClose($cRun, 2)
            $cOutput = StdoutRead($cRun)
            $2 = MsgBox(262144 + 4 + 32, "Wim Info", $cOutput & @CRLF & "Do you wish to continue?")
            If $2 = 6 Then
                If GUICtrlRead($T1Checkbox2) = $GUI_CHECKED Then
                    RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2) & """ /ReadOnly")
                    $dRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($dRun, 2)
                    $ddata = StdoutRead($dRun)
                    GUICtrlSetData($T1Edit2, $ddata)
                Else
                    RunWait(@ComSpec & " /k Dism.exe /Mount-Wim /WimFile:""" & GUICtrlRead($T1Input1) & """ /index:""" & GUICtrlRead($T1Input3) & """ /MountDir:""" & GUICtrlRead($T1Input2), "")
                    $eRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                    ProcessWaitClose($eRun, 2)
                    $edata = StdoutRead($eRun)
                    GUICtrlSetData($T1Edit2, $edata)
                EndIf
            EndIf
        Case $T1Button4
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                Return
            EndIf
            If GUICtrlRead($T1Checkbox1) = $GUI_CHECKED Then
                RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /commit")
                $fRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($fRun, 2)
                $fdata = StdoutRead($fRun)
                GUICtrlSetData($T1Edit2, $fdata)
            Else
                RunWait(@ComSpec & " /k Dism.exe /UnMount-Wim /MountDir:""" & GUICtrlRead($T1Input2) & """ /discard")
                $gRun = Run(@ComSpec & " /c Dism.exe /Get-MountedWimInfo", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                ProcessWaitClose($gRun, 2)
                $gdata = StdoutRead($gRun)
                GUICtrlSetData($T1Edit2, $gdata)
            EndIf
        Case $Button2
            Run(@ComSpec & " /c Dism.exe /Cleanup-wim && Pause")
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
    EndSwitch

EndFunc

Func _Tab_1($nMsg)
    Switch $nMsg
        Case $T2Button1
            $of_T2Button1 = FileOpenDialog("Select INF File : """, @HomeDrive, """INF Files (*.inf)", 1, "")
            GUICtrlSetData($T2Input1, $of_T2Button1)
        Case $T2Button2
            If GUICtrlRead($T1Input2) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                Return
            EndIf
            If GUICtrlRead($T2Input1) = "" Then
                MsgBox(0, "Empty.....", "No Driver Selected!")
                Return
            EndIf
            RunWait(@ComSpec & " /k Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input1), "")
            MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
        Case $T2Button3
            $of_T2Button3 = FileSelectFolder("Select Driver Folder", "")
            GUICtrlSetData($T2Input2, $of_T2Button3)
        Case $T2Button4
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                return
            EndIf
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Driver Folder Selected!")
                Return
            EndIf
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Add-Driver /Driver:""" & GUICtrlRead($T2Input2) & """ /Recurse && Pause")
            MsgBox(0, "Finished", "If you are satisfied with results" & @CRLF & "And finished injecting drivers" & @CRLF & "Click Commit and UnMount")
        Case $T2Button5
            If GUICtrlRead($T2Input0) = "" Then
                MsgBox(0, "Empty.....", "No Mount Folder Selected!")
                Return
            EndIf
            RunWait(@ComSpec & " /c Dism.exe /Image:""" & GUICtrlRead($T2Input0) & """ /Get-Drivers && Pause")
    EndSwitch
EndFunc

Func _Tab_2($nMsg)

EndFunc
Now you at least keep the main idel loop short and swwet and deal with each tab in a separate function - shoudl make things a lot clearer. Please ask if you have any questions. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks Melba23

That's perfect, exactly what I was looking for,

will make things so much easier to keep track of .

Thank you

Share this post


Link to post
Share on other sites

trashy,

Glad I could help. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0