Jump to content

Run Folder content


earl82
 Share

Recommended Posts

Hi

please forgive me but i am not sure how to ask this question.

i have made a GUI to help me add drivers to a .WIM image for systems at work.

the thing is, i don't know how to tell the -ADD DRIVER- button (that i made) to use the content of the labels in the last step.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
GuiCreate("Driver Add",298,228,495,227)
$button1=GuiCtrlCreateButton("Mount",19,33,62,25)
$button2=GuiCtrlCreateButton("Drivers",19,71,62,25)
$button3=GuiCtrlCreateButton("Add Drivers",19,147,63,26)
$button4=GuiCtrlCreateButton("Image",19,109,63,26)
$input1=GuiCtrlCreateInput("Mount folder",91,33,173,20)
$input2=GuiCtrlCreateInput("Drivers Folder",91,71,173,20)
$input3=GuiCtrlCreateInput("Image To Add Drivers To",91,109,173,20)
GuiSetState()

While 1
$msg=GuiGetMsg()
If $msg=-3 Then Exit
If $msg=$button1 Then button1()
If $msg=$button2 Then button2()
If $msg=$button3 Then button3()
If $msg=$button4 Then button4() 
Wend


Func button1()
    $Foldername = FileSelectFolder("Select a folder", "")
GuiCtrlSetData($Input1, $Foldername)
EndFunc

Func button2()
    $Foldername = FileSelectFolder("Select a folder", "")
GuiCtrlSetData($Input2, $Foldername)
EndFunc

Func button3()
EndFunc

Func button4()
    $Foldername = FileSelectFolder("Select a folder", "")
GuiCtrlSetData($Input3, $Foldername)
EndFunc

Can and will someone please help me understand what i need next to make this work.

i have already installed Windows OPK on the system that i am going to use this GUI on.

and this is the command i have to use to add drivers to an image via CMD without ""

"Dism /Image:C:\winpex86\mount /Add-Driver /Driver:c:\driver /Recurse"

Link to comment
Share on other sites

I am a little fuzzy on what you are asking but if the question is how to pull the data from your input boxes and spit something out to CMD here is basically what I think your looking for. It is untested. The second message box shows you what the command would look like. I provided the command syntax commented out.

#RequireAdmin
#include <ButtonConstants.au3>
#include <GuiEdit.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

GUICreate("Driver Add", 298, 228, 495, 227)
$GetMountPath = GUICtrlCreateButton("Mount", 19, 33, 62, 25)
$GetDriversPath = GUICtrlCreateButton("Drivers", 19, 71, 62, 25)
$GetImagePath = GUICtrlCreateButton("Image", 19, 109, 63, 26)
$RunProcess2AddDrivers = GUICtrlCreateButton("Add Drivers", 19, 147, 63, 26)

$input1 = GUICtrlCreateInput("Mount folder", 91, 33, 173, 20)
$input2 = GUICtrlCreateInput("Drivers Folder", 91, 71, 173, 20)
$input3 = GUICtrlCreateInput("Image To Add Drivers To", 91, 109, 173, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GetMountPath
            button1()
        Case $msg = $GetDriversPath
            button2()
        Case $msg = $GetImagePath
            button3()
        Case $msg = $RunProcess2AddDrivers
            MsgBox(0, "", "Your syntax assumes that you have already mounted the image so why have a select button for it?" & @CRLF & @CRLF & "Unless that is if you are planning on running 2 seperate commands.")
            $MountPath = GUICtrlRead($input1)
            $DriverPath = GUICtrlRead($input2)
            ;prevoius 2 commands serve to save you from your self when you might decide to type something into the boxes
            $ImagePath = GUICtrlRead($input3)
            ;previous command not really needed given the syntax that you provided
            MsgBox(0, "", "Dism /Image:" & $MountPath & " /Add-Driver /Driver:" & $DriverPath & " /Recurse")
            ;                         "Dism /Image:C:\winpex86\mount /Add-Driver /Driver:c:\driver /Recurse"
            ;Run(@ComSpec & " /c Dism " & $MountPath & " /Add-Driver /Driver:" & $DriverPath & " /Recurse", '', @SW_SHOW, 1)
            ;In the previous command you may need to provide the full path to Dism if it isn't in the PATH variable. Remove the ; at the beginning of the previous ine to see if it works.
    EndSelect
WEnd

GUIDelete()

Func button1()
    $Foldername = FileSelectFolder("Select a folder", "")
    GUICtrlSetData($input1, $Foldername)
EndFunc   ;==>button1

Func button2()
    $Foldername = FileSelectFolder("Select a folder", "")
    GUICtrlSetData($input2, $Foldername)
EndFunc   ;==>button2

Func button3()
    $Foldername = FileSelectFolder("Select a folder", "")
    GUICtrlSetData($input3, $Foldername)
EndFunc   ;==>button3
Link to comment
Share on other sites

I am a little fuzzy on what you are asking but if the question is how to pull the data from your input boxes and spit something out to CMD here is basically what I think your looking for. It is untested. The second message box shows you what the command would look like. I provided the command syntax commented out.

#RequireAdmin
#include <ButtonConstants.au3>
#include <GuiEdit.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

GUICreate("Driver Add", 298, 228, 495, 227)
$GetMountPath = GUICtrlCreateButton("Mount", 19, 33, 62, 25)
$GetDriversPath = GUICtrlCreateButton("Drivers", 19, 71, 62, 25)
$GetImagePath = GUICtrlCreateButton("Image", 19, 109, 63, 26)
$RunProcess2AddDrivers = GUICtrlCreateButton("Add Drivers", 19, 147, 63, 26)

$input1 = GUICtrlCreateInput("Mount folder", 91, 33, 173, 20)
$input2 = GUICtrlCreateInput("Drivers Folder", 91, 71, 173, 20)
$input3 = GUICtrlCreateInput("Image To Add Drivers To", 91, 109, 173, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GetMountPath
            button1()
        Case $msg = $GetDriversPath
            button2()
        Case $msg = $GetImagePath
            button3()
        Case $msg = $RunProcess2AddDrivers
            MsgBox(0, "", "Your syntax assumes that you have already mounted the image so why have a select button for it?" & @CRLF & @CRLF & "Unless that is if you are planning on running 2 seperate commands.")
            $MountPath = GUICtrlRead($input1)
            $DriverPath = GUICtrlRead($input2)
            ;prevoius 2 commands serve to save you from your self when you might decide to type something into the boxes
            $ImagePath = GUICtrlRead($input3)
            ;previous command not really needed given the syntax that you provided
            MsgBox(0, "", "Dism /Image:" & $MountPath & " /Add-Driver /Driver:" & $DriverPath & " /Recurse")
            ;                         "Dism /Image:C:\winpex86\mount /Add-Driver /Driver:c:\driver /Recurse"
            ;Run(@ComSpec & " /c Dism " & $MountPath & " /Add-Driver /Driver:" & $DriverPath & " /Recurse", '', @SW_SHOW, 1)
            ;In the previous command you may need to provide the full path to Dism if it isn't in the PATH variable. Remove the ; at the beginning of the previous ine to see if it works.
    EndSelect
WEnd

GUIDelete()

Func button1()
    $Foldername = FileSelectFolder("Select a folder", "")
    GUICtrlSetData($input1, $Foldername)
EndFunc   ;==>button1

Func button2()
    $Foldername = FileSelectFolder("Select a folder", "")
    GUICtrlSetData($input2, $Foldername)
EndFunc   ;==>button2

Func button3()
    $Foldername = FileSelectFolder("Select a folder", "")
    GUICtrlSetData($input3, $Foldername)
EndFunc   ;==>button3

Thanks this helps alot!!!!!!!!!!!!!!!!!

but you are right my command was off when i posted the other day.

i do plan to have the ADD DRIVERS button mount the .wim file and add drivers and then commit changes all in one step.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...