JohnRonRiley Posted July 3, 2008 Share Posted July 3, 2008 My ultimate aim is to use a command-line based CD writing utility, which requires the drive letter to be specified in the cmd-line. I have a GUI, with a combo box, and a button to execute the cmd (writes a specific encrypted folder from their local drive). I would like my users to be able to select the appropriate drive letter (of their writer), then click the button to execute the job. I need to selected drive letter from the combo box to be returned and 'inserted' in to the cmd-line, so when the button is clicked, it writes to the correct drive letter. I'm a total newbie to this, so any basic help on getting started on this problem would be very much appreciated? I've searched the forums for hours, but I can't make much sense of anybody else's fixes, so I'm sorry if this thread has been answered before, but I can't find it? Link to comment Share on other sites More sharing options...
youknowwho4eva Posted July 3, 2008 Share Posted July 3, 2008 I setup my GUICtrlCreateCombo as a variable, then later had it read it to perform certain actions depending on the selection. so maybe a Send(GUICtrlRead()). I'm fairly new also, but I think if you had your gui waiting for a selection to be made to type in the variable that may work. Giggity Link to comment Share on other sites More sharing options...
tlokz Posted July 3, 2008 Share Posted July 3, 2008 Post some of your code would be nice but look up: _GUICtrlComboBox_GetCurSel Link to comment Share on other sites More sharing options...
DaRam Posted July 3, 2008 Share Posted July 3, 2008 This will get you started #include <GUIConstants.au3> Dim $i, $Drv, $Drives, $GUIMain, $GUICboDrive, $GUIBtnBurn $Drv = DriveGetDrive( "CDROM" ) ; "ALL", "CDROM", "REMOVABLE", "FIXED", "NETWORK", "RAMDISK", or "UNKNOWN" If @error Then MsgBox(4096,"Yikes!", "Error Reading Drive Info.") Exit EndIf For $I = 1 To $Drv[0] $Drives &= $Drv[$I] & "|" Next ;$I $GUIMain = GUICreate("Optical Drive Selection") ; , 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2) GUICtrlCreateLabel("Select Drive", 10, 10) $GUICboDrive = GUICtrlCreateCombo("", 70, 5) GUICtrlSetData(-1, $Drives, $Drv[1]) $GUIBtnBurn = GUICtrlCreateButton("Burn It!", 50, 50, 80) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUIBtnBurn $Drives = @ComSpec & " /c " & 'commandline_exe ' & GUICtrlRead($GUICboDrive) GUICtrlSetTip(-1, " Executing " & $Drives) Run($Drives, "") ; , @SW_HIDE) ;<- If you want to hide the Spawned Window EndSwitch WEnd Link to comment Share on other sites More sharing options...
JohnRonRiley Posted July 4, 2008 Author Share Posted July 4, 2008 Thanks for the replies.... The problem I have is that I need to return the drive letter to what is basically the middle of a command line, specified in a variable. $BurnCD = '\CreateCD\CreateCD.exe -r:d SecureCD\*.* -v -eject' There is a tonne of code that runs before this function is called which creates the encrypted folder and some other autorun tools, then it executes the command to burn the files to disc. I need the selected drive letter from the combo box to be returned and inserted into the command line (at '-r:d' 'd' being the drive letter I need to change). I dont mind having a seperate definition for each drive letter if it will make it work, like: $BurnToD = "\CreateCD\CreateCD.exe -r:d SecureCD\*.*" $BurnToE = "\CreateCD\CreateCD.exe -r:e SecureCD\*.*" $BurnToF = "\CreateCD\CreateCD.exe -r:f SecureCD\*.*" etc.... Then have some code that uses the returned drive letter from the combo, and calls the appropriate command from the above. e.g. if <drive letter> equals 'd' then call $BurnToD If <drive letter> equals 'e' then call $BurnToE If <drive letter> equals 'f' then call $BurnToF etc.... I know very little about programming, I'm a hardware engineer, so I appologize if I'm not making myself very clear, and I also appologize for not posting more code, but there is so much (about 600 lines) that I'm not sure what to post. I'm pretty sure everything else in my project is ok (it all seems to work anyway), I'm just struggling with this bit. Thanks again everyone. This will get you started #include <GUIConstants.au3> Dim $i, $Drv, $Drives, $GUIMain, $GUICboDrive, $GUIBtnBurn $Drv = DriveGetDrive( "CDROM" ) ; "ALL", "CDROM", "REMOVABLE", "FIXED", "NETWORK", "RAMDISK", or "UNKNOWN" If @error Then MsgBox(4096,"Yikes!", "Error Reading Drive Info.") Exit EndIf For $I = 1 To $Drv[0] $Drives &= $Drv[$I] & "|" Next ;$I $GUIMain = GUICreate("Optical Drive Selection") ; , 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2) GUICtrlCreateLabel("Select Drive", 10, 10) $GUICboDrive = GUICtrlCreateCombo("", 70, 5) GUICtrlSetData(-1, $Drives, $Drv[1]) $GUIBtnBurn = GUICtrlCreateButton("Burn It!", 50, 50, 80) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $GUIBtnBurn $Drives = @ComSpec & " /c " & 'commandline_exe ' & GUICtrlRead($GUICboDrive) GUICtrlSetTip(-1, " Executing " & $Drives) Run($Drives, "") ; , @SW_HIDE) ;<- If you want to hide the Spawned Window EndSwitch WEnd 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