Rewl Posted November 18, 2010 Posted November 18, 2010 (edited) This is my fourth day programming in Auto-It so I'm still new, but I'm trying to make a program for my schools tech support team, where They run it than they can back up the current computers files to the H:\ Drive (Network Drive for that user) Is this the right direction? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Back-Up by Rewl", 393, 288, 192, 124) Global $Button1 = GUICtrlCreateButton("Backup to H:/", 120, 16, 131, 57, $WS_GROUP) Global $Checkbox1 = GUICtrlCreateCheckbox("Favorites", 16, 96, 97, 17) Global $Checkbox2 = GUICtrlCreateCheckbox("Desktop", 16, 120, 97, 17) Global $Checkbox3 = GUICtrlCreateCheckbox("Music", 16, 144, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 DirCreate("H:\Back Up") If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then DirCopy(@FavoritesDir , "H:\Back Up") EndSwitch Edited November 18, 2010 by Rewl [size="1"]Programs: Draw Tool | [/size]
wakillon Posted November 18, 2010 Posted November 18, 2010 (edited) Something like this is a start...#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Back-Up by Rewl", 393, 288, 192, 124) Global $Button1 = GUICtrlCreateButton("Backup to H:/", 120, 16, 131, 57, $WS_GROUP) Global $Checkbox1 = GUICtrlCreateCheckbox("Favorites", 16, 96, 97, 17) Global $Checkbox2 = GUICtrlCreateCheckbox("Desktop", 16, 120, 97, 17) Global $Checkbox3 = GUICtrlCreateCheckbox("Music", 16, 144, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Do $msg = GUIGetMsg() If $msg = $Button1 Then DirCreate("H:\Back Up") If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then ConsoleWrite ( "DirCopy Favorites " & @Crlf ) If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then ConsoleWrite ( "DirCopy Desktop " & @Crlf ) If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then ConsoleWrite ( "DirCopy Music " & @Crlf ) EndIf Until $msg = $GUI_EVENT_CLOSEyou could try with GUICtrlCreateRadio instead of GUICtrlCreateCheckbox and DirCopy has a flag for overwrite files ! Can be usefull for a Backup... Edited November 18, 2010 by wakillon AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0 - WIN 11 24H2 X64 - Other Examples Scripts
AdmiralAlkex Posted November 18, 2010 Posted November 18, 2010 (edited) You are not reading the checkbox the right way, see GUICtrlRead() in the helpfile. Also that DirCreate() looks unnecessary. Again, see helpfile for DirCopy(). Edited November 18, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Rewl Posted November 18, 2010 Author Posted November 18, 2010 okay thanks for the help guys! [size="1"]Programs: Draw Tool | [/size]
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