Aceguy Posted March 16, 2008 Share Posted March 16, 2008 expandcollapse popup#include <GuiListView.au3> #include <GuiImageList.au3> #include <GuiConstantsEx.au3> #Include <GuiComboBox.au3> #include <Date.au3> $inifile=@MyDocumentsDir&"\Backup.ini" Global Const $HDN_FIRST = -300 Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0 Global Const $HDN_BEGINTRACKA = $HDN_FIRST - 6 Global $hListView Opt("GUIOnEventMode", 1) $Gui = GUICreate("Test", 500, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "quit") $add_folder=GUICtrlCreateButton('',10,10,40,40,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",46) GUICtrlSetOnEvent(-1,"add_folder") guictrlsettip(-1,"Backup a Complete Folder") $add_file=GUICtrlCreateButton('',55,10,40,40,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",134) GUICtrlSetOnEvent(-1,"add_file") guictrlsettip(-1,"Backup a Single File") $output_foler=GUICtrlCreateButton('',450,10,40,40,$BS_ICON) gUICtrlSetImage (-1, "shell32.dll",146) GUICtrlSetOnEvent(-1,"output_folder") $backup_now=GUICtrlCreateButton('',410,10,40,40,$BS_ICON) gUICtrlSetImage (-1, "shell32.dll",7) GUICtrlSetOnEvent(-1,"backup_now") $ir=IniRead($inifile,"config",0,'Not Found') if $ir <> 'Not Found' then guictrlsettip($output_foler,$ir) Else guictrlsettip($output_foler,"Default Output Directory") EndIf $combo1=GUICtrlCreateCombo('Please Select',100,10,100,25) GUICtrlSetData(-1,'Daily|Weekly|Monthly') $log=GUICtrlCreateLabel("Message Log",210,15,175,25) $progress = GUICtrlCreateProgress(210 ,40 , 175, 10) GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x00ff00) GUICtrlSetCursor(-1, 7) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", " ", "wstr", " ") $hListView = _GUICtrlListView_Create($GUI, "Name|Location|ScD|Comments|", 10, 55, 480, 135,bitor($LVS_EX_GRIDLINES,$LVS_REPORT )) _GUICtrlListView_SetExtendedListViewStyle($hListView,bitor($LVS_EX_SUBITEMIMAGES,$LVS_EX_FULLROWSELECT)) _GUICtrlListView_SetColumnWidth($hListView, 0, 75);name _GUICtrlListView_SetColumnWidth($hListView, 1, 225);location _GUICtrlListView_SetColumnWidth($hListView, 2, 35);schedule _GUICtrlListView_SetColumnWidth($hListView, 3, 90);comments _GUICtrlListView_SetColumnWidth($hListView, 4, 25);delete $hImage = _GUIImageList_Create(16, 16, 5, 6) _GUIImageList_AddIcon ($hImage, "shell32.dll", 4);folder 0 _GUIImageList_AddIcon ($hImage, "shell32.dll",54);file 1 _GUIImageList_AddIcon ($hImage, "shell32.dll",31);bin 2 _GUIImageList_AddIcon ($hImage, "shell32.dll",21);tick 3 _GUIImageList_AddIcon ($hImage, "shell32.dll",131);cross 4 _GUICtrlListView_SetImageList($hListView, $hImage, 1) load_settings() GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 sleep(100) WEnd ;------------------------------------------------------------------------------ Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK; Sent by a list-view control when the user clicks an item with the left mouse button Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $sel= DllStructGetData($tInfo, "SubItem") $row=DllStructGetData($tInfo, "Index") ConsoleWrite($row&@LF) if $sel=4 Then _GUICtrlListView_DeleteItem($hListView,$row) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY func add_folder() if guictrlread($combo1) <> 'Please Select' Then $dir = FileSelectFolder("Choose a folder.", "",2) if not @error Then If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Name.","Enter name for you backup.!",""," ","-1","120","-1","-1") Select Case @Error = 0;OK - The string returned is valid $i=_GUICtrlListView_AddItem($hListView, $sInputBoxAnswer,0) ;name _GUICtrlListView_AddSubItem ($hListView, $i,$dir,1, -1) ;location _GUICtrlListView_AddSubItem ($hListView, $i,guictrlread($combo1),2, -1) ;sheduled _GUICtrlListView_AddSubItem ($hListView, $i,'Not Done',3, 4) ;backup last done _GUICtrlListView_AddSubItem ($hListView,$i,'',4,2) ;delete line Case @Error = 1;The Cancel button was pushed Case @Error = 3;The InputBox failed to open EndSelect EndIf Else GUICtrlSetData($log,"Please Choose a Backup Schedule") EndIf EndFunc func add_file() if guictrlread($combo1) <> 'Please Select' Then $dir = FileOpenDialog("Choose a file.",@MyDocumentsDir,"") if not @error Then If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Name.","Enter name for you backup.!",""," ","-1","120","-1","-1") Select Case @Error = 0;OK - The string returned is valid $i=_GUICtrlListView_AddItem($hListView, $sInputBoxAnswer,1) ;name _GUICtrlListView_AddSubItem ($hListView, $i,$dir,1, -1) ;location _GUICtrlListView_AddSubItem ($hListView, $i,guictrlread($combo1),2, -1) ;sheduled _GUICtrlListView_AddSubItem ($hListView, $i,'Not Done',3, 4) ;backup last done _GUICtrlListView_AddSubItem ($hListView,$i,'',4,2) ;delete line Case @Error = 1;The Cancel button was pushed Case @Error = 3;The InputBox failed to open EndSelect EndIf Else GUICtrlSetData($log,"Please Choose a Backup Schedule") EndIf EndFunc func output_folder() local $dir = FileSelectFolder("Choose a folder.",'',1+4) if not @error Then if $dir <> IniRead($inifile,"config",0,'') Then If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(52,"Check!!!","You Backup Directory has been changed," & @CRLF & "or a new one has been created." & @CRLF & "Is this OK.?" & @CRLF) Select Case $iMsgBoxAnswer = 6;Yes $save=$dir DirCreate($dir) IniWrite($inifile,"config",0,$dir) Case $iMsgBoxAnswer = 7;No MsgBox(64,"Nothing Changed","Nothing Has Changed, Click Ok to Continue") EndSelect EndIf EndIf EndFunc Func quit() $ct=_GUICtrlListView_GetItemCount($hListView) for $x= 0 to $ct-1 IniWrite($inifile,"files",$x, _GUICtrlListView_GetItemImage($hListView,$x) &"|"& _ _GUICtrlListView_GetItemText($hListView,$x,0)&"|"& _ _GUICtrlListView_GetItemText($hListView,$x,1)&"|"& _ _GUICtrlListView_GetItemText($hListView,$x,2)&"|"& _ _GUICtrlListView_GetItemText($hListView,$x,3)) next GUIDelete($GUI) Exit EndFunc ;==>quit func load_settings() $var=IniReadSection($inifile,"files") if not @error=1 Then for $c=1 to $var[0][0] $ss=StringSplit($var[$c][1],"|") $i=_GUICtrlListView_AddItem($hListView, $ss[2],$ss[1]) ;name _GUICtrlListView_AddSubItem ($hListView, $i,$ss[3],1, -1) ;location _GUICtrlListView_AddSubItem ($hListView, $i,$ss[4],2, -1) ;sheduled _GUICtrlListView_AddSubItem ($hListView, $i,'Not Done',3, 4);backup last done _GUICtrlListView_AddSubItem ($hListView,$i,'',4,2) ;delete line Next EndIf EndFunc func backup_now() EndFunc [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
GaryFrost Posted March 16, 2008 Share Posted March 16, 2008 Icons don't disappear for me. v3.2.10.0 and v3.2.11.2 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Aassdd Posted March 16, 2008 Share Posted March 16, 2008 Neither for me, try to update. 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