blckpythn Posted April 20, 2010 Share Posted April 20, 2010 (edited) I am creating a GUI in Koda for xcopy. Within the generated script there is a Switch...Case with a case for every button, input field, and checkbox. Can someone please explain to me how exactly to use this the wiki didn't quite satisfy my curiosity. For instance While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Source Case $BrowseSource = $GUI_ENABLE Button to browse for source folder FileSelectFolder("Select Source", Default, 7, Default) Case $Destination Case $BrowseDest = $GUI_ENABLE Button to browse for destination folder FileSelectFolder("Select Destination", Default, 7, Default) Case $A = $GUI_CHECKED Checkbox to add parameter Command here Case $M = $GUI_CHECKED Checkbox to add parameter Command here Case $D = $GUI_CHECKED Checkbox to add parameter Command here Will the buttons work as defined or am I using it wrong. How do I link the $source input field to the $browsesource gui button variable and allow drag n drop for file paths. If you need the whole code to better understand I will post it. Edited April 20, 2010 by blckpythn Link to comment Share on other sites More sharing options...
Zedna Posted April 20, 2010 Share Posted April 20, 2010 Yes, more code is needed (GUI part). Also look at examples in Autoit's helpfile at GUICreate, GUICtrlCreateButton, FileSelectFolder Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
blckpythn Posted April 20, 2010 Author Share Posted April 20, 2010 (edited) Yes, more code is needed (GUI part). Also look at examples in Autoit's helpfile at GUICreate, GUICtrlCreateButton, FileSelectFolder Here you go expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\users\matthew\desktop\autoit\xcopy\xcopy gui.kxf $XCopy_GUI = GUICreate("XCopy GUI - msdewart", 401, 326, 250, 164) GUISetIcon("D:\009.ico") $Parameters = GUICtrlCreateGroup("", 10, 5, 380, 270) $Source = GUICtrlCreateInput("Source", 30, 25, 260, 21) $BrowseSource = GUICtrlCreateButton("Browse", 300, 25, 80, 25, $WS_GROUP) $Destination = GUICtrlCreateInput("Destination", 30, 55, 260, 21) $BrowseDest = GUICtrlCreateButton("Browse", 300, 55, 80, 25, $WS_GROUP) $A = GUICtrlCreateCheckbox("/A", 30, 85, 129, 17) $M = GUICtrlCreateCheckbox("/M", 30, 105, 97, 17) $D = GUICtrlCreateCheckbox("/D:m-d-y", 30, 125, 97, 17) $EXCLUDE = GUICtrlCreateCheckbox("/EXCLUDE", 30, 145, 129, 17) $P = GUICtrlCreateCheckbox("/P", 30, 165, 97, 17) $S = GUICtrlCreateCheckbox("/S", 30, 185, 97, 17) $E = GUICtrlCreateCheckbox("/E", 30, 205, 97, 17) $V = GUICtrlCreateCheckbox("/V", 30, 225, 97, 17) $W = GUICtrlCreateCheckbox("/W", 30, 245, 97, 17) $T = GUICtrlCreateCheckbox("/T", 160, 245, 97, 17) $R = GUICtrlCreateCheckbox("/R", 160, 225, 97, 17) $H = GUICtrlCreateCheckbox("/H", 160, 205, 97, 17) $G = GUICtrlCreateCheckbox("/G", 160, 185, 97, 17) $L = GUICtrlCreateCheckbox("/L", 160, 165, 97, 17) $F = GUICtrlCreateCheckbox("/F", 160, 145, 129, 17) $Q = GUICtrlCreateCheckbox("/Q", 160, 125, 97, 17) $I = GUICtrlCreateCheckbox("/I", 160, 105, 97, 17) $C = GUICtrlCreateCheckbox("/C", 160, 85, 129, 17) $Z = GUICtrlCreateCheckbox("/Z", 290, 223, 97, 17) $Y2 = GUICtrlCreateCheckbox("/-Y", 290, 203, 97, 17) $Y = GUICtrlCreateCheckbox("/Y", 290, 183, 97, 17) $X = GUICtrlCreateCheckbox("/X", 290, 163, 97, 17) $O = GUICtrlCreateCheckbox("/O", 290, 143, 129, 17) $N = GUICtrlCreateCheckbox("/N", 290, 123, 97, 17) $K = GUICtrlCreateCheckbox("/K", 290, 103, 97, 17) $U = GUICtrlCreateCheckbox("/U", 290, 83, 129, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Copy = GUICtrlCreateButton("&Copy", 290, 280, 90, 35, $WS_GROUP) $Close = GUICtrlCreateButton("&Close", 200, 285, 80, 25, $WS_GROUP) $Help = GUICtrlCreateButton("Help", 20, 285, 80, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $xcopyparam = ;variable will consist of all checkboxes source and destination. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Source = $BrowseSource Case $BrowseSource = $GUI_ENABLE FileSelectFolder("Select Source", Default, 7, Default) Case $Destination = $BrowseDest Case $BrowseDest = $GUI_ENABLE FileSelectFolder("Select Destination", Default, 7, Default) Case $A = $GUI_CHECKED $xcopyparam &= " /A" Case $M = $GUI_CHECKED $xcopyparam &= " /M" Case $D = $GUI_CHECKED $xcopyparam &= " /D" Case $EXCLUDE = $GUI_CHECKED $xcopyparam &= " /EXCLUDE" Case $P = $GUI_CHECKED $xcopyparam &= " /P" Case $S = $GUI_CHECKED $xcopyparam &= " /S" Case $E = $GUI_CHECKED $xcopyparam &= " /E" Case $V = $GUI_CHECKED $xcopyparam &= " /V" Case $W = $GUI_CHECKED $xcopyparam &= " /W" Case $T = $GUI_CHECKED $xcopyparam &= " /T" Case $R = $GUI_CHECKED $xcopyparam &= " /R" Case $H = $GUI_CHECKED $xcopyparam &= " /H" Case $G = $GUI_CHECKED $xcopyparam &= " /G" Case $L = $GUI_CHECKED $xcopyparam &= " /L" Case $F = $GUI_CHECKED $xcopyparam &= " /F" Case $Q = $GUI_CHECKED $xcopyparam &= " /Q" Case $I = $GUI_CHECKED $xcopyparam &= " /I" Case $C = $GUI_CHECKED $xcopyparam &= " /C" Case $Z = $GUI_CHECKED $xcopyparam &= " /Z" Case $Y2 = $GUI_CHECKED $xcopyparam &= " /-Y" $Y = $GUI_DISABLE Case $Y = $GUI_CHECKED $xcopyparam &= " /Y" $Y2 = $GUI_DISABLE Case $X = $GUI_CHECKED $xcopyparam &= " /X" Case $O = $GUI_CHECKED $xcopyparam &= " /O" Case $N = $GUI_CHECKED $xcopyparam &= " /N" Case $K = $GUI_CHECKED $xcopyparam &= " /K" Case $U = $GUI_CHECKED $xcopyparam &= " /U" Case $Copy = $GUI_ENABLE Copy() Case $Close = $GUI_ENABLE Exit Case $Help = $GUI_ENABLE Help() EndSwitch WEnd Func Copy() Run ("cmd.exe /c xcopy " & $xcopyparam, @WindowsDir) EndFunc Func Help() Local $helphandle = FileOpen("\\TTCDATA01\Student_Home\NST\msdewart\Desktop\Xcopy Help info.txt", Default) Local $helptext = FileRead($helphandle, Default) MsgBox(0, "Xcopy GUI Help", @error) Edited April 20, 2010 by blckpythn Link to comment Share on other sites More sharing options...
blckpythn Posted April 21, 2010 Author Share Posted April 21, 2010 Also with my checkboxes how they are now, will it properly remove the $xcopyparam &= " /N" if a box is checked then unchecked? 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