Auto, computer and electronics hardware hacking. Electronic projects, system administration scripts, ideas and anything fun and/or geeky :)
Wednesday, February 18, 2009
Canon PowerShot SD750 Button Board Repair / Replacement
Monday, October 6, 2008
Outlook CSV Import
OutlookCSVImport - Import a CSV file into Outlook.
Match up the necessary fields and modify the script if needed. Remove or add any additional fields.
Download Microsoft Outlook VBA Language Reference for other properties that were not listed here.
There were 4 properties in an export i originally created this for that do not have a corresponding field in Outlook. I added them as part of the Body field (notes field).
The script will add the excel file into the default Outlook Contacts folder. Something to keep in mind while testing :)
Sort the Excel file by the FileAs field. My export came from http://www.codetwo.com/ Outlook export tool.
The client this was made for had custom fields that Outlook would not export out. The third party tool did a great job.
Renamed a few of the custom contact fields to what was needed and set the rest to be part of notes.
Outlook's natural import/export function with the "Map Custom Fields" does not work correctly. Quite a few existing Outlook fields,
do not export or import, even while it creates a csv column entry for the field (nickname is one example).
Called Microsoft on this issue. Will see what answer they come up with.
If the program crashes at any point look for the contact that crashed it, i had a field with a #name? in it that caused a crash.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=OutlookCSVImport.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs OutlookCSVImport - Import a CSV file into Outlook. Match up the necessary fields and modify the script if needed. Remove or add any additional fields. Based on http://tinyurl.com/4uce9k Download Microsoft Outlook VBA Language Reference for other properties that were not listed here. There were 4 properties in an export i originally created this for that do not have a corresponding field in Outlook. I added them as part of the Body field (notes field). The script will add the excel file into the default Outlook Contacts folder. Something to keep in mind while testing :) Sort the Excel file by the FileAs field. My export came from http://www.codetwo.com/ Outlook export tool. The client this was made for had custom fields that Outlook would not export out. The third party tool did a great job. Renamed a few of the custom contact fields to what was needed and set the rest to be part of notes. Outlook's natural import/export function with the "Map Custom Fields" does not work correctly. Quite a few existing Outlook fields, do not export or import, even while it creates a csv column entry for the field (nickname is one example). Called Microsoft on this issue. Will see what answer they come up with. Visit http://nyitsupport.blogspot.com for an update. If the program crashes at any point look for the contact that crashed it, i had a field with a #name? in it that caused a crash. Alex Belenkiy ab@nyitsupport.com 10/06/08 #ce Const $olContactItem = 2 $objOutlook = ObjCreate("Outlook.Application") $objExcel = ObjCreate("Excel.Application") $ExcelFile = FileOpenDialog("Please choose an Excel file to open", @WorkingDir, "Excel Files (*.xls;*.xlsx;*.csv)",1) $objWorkbook = $objExcel.Workbooks.Open($ExcelFile) $x = 2 Do $objContact = $objOutlook.CreateItem($olContactItem) ;--------------------------------------------------------------------------------------------- $objContact.AssistantName = $objExcel.Cells($x,2).Value $objContact.AssistantTelephoneNumber = $objExcel.Cells($x,3).Value $objContact.Body = "Assistant's Email: " & $objExcel.Cells($x,1).Value & @CRLF & "Contact Type: " & $objExcel.Cells($x,13).Value & @CRLF & "Contacts: " & $objExcel.Cells($x,14).Value & @CRLF & "Cross Street: " & $objExcel.Cells($x,15).Value & @CRLF & "Private Number: " & $objExcel.Cells($x,49).Value & @CRLF & @CRLF & @CRLF & $objExcel.Cells($x,4).Value $objContact.BusinessAddress = $objExcel.Cells($x,5).Value $objContact.BusinessAddressCity = $objExcel.Cells($x,6).Value $objContact.BusinessAddressPostalCode = $objExcel.Cells($x,7).Value $objContact.BusinessAddressState = $objExcel.Cells($x,8).Value $objContact.BusinessAddressStreet = $objExcel.Cells($x,9).Value $objContact.Categories = $objExcel.Cells($x,10).Value $objContact.CompanyName = $objExcel.Cells($x,11).Value $objContact.PrimaryTelephoneNumber = $objExcel.Cells($x,12).Value $objContact.Email1Address = $objExcel.Cells($x,16).Value $objContact.Email1DisplayName = $objExcel.Cells($x,17).Value $objContact.Email2Address = $objExcel.Cells($x,18).Value $objContact.Email2DisplayName = $objExcel.Cells($x,19).Value $objContact.Email3Address = $objExcel.Cells($x,20).Value $objContact.Email3DisplayName = $objExcel.Cells($x,21).Value $objContact.BusinessFaxNumber = $objExcel.Cells($x,22).Value $objContact.HomeFaxNumber = $objExcel.Cells($x,23).Value $objContact.OtherFaxNumber = $objExcel.Cells($x,24).Value $objContact.FileAs = $objExcel.Cells($x,25).Value $objContact.FirstName = $objExcel.Cells($x,26).Value $objContact.FullName = $objExcel.Cells($x,27).Value $objContact.HomeAddress = $objExcel.Cells($x,28).Value $objContact.HomeAddressCity = $objExcel.Cells($x,29).Value $objContact.HomeAddressPostalCode = $objExcel.Cells($x,30).Value $objContact.HomeAddressState = $objExcel.Cells($x,31).Value $objContact.HomeAddressStreet = $objExcel.Cells($x,32).Value $objContact.JobTitle = $objExcel.Cells($x,33).Value $objContact.LastName = $objExcel.Cells($x,34).Value $objContact.MiddleName = $objExcel.Cells($x,35).Value $objContact.Nickname = $objExcel.Cells($x,36).Value $objContact.OtherAddress = $objExcel.Cells($x,37).Value $objContact.OtherAddressCity = $objExcel.Cells($x,38).Value $objContact.OtherAddressPostalCode = $objExcel.Cells($x,39).Value $objContact.OtherAddressState = $objExcel.Cells($x,40).Value $objContact.OtherAddressStreet = $objExcel.Cells($x,41).Value $objContact.BusinessTelephoneNumber = $objExcel.Cells($x,42).Value $objContact.Business2TelephoneNumber = $objExcel.Cells($x,43).Value $objContact.CarTelephoneNumber = $objExcel.Cells($x,44).Value $objContact.CompanyMainTelephoneNumber = $objExcel.Cells($x,45).Value $objContact.HomeTelephoneNumber = $objExcel.Cells($x,46).Value $objContact.MobileTelephoneNumber = $objExcel.Cells($x,47).Value $objContact.OtherTelephoneNumber = $objExcel.Cells($x,48).Value $objContact.Spouse = $objExcel.Cells($x,50).Value $objContact.Subject = $objExcel.Cells($x,51).Value $objContact.Title = $objExcel.Cells($x,52).Value $objContact.WebPage = $objExcel.Cells($x,53).Value ;--------------------------------------------------------------------------------------------- $objContact.Save $x = $x + 1 Until $objExcel.Cells($x,25).Value = "" $objExcel.Quit |
Tuesday, August 5, 2008
DirList – Directory enumerator / Excel report maker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=DirList.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs DirList Alex Belenkiy - ab@nyitsupport.com 08/05/2008 This script was created with the purpose of enumerating a folder and its contents into an excel file. To use just select the starting path and wait for the Excel sheet to show up. Make sure the machine this is executed on has Excel installed. RecursiveFileSearch function was modified from http://www.autoitscript.com/forum/index.php?showtopic=58558&st=0 #ce #include <array.au3> #include <file.au3> #include <GUIConstants.au3> ;AutoItSetOption("TrayIconHide", 1) $Path = FileSelectFolder("Please select the folder to enumerate", "",4) if @error then Exit $excel = ObjCreate("Excel.Application") $excel.visible = 0 $excel.workbooks.add $row = 1 $col = 1 with $excel.activesheet .cells($row,$col).value = "Listing of " & $Path .cells($row,$col).font.bold = True .cells($row,$col).font.size = 20 .cells($row + 3,$col).value = $Path .cells($row + 3,$col).font.bold = True $row = $row + 4 $col = $col + 1 EndWith $Array = RecursiveFileSearch($Path) ;_ArrayDisplay($Array) $excel.visible = 1 ;$excel.activeworkbook.saveas("Shared.xls") $excel = 0 Func RecursiveFileSearch($RFSstartDir, $RFSpattern = ".", $RFSdepth = 0) ;Ensure starting folder has a trailing slash If StringRight($RFSstartDir, 1) <> "\" Then $RFSstartDir &= "\" If $RFSdepth = 0 Then ;Get count of all files in subfolders for initial array definition $RFSfilecount = DirGetSize($RFSstartDir, 1) Global $RFSarray[$RFSfilecount[1] + 1] EndIf $RFSsearch = FileFindFirstFile($RFSstartDir & "*.*") If @error Then Return ;Search through all files and folders in directory While 1 $RFSnext = FileFindNextFile($RFSsearch) If @error Then ExitLoop ;If folder, recurse If StringInStr(FileGetAttrib($RFSstartDir & $RFSnext), "D") Then with $excel.activesheet .cells($row,$col).font.bold = True .cells($row,$col).value = $RFSnext $row = $row + 1 $col = $col + 1 EndWith RecursiveFileSearch($RFSstartDir & $RFSnext, $RFSpattern, $RFSdepth + 1) $col = $col - 1 Else If StringRegExp($RFSnext, $RFSpattern, 0) Then with $excel.activesheet .cells($row,$col).value = $RFSnext $row = $row + 1 EndWith EndIf EndIf WEnd FileClose($RFSsearch) If $RFSdepth = 0 Then Redim $RFSarray[$RFSarray[0] + 1] Return $RFSarray EndIf EndFunc ;==>RecursiveFileSearch |
Thursday, July 24, 2008
Archiver – Archive out older files by modified date.
This script was created with a purpose of archiving old files from one location to another.
To use, select the date of files to be archived, files on or before that day will be affected.
Type the source folder, all files within the source will be affected. Folder structure will remain.
Select whether to copy, or move the files.
Select whether to create shortcuts to the moved files in the source folder.
There is also an undo function that will put files back based on the log.
Please let me know if there are any bugs in it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=archiver2.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs Archiver. Alex Belenkiy - ab@nyitsupport.com 07/24/2008 This script was created with a purpose of archiving old files from one location to another. To use, select the date of files to be archived, files on or before that day will be affected. Type the source folder, all files within the source will be affected. Folder structure will remain. Select whether to copy, or move the files. Select whether to create shortcuts to the moved files in the source folder. There is also an undo function that will put files back based on the log. RecursiveFileSearch function was modified from http://www.autoitscript.com/forum/index.php?showtopic=58558&st=0 #ce #include <array.au3> #include <file.au3> #include <GUIConstants.au3> AutoItSetOption("TrayIconHide", 1) dim $LogArray dim $jobRunning = "0" dim $PreSetDate = @YEAR & @MON & @MDAY dim $errorSet = "0" dim $fileMove, $Array, $copyMove, $destFolder, $fileMove, $FilePathSplit, $NewDestFolder, $oldFile, $OldFolder, $OldPathSplit dim $FileTotalSize, $fileSize dim $FileModDate dim $UNC Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=\\SRV1\ab\my documents\dev\nyitsupport\archiver\frmarchiver.kxf $frmArchiver = GUICreate("Archiver", 395, 243, 343, 243) GUISetOnEvent($GUI_EVENT_CLOSE, "frmArchiverClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "frmArchiverMinimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "frmArchiverMaximize") GUISetOnEvent($GUI_EVENT_RESTORE, "frmArchiverRestore") $lblDate = GUICtrlCreateLabel("Select files modified on or before:", 8, 8, 176, 21, 0x01) $Date1 = GUICtrlCreateDate("", 192, 8, 194, 21,0x00010000) GUICtrlSetOnEvent(-1, "Date1Change") $btnSource = GUICtrlCreateButton("Source Folder", 8, 40, 97, 21, 0) GUICtrlSetOnEvent(-1, "btnSourceClick") $btnDest = GUICtrlCreateButton("Destination Folder", 8, 70, 97, 21, 0) GUICtrlSetOnEvent(-1, "btnDestClick") $radMove = GUICtrlCreateRadio("Move", 8, 104, 65, 25) GUICtrlSetOnEvent(-1, "radMoveClick") $radCopy = GUICtrlCreateRadio("Copy", 72, 104, 65, 25) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetOnEvent(-1, "radCopyClick") $chkShortcuts = GUICtrlCreateCheckbox("Create Shortcuts In Source Folder", 144, 104, 241, 25) GUICtrlSetOnEvent(-1, "chkShortcutsClick") GUICtrlSetState(-1, $GUI_DISABLE) $btnOK = GUICtrlCreateButton("OK", 40, 136, 148, 49) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetOnEvent(-1, "btnOKClick") $btnUndo = GUICtrlCreateButton("Undo", 216, 136, 140, 49) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent(-1, "btnUndoClick") $txtSource = GUICtrlCreateInput("", 112, 40, 273, 21) $txtDest = GUICtrlCreateInput("", 112, 70, 273, 21) $lblStatus = GUICtrlCreateLabel("", 8, 192, 380, 25, 0x01) $lblCredits1 = GUICtrlCreateLabel("Alex Belenkiy", 8, 224, 76, 17) GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008080) $lblCredits2 = GUICtrlCreateLabel("ab@nyitsupport.com", 277, 224, 108, 17) GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008080) GUICtrlSetState($btnOK, $GUI_DISABLE) GUICtrlSetState($btnDest, $GUI_DISABLE) GUICtrlSetState($txtSource, $GUI_DISABLE) GUICtrlSetState($txtDest, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GuiCtrlSendMsg($Date1, 0x1032, 0, "yyyyMMdd") GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd While 1 Sleep(100) WEnd Func btnOKClick() $FileTotalSize = 0 $fileSize = 0 $PreSetDate = GUICtrlRead($Date1) $sourceFolder = GUICtrlRead($txtSource) $destFolder = GUICtrlRead($txtDest) if GUICtrlRead($radCopy) = $GUI_CHECKED then $copyMove = "Copy" if GUICtrlRead($radMove) = $GUI_CHECKED then $copyMove = "Move" if GUICtrlRead($chkShortcuts) = $GUI_CHECKED then $shortCut = "yes" Else $shortCut = "no" EndIf $jobRunning = "1" GUICtrlSetState($txtSource, $GUI_DISABLE) GUICtrlSetState($btnSource, $GUI_DISABLE) GUICtrlSetState($btnDest, $GUI_DISABLE) GUICtrlSetState($btnOK, $GUI_DISABLE) GUICtrlSetState($btnUndo, $GUI_DISABLE) GUICtrlSetState($Date1, $GUI_DISABLE) GUICtrlSetState($frmArchiver, $GUI_DISABLE) GUICtrlSetState($radCopy, $GUI_DISABLE) GUICtrlSetState($radMove, $GUI_DISABLE) GUICtrlSetState($chkShortcuts, $GUI_DISABLE) GUICtrlSetData($lblStatus, "Please wait for the operation to complete.") If StringRight($sourceFolder, 1) <> "\" Then $sourceFolder &= "\" If StringRight($destFolder, 1) <> "\" Then $destFolder &= "\" $logFile = FileOpen ("Archiver - " & $CopyMove & " - " & @MON & "-" & @MDAY & "-" & @YEAR & " - " & @HOUR & "-" & @MIN & ".csv",9) FileWriteLine ($logFile, "Operation,Shortcut Created,Date,Time,File Size,File Modified Date,Source Folder,Source File,Destination Folder") $Array = RecursiveFileSearch($sourceFolder) For $a = 1 To $Array[0] $NewDestFolder = $destFolder $FilePathSplit = StringSplit($Array[$a], "\") if StringInStr($Array[$a], "\\") <> 0 then $UNC = 4 if StringInStr($Array[$a], ":") <> 0 then $UNC = 2 for $b = $UNC to $FilePathSplit[0] - 1 $NewDestFolder = $NewDestFolder & $FilePathSplit[$b] & "\" Next $oldFile = $FilePathSplit[$FilePathSplit[0]] $OldPathSplit = StringSplit($Array[$a], "\") $OldFolder = StringLeft($Array[$a], StringLen($Array[$a]) - StringLen($OldPathSplit[$OldPathSplit[0]])) $FileTotalSize = $FileTotalSize + $fileSize $fileSize = FileGetSize ($Array[$a]) $FileModDate = StringLeft (FileGetTime ($array[$a], 0,1), 8) if $copyMove = "Move" Then $fileMove = FileMove($Array[$a], $NewDestFolder , 9) if $copyMove = "Copy" Then $fileMove = FileCopy($Array[$a], $NewDestFolder , 9) if $fileMove = 1 then FileWriteLine ($logFile, $CopyMove & "," & $ShortCut & "," & @MON & "/" & @MDAY & "/" & @YEAR & "," & @HOUR & ":" & @MIN & ":" & @SEC & "," & $fileSize & "," & $FileModDate & "," & $OldFolder & "," & $oldFile & "," & $NewDestFolder) if $ShortCut = "yes" then FileCreateShortcut($NewDestFolder & $oldFile, $OldFolder & $oldFile, $NewDestFolder, "", "Link to file that was moved by ARCHIVER") GUICtrlSetData($lblStatus, "Processing " & $a & " / " & $array[0] & @crlf & $array[$a]) Next FileWriteLine($logFile, "-------") FileWriteLine($logFile, "Number of files:" & $Array[0]) FileWriteLine($logFile, "Total size of files: " & Round($FileTotalSize / 1048576, 3) & " MB" & " / " & Round($FileTotalSize / 1073741824, 3) & " GB" ) FileClose($logFile) $jobRunning = "0" GUICtrlSetState($btnSource, $GUI_ENABLE) GUICtrlSetState($btnDest, $GUI_ENABLE) GUICtrlSetState($btnOK, $GUI_ENABLE) GUICtrlSetState($btnUndo, $GUI_ENABLE) GUICtrlSetState($Date1, $GUI_ENABLE) GUICtrlSetState($frmArchiver, $GUI_ENABLE) GUICtrlSetState($radCopy, $GUI_ENABLE) GUICtrlSetState($radMove, $GUI_ENABLE) if GUICtrlRead($radMove) = $GUI_CHECKED Then GUICtrlSetState($chkShortcuts, $GUI_ENABLE) GUICtrlSetData($lblStatus, "") MsgBox(0, "Job Complete", "Number of files:" & $Array[0] & @CRLF & "Total size:" & @CRLF & Round($FileTotalSize / 1048576, 3) & " MB" & @CRLF & Round($FileTotalSize / 1073741824, 3) & " GB") EndFunc Func btnUndoClick() dim $undoCount $logPath = FileOpenDialog("Select log file with undo information", @WorkingDir, "(*.csv)", 1) if not @error Then $UndoLog = FileOpen ("Archiver - UNDO - " & @MON & "-" & @MDAY & "-" & @YEAR & " - " & @HOUR & "-" & @MIN & ".csv",9) FileWriteLine ($UndoLog, "Status,Archived Folder,Archived File,Restore Folder") $jobRunning = "1" GUICtrlSetState($btnSource, $GUI_DISABLE) GUICtrlSetState($btnDest, $GUI_DISABLE) GUICtrlSetState($btnOK, $GUI_DISABLE) GUICtrlSetState($btnUndo, $GUI_DISABLE) GUICtrlSetState($Date1, $GUI_DISABLE) GUICtrlSetState($frmArchiver, $GUI_DISABLE) GUICtrlSetState($radCopy, $GUI_DISABLE) GUICtrlSetState($radMove, $GUI_DISABLE) GUICtrlSetState($chkShortcuts, $GUI_DISABLE) $logFile = FileOpen($logPath,0) $undoCount = _FileCountLines($logPath) dim $undoArray[$undoCount] _FileReadToArray($logPath, $undoArray) for $a = 2 to $undoArray[0] - 3 if $undoArray[$a] = "-------" then ExitLoop $uSplit = StringSplit($undoArray[$a], ",") ;Operation[1],Shortcut Created[2],Date[3],Time[4],File Size[5],File Date[6],Source Folder[7],Source File[8],Destination Folder[9] if FileExists($uSplit[7] & $uSplit[8]) Then $fileSizeSource = FileGetSize($uSplit[9] & $uSplit[8]) ; archive location $fileSizeDest = FileGetSize($uSplit[7] & $uSplit[8]) ; original location $fileModSource = StringLeft(FileGetTime($uSplit[9] & $uSplit[8], 0, 1),8) $fileModDest = StringLeft(FileGetTime($uSplit[7] & $uSplit[8],0,1),8) $replace = MsgBox(36, "File Exists", "Would you like to replace the existing file?" & @CRLF & $uSplit[7] & $uSplit[8] & @CRLF & "Size: " & $fileSizeDest & @CRLF & "Date: " & $fileModDest & @CRLF & @crlf & "With archived file?" & @CRLF & "Size: " & $fileSizeSource & @CRLF & "Date: " & $fileModSource & @CRLF & @crlf & "Will skip the file in 30 seconds", 30) if $replace = 6 Then $fileDelete = FileMove($uSplit[9] & $uSplit[8], $uSplit[7],9) if $fileDelete = 1 then if $uSplit[2] = "yes" then FileDelete($uSplit[7] & $uSplit & ".lnk") FileWriteLine($UndoLog, "Success - Replaced existing file" & "," & $uSplit[9] & "," & $uSplit[8] & "," & $uSplit[7]) Else FileWriteLine($UndoLog, "Failed - Could not replace existing file" & "," & $uSplit[9] & "," & $uSplit[8] & "," & $uSplit[7]) EndIf Else FileWriteLine($UndoLog, "Failed - Existing file replace prompt declined or timed out" & "," & $uSplit[9] & "," & $uSplit[8] & "," & $uSplit[7]) EndIf Else $filedelete = FileMove($uSplit[9] & $uSplit[8], $uSplit[7],9) if $fileDelete = 1 Then if $uSplit[2] = "yes" then FileDelete($uSplit[7] & $uSplit[8] & ".lnk") FileWriteLine($UndoLog, "Success - Replaced moved file" & "," & $uSplit[9] & "," & $uSplit[8] & "," & $uSplit[7]) Else FileWriteLine($UndoLog, "Failed - Could not replace moved file" & "," & $uSplit[9] & "," & $uSplit[8] & "," & $uSplit[7]) EndIf EndIf GUICtrlSetData($lblStatus, "Processing " & $a & " / " & $undoArray[0] - 4 & @CRLF & $uSplit[7] & $uSplit[8]) Next FileClose($UndoLog) $jobRunning = "0" GUICtrlSetState($btnSource, $GUI_ENABLE) GUICtrlSetState($btnDest, $GUI_ENABLE) GUICtrlSetState($btnOK, $GUI_ENABLE) GUICtrlSetState($btnUndo, $GUI_ENABLE) GUICtrlSetState($Date1, $GUI_ENABLE) GUICtrlSetState($frmArchiver, $GUI_ENABLE) GUICtrlSetState($radCopy, $GUI_ENABLE) GUICtrlSetState($radMove, $GUI_ENABLE) if GUICtrlRead($radMove) = $GUI_CHECKED Then GUICtrlSetState($chkShortcuts, $GUI_ENABLE) GUICtrlSetData($lblStatus, "") MsgBox(0, "Undo Completed", "Completed " & $undoArray[0] - 4 & " Files." & @CRLF & "Please check the UNDO log file for any errors.") EndIf EndFunc Func chkShortcutsClick() EndFunc Func Date1Change() EndFunc Func frmArchiverClose() if $jobRunning <> "1" then Exit EndFunc Func frmArchiverMaximize() EndFunc Func frmArchiverMinimize() EndFunc Func frmArchiverRestore() EndFunc Func radCopyClick() GUICtrlSetState($chkShortcuts, $GUI_DISABLE) GUICtrlSetState($chkShortcuts, $GUI_UNCHECKED) EndFunc Func radMoveClick() GUICtrlSetState($chkShortcuts, $GUI_ENABLE) GUICtrlSetState($chkShortcuts, $GUI_CHECKED) EndFunc Func btnDestClick() $destFolder = FileSelectFolder("Destination Folder", "",5) if not @error then $c = StringSplit($destFolder,"\") if not @error Then GUICtrlSetState($btnOK, $GUI_ENABLE) GUICtrlSetData($txtDest, $destFolder) EndIf EndIf EndFunc Func btnSourceClick() GUICtrlSetState($btnDest, $GUI_DISABLE) $sourceFolder = FileSelectFolder("Source Folder", "",4) if not @error then $c = StringSplit($sourceFolder,"\") if not @error Then GUICtrlSetState($btnDest, $GUI_ENABLE) GUICtrlSetData($txtSource, $sourceFolder) EndIf EndIf EndFunc Func RecursiveFileSearch($RFSstartDir, $RFSpattern = ".", $RFSdepth = 0) ;Ensure starting folder has a trailing slash If StringRight($RFSstartDir, 1) <> "\" Then $RFSstartDir &= "\" If $RFSdepth = 0 Then ;Get count of all files in subfolders for initial array definition $RFSfilecount = DirGetSize($RFSstartDir, 1) Global $RFSarray[$RFSfilecount[1] + 1] EndIf $RFSsearch = FileFindFirstFile($RFSstartDir & "*.*") If @error Then Return ;Search through all files and folders in directory While 1 $RFSnext = FileFindNextFile($RFSsearch) If @error Then ExitLoop ;If folder, recurse If StringInStr(FileGetAttrib($RFSstartDir & $RFSnext), "D") Then RecursiveFileSearch($RFSstartDir & $RFSnext, $RFSpattern, $RFSdepth + 1) Else If StringRegExp($RFSnext, $RFSpattern, 0) Then ;Append filename to array $FileDate = StringLeft (FileGetTime ($RFSstartDir & "\" & $RFSnext, 0,1), 8) if $FileDate <= $PreSetDate Then $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext $RFSarray[0] += 1 EndIf ;Increment filecount EndIf EndIf WEnd FileClose($RFSsearch) If $RFSdepth = 0 Then Redim $RFSarray[$RFSarray[0] + 1] Return $RFSarray EndIf EndFunc ;==>RecursiveFileSearch |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | <?xml version="1.0" encoding="windows-1251"?> <object type="TAForm" name="frmArchiver"> <properties> <property name="Left" vt="Int16">342</property> <property name="Top" vt="Int16">242</property> <property name="Width" vt="Int16">402</property> <property name="Height" vt="Int16">269</property> <property name="Caption" vt="String">Archiver</property> <property name="Color" vt="Ident">clBtnFace</property> <property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property> <property name="Font.Color" vt="Ident">clWindowText</property> <property name="Font.Height" vt="Int8">-11</property> <property name="Font.Name" vt="String">MS Sans Serif</property> <property name="Font.Style" vt="Set"/> <property name="OldCreateOrder" vt="True">True</property> <property name="Visible" vt="True">True</property> <property name="Style" vt="Int32">-1798701056</property> <property name="ExStyle" vt="Int16">256</property> <property name="Version" vt="String">1.03</property> <property name="FormOptOnEvent" vt="True">True</property> <property name="FormOptPopulate" vt="True">True</property> <property name="FormOptIndentCount" vt="Int8">0</property> <property name="PixelsPerInch" vt="Int8">96</property> <property name="TextHeight" vt="Int8">13</property> </properties> <components> <object type="TADate" name="Date1"> <properties> <property name="Left" vt="Int16">192</property> <property name="Top" vt="Int8">8</property> <property name="Width" vt="Int16">194</property> <property name="Height" vt="Int8">21</property> <property name="Date" vt="String">7/14/2008</property> <property name="Time" vt="String">5:59:24 PM</property> <property name="TabOrder" vt="Int8">0</property> <property name="CtrlStyle" vt="Int32">1342242816</property> <property name="CtrlExStyle" vt="Int16">512</property> <property name="Resizing" vt="Set">DockHeight</property> </properties> <components/> </object> <object type="TALabel" name="lblDate"> <properties> <property name="Left" vt="Int8">8</property> <property name="Top" vt="Int8">8</property> <property name="Width" vt="Int16">176</property> <property name="Height" vt="Int8">21</property> <property name="AutoSize" vt="False">False</property> <property name="Caption" vt="String">Select files modified on or before:</property> <property name="TabOrder" vt="Int8">12</property> <property name="HaveVariable" vt="False">False</property> <property name="CtrlStyle" vt="Int32">1342177536</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set"/> </properties> <components/> </object> <object type="TARadio" name="radMove"> <properties> <property name="Left" vt="Int8">8</property> <property name="Top" vt="Int8">104</property> <property name="Width" vt="Int8">65</property> <property name="Height" vt="Int8">25</property> <property name="Caption" vt="String">Move</property> <property name="TabOrder" vt="Int8">3</property> <property name="CtrlStyle" vt="Int32">1342242825</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockHeight</property> </properties> <components/> </object> <object type="TARadio" name="radCopy"> <properties> <property name="Left" vt="Int8">72</property> <property name="Top" vt="Int8">104</property> <property name="Width" vt="Int8">65</property> <property name="Height" vt="Int8">25</property> <property name="Caption" vt="String">Copy</property> <property name="Checked" vt="True">True</property> <property name="TabOrder" vt="Int8">4</property> <property name="TabStop" vt="True">True</property> <property name="CtrlStyle" vt="Int32">1342242825</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockHeight</property> </properties> <components/> </object> <object type="TACheckbox" name="chkShortcuts"> <properties> <property name="Left" vt="Int16">144</property> <property name="Top" vt="Int8">104</property> <property name="Width" vt="Int16">241</property> <property name="Height" vt="Int8">25</property> <property name="Caption" vt="String">Create Shortcuts In Source Folder</property> <property name="Enabled" vt="False">False</property> <property name="TabOrder" vt="Int8">5</property> <property name="CtrlStyle" vt="Int32">1342242819</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockHeight</property> </properties> <components/> </object> <object type="TAButton" name="btnOK"> <properties> <property name="Left" vt="Int8">40</property> <property name="Top" vt="Int16">136</property> <property name="Width" vt="Int16">148</property> <property name="Height" vt="Int8">49</property> <property name="Caption" vt="String">OK</property> <property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property> <property name="Font.Color" vt="Ident">clWindowText</property> <property name="Font.Height" vt="Int8">-19</property> <property name="Font.Name" vt="String">MS Sans Serif</property> <property name="Font.Style" vt="Set">fsBold</property> <property name="ParentFont" vt="False">False</property> <property name="TabOrder" vt="Int8">6</property> <property name="CtrlStyle" vt="Int32">1342242816</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockWidth, DockHeight</property> </properties> <components/> </object> <object type="TAButton" name="btnUndo"> <properties> <property name="Left" vt="Int16">216</property> <property name="Top" vt="Int16">136</property> <property name="Width" vt="Int16">140</property> <property name="Height" vt="Int8">49</property> <property name="Caption" vt="String">Undo</property> <property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property> <property name="Font.Color" vt="Ident">clWindowText</property> <property name="Font.Height" vt="Int8">-19</property> <property name="Font.Name" vt="String">MS Sans Serif</property> <property name="Font.Style" vt="Set"/> <property name="ParentFont" vt="False">False</property> <property name="TabOrder" vt="Int8">7</property> <property name="CtrlStyle" vt="Int32">1342242816</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockWidth, DockHeight</property> </properties> <components/> </object> <object type="TAInput" name="txtSource"> <properties> <property name="Left" vt="Int8">112</property> <property name="Top" vt="Int8">40</property> <property name="Width" vt="Int16">273</property> <property name="Height" vt="Int8">21</property> <property name="Enabled" vt="False">False</property> <property name="TabOrder" vt="Int8">8</property> <property name="CtrlStyle" vt="Int32">1342242944</property> <property name="CtrlExStyle" vt="Int16">512</property> <property name="Resizing" vt="Set">DockHeight</property> </properties> <components/> </object> <object type="TAInput" name="txtDest"> <properties> <property name="Left" vt="Int8">112</property> <property name="Top" vt="Int8">70</property> <property name="Width" vt="Int16">273</property> <property name="Height" vt="Int8">21</property> <property name="Enabled" vt="False">False</property> <property name="TabOrder" vt="Int8">9</property> <property name="CtrlStyle" vt="Int32">1342242944</property> <property name="CtrlExStyle" vt="Int16">512</property> <property name="Resizing" vt="Set">DockHeight</property> </properties> <components/> </object> <object type="TALabel" name="lblStatus"> <properties> <property name="Left" vt="Int8">8</property> <property name="Top" vt="Int16">192</property> <property name="Width" vt="Int16">380</property> <property name="Height" vt="Int8">25</property> <property name="AutoSize" vt="False">False</property> <property name="Caption" vt="String">Archiver Ready</property> <property name="Color" vt="Ident">cl3DLight</property> <property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property> <property name="Font.Color" vt="Ident">clRed</property> <property name="Font.Height" vt="Int8">-16</property> <property name="Font.Name" vt="String">MS Sans Serif</property> <property name="Font.Style" vt="Set"/> <property name="ParentColor" vt="False">False</property> <property name="ParentFont" vt="False">False</property> <property name="TabOrder" vt="Int8">10</property> <property name="HaveVariable" vt="False">False</property> <property name="CtrlStyle" vt="Int32">1342177537</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set"/> </properties> <components/> </object> <object type="TALabel" name="lblCredits1"> <properties> <property name="Left" vt="Int8">8</property> <property name="Top" vt="Int16">224</property> <property name="Width" vt="Int8">76</property> <property name="Height" vt="Int8">17</property> <property name="AutoSize" vt="False">False</property> <property name="Caption" vt="String">Alex Belenkiy</property> <property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property> <property name="Font.Color" vt="Ident">clTeal</property> <property name="Font.Height" vt="Int8">-8</property> <property name="Font.Name" vt="String">MS Sans Serif</property> <property name="Font.Style" vt="Set"/> <property name="ParentFont" vt="False">False</property> <property name="TabOrder" vt="Int8">11</property> <property name="HaveVariable" vt="False">False</property> <property name="CtrlStyle" vt="Int32">1342177536</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set"/> </properties> <components/> </object> <object type="TAButton" name="btnSource"> <properties> <property name="Left" vt="Int8">8</property> <property name="Top" vt="Int8">40</property> <property name="Width" vt="Int8">97</property> <property name="Height" vt="Int8">21</property> <property name="Caption" vt="String">Source Folder</property> <property name="TabOrder" vt="Int8">1</property> <property name="CtrlStyle" vt="Int32">1342259200</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockWidth, DockHeight</property> </properties> <components/> </object> <object type="TAButton" name="btnDest"> <properties> <property name="Left" vt="Int8">8</property> <property name="Top" vt="Int8">70</property> <property name="Width" vt="Int8">97</property> <property name="Height" vt="Int8">21</property> <property name="Caption" vt="String">Destination Folder</property> <property name="TabOrder" vt="Int8">2</property> <property name="CtrlStyle" vt="Int32">1342259200</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set">DockWidth, DockHeight</property> </properties> <components/> </object> <object type="TALabel" name="lblCredits2"> <properties> <property name="Left" vt="Int16">277</property> <property name="Top" vt="Int16">224</property> <property name="Width" vt="Int8">108</property> <property name="Height" vt="Int8">17</property> <property name="AutoSize" vt="False">False</property> <property name="Caption" vt="String">ab@nyitsupport.com</property> <property name="Font.Charset" vt="Ident">DEFAULT_CHARSET</property> <property name="Font.Color" vt="Ident">clTeal</property> <property name="Font.Height" vt="Int8">-8</property> <property name="Font.Name" vt="String">MS Sans Serif</property> <property name="Font.Style" vt="Set"/> <property name="ParentFont" vt="False">False</property> <property name="TabOrder" vt="Int8">13</property> <property name="HaveVariable" vt="False">False</property> <property name="CtrlStyle" vt="Int32">1342177536</property> <property name="CtrlExStyle" vt="Int8">0</property> <property name="Resizing" vt="Set"/> </properties> <components/> </object> </components> </object> |