1KyPTju9doTcXeeJRBx5ksbtGa6np9tnZd


SUBMITTED BY: Guest

DATE: May 29, 2013, 7:13 a.m.

FORMAT: Text only

SIZE: 21.4 kB

HITS: 1323

  1. ; http://www.xstandard.com/en/documentation/xmd5/
  2. #include <GuiConstantsEx.au3>
  3. #include <GuiListView.au3>
  4. #include <GuiMenu.au3>
  5. #Include <String.au3>
  6. #include <Date.au3>
  7. #include <Misc.au3>
  8. #Include <File.au3>
  9. #Include <Array.au3>
  10. #include <SQLite.au3>
  11. Global $Secs, $Mins, $Hour, $Time
  12. Dim $MenuPath, $Diff, $LVSelect, $iIndex
  13. Dim $szDrive, $szDir, $szFName, $szExt
  14. Dim $dll = DllOpen("user32.dll")
  15. AdlibEnable("_Exit")
  16. ; Initialize error handler
  17. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
  18. ; Declare Objects
  19. $oMD5 = ObjCreate("XStandard.MD5") ;"ActiveX MD5 Hash/CheckSum
  20. If Not IsObj($oMD5) Then
  21. MsgBox(48,"Error","You don't have the MD5 COM object installed on !!")
  22. Exit
  23. EndIf
  24. ;---------------------------------------- Register MSG ---------------------------------
  25. GUIRegisterMsg($WM_MENUSELECT,"MouseOverMenu")
  26. ;----------------------------------------- Main GUI ------------------------------------
  27. $Gui = GuiCreate("Duplicate File Finder" , 975, 771,(@DesktopWidth-975)/2, (@DesktopHeight-840)/2 , _
  28. $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
  29. ;----------------------------------------- ListView ------------------------------------
  30. $ListView1 = GUICtrlCreateListView("Duplicate Files |Date |Size in Kb |MD5 Hash ", 10, 45, 957, 478,-1, BitOR($LVS_SHOWSELALWAYS,$LVS_REPORT))
  31. GUICtrlSendMsg($listview1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP) ;Drag & Drop
  32. GUICtrlSendMsg($listview1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
  33. GUICtrlSendMsg($listview1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
  34. GUICtrlSetImage($ListView1, "compstui.dll", -15)
  35. GUICtrlSetResizing ($ListView1,$GUI_DOCKAUTO)
  36. _GUICtrlListView_SetColumnWidth ($ListView1, 0,600)
  37. _GUICtrlListView_SetColumnWidth ($ListView1, 3,300)
  38. _GUICtrlListView_SetHoverTime ($ListView1,500) ; Set Hoover to x Sec.
  39. $ListView2 = GUICtrlCreateListView("Related Duplicate Files |Date |Size in Kb |MD5 Hash ", 10, 530, 957, 200,-1,$LVS_REPORT)
  40. GUICtrlSendMsg($listview1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_HEADERDRAGDROP, $LVS_EX_HEADERDRAGDROP) ; Drag & Drop
  41. GUICtrlSendMsg($listview1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
  42. GUICtrlSetImage($ListView2, "compstui.dll", -16)
  43. GUICtrlSetResizing ($ListView2,$GUI_DOCKAUTO)
  44. _GUICtrlListView_SetColumnWidth ($ListView2, 0,600)
  45. _GUICtrlListView_SetColumnWidth ($ListView2, 3,300)
  46. ;------------------------------------ Labels -------------------------------------------
  47. $Progressbar1 = GUICtrlCreateProgress (167,732,800,15)
  48. GUICtrlSetColor(-1,32250) ; not working with Windows XP Style
  49. $ProgressLabel = GUICtrlCreateLabel("Processing MD5 Checksum : ",10 ,732 ,155,15)
  50. $PathLabel = GUICtrlCreateLabel("Reading Files : ",10 ,750 ,695,18,$SS_SUNKEN)
  51. $TimeLabel = GUICtrlCreateLabel("Time Elapsed : ",710 ,750 ,135,18,$SS_SUNKEN)
  52. $VersionLabel = GUICtrlCreateLabel("MD5 Version - " & $oMD5.Version,850 ,750 ,120,18,$SS_SUNKEN)
  53. ;------------------------------------ Menu ---------------------------------------------
  54. Dim $sPath = @MyDocumentsDir
  55. $sShortPath = StringSplit($sPath,"\")
  56. $nFileMenu1 = GUICtrlCreateMenu(" &Open")
  57. $nFileSelFolder1= GUICtrlCreateMenuItem("Select Folder ...",$nFileMenu1)
  58. GUICtrlSetState(-1,$GUI_DEFBUTTON)
  59. $nFileSelFolder2= GUICtrlCreateMenuItem("Export to File",$nFileMenu1)
  60. $nFileSelFolder0= GUICtrlCreateMenuItem("",$nFileMenu1)
  61. $nFileSelFolder3 = GUICtrlCreateMenuItem($sShortPath[1]&"\ ...\" & $sShortPath[$sShortPath[0]] ,$nFileMenu1)
  62. $nFileMenu2 = GUICtrlCreateMenu("&Info")
  63. $nFileSelFolderH= GUICtrlCreateMenuItem("Help" ,$nFileMenu2)
  64. $nFileSelFolderA= GUICtrlCreateMenuItem("About ...",$nFileMenu2)
  65. ;------------------------------------ Button -------------------------------------------
  66. $bScan = GuiCtrlCreateButton("Scan ...", 10, 2, 40, 40, BitOr($BS_BOTTOM,$BS_ICON))
  67. GUICtrlSetImage ($bScan, "shell32.dll",-219)
  68. GUICtrlSetTip($bScan,"Press F3 to Scan")
  69. HotKeySet("{F3}", "_FindDups_F3")
  70. ;------------------------------------- Input --------------------------------------------
  71. $Group = GUICtrlCreateGroup("Filters ", 100, 5, 400, 30)
  72. $sExtention = GUICtrlCreateLabel("File Extention : ",110 ,18 ,80,15)
  73. $sFileSize = GUICtrlCreateLabel("File Size in Kb : ",270 ,18 ,70 ,15)
  74. $sFilter = GUICtrlCreateInput ("*", 200, 14, 40, 17)
  75. GUICtrlSetTip($sFilter,"Extention like PDF, ZIP, EXE, ... ")
  76. $sSize = GUICtrlCreateInput ("1", 350, 14, 60, 17)
  77. GUICtrlSetTip($sSize,"Input a Size number to filter on ... ")
  78. ;-------------------------------------- Context Menu ------------------------------------
  79. $OptionsContext = GUICtrlCreateContextMenu($ListView2)
  80. $OptionsFile1 = GUICtrlCreateMenuItem("Open File ", $OptionsContext)
  81. $OptionsFile2 = GUICtrlCreateMenuItem("Delete File ", $OptionsContext)
  82. ;-------------------------------------- Group -------------------------------------------
  83. $Group = GUICtrlCreateGroup("Statistics ", 620, 5, 300, 30)
  84. $ItemsCnt = GUICtrlCreateLabel("Duplicate Items : 0" , 630, 18, 160, 15)
  85. $FilesCnt = GUICtrlCreateLabel("Number of Files Processed : 0" , 740, 18, 160, 15)
  86. ;-------------------------------------- DB Init -----------------------------------------
  87. _SQLite_Startup ()
  88. _SQLite_Open () ; open :memory: Database
  89. _SQLite_Exec (-1, "CREATE TABLE Duplicates (File,Date,Size,md5);")
  90. _SQLite_Exec (-1, "CREATE TABLE Bookmarks (Pointer,ShortPointer);")
  91. ;GUI handling
  92. ;------------
  93. GuiSetState()
  94. GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Simple HeaderSort
  95. Global $B_DESCENDING [_GUICtrlListView_GetColumnCount ($ListView1) ]
  96. While 1
  97. $nMsg = GUIGetMsg()
  98. Switch $nMsg
  99. Case $GUI_EVENT_CLOSE
  100. _SQLite_Exec (-1, "DROP TABLE Duplicates;")
  101. _SQLite_Exec (-1, "DROP TABLE Bookmarks;")
  102. _SQLite_Close ()
  103. _SQLite_Shutdown ()
  104. DllClose($dll)
  105. Exit
  106. Case $nFileSelFolder1
  107. $MenuPath = FileSelectFolder("Select a Folder to Scan ...", "", "", $sPath)
  108. Case $nFileSelFolder3
  109. $MenuPath = FileSelectFolder("Select a Folder to Scan ...", "", "", $sPath)
  110. Case $nFileSelFolder2
  111. _Export()
  112. Case $nFileSelFolderH
  113. Help()
  114. Case $nFileSelFolderA
  115. About()
  116. Case $bScan
  117. If $MenuPath = "" then
  118. MsgBox(48,"Error","No Folders selected !!")
  119. Else
  120. _FindDups(GUICtrlRead($sFilter),GUICtrlRead($sSize))
  121. EndIf
  122. Case $OptionsFile1
  123. $LVSelect = _GUICtrlListView_GetItemText($ListView1, Int(_GUICtrlListView_GetSelectedIndices($ListView1)), 0)
  124. $DuplicateFilePath = _PathSplit($LVSelect,$szDrive, $szDir, $szFName, $szExt)
  125. $Zxtension = StringSplit($DuplicateFilePath[4],".")
  126. If StringInStr(Assoc($DuplicateFilePath[4]),":\") Then
  127. ShellExecute($DuplicateFilePath[3]&$DuplicateFilePath[4],"",$DuplicateFilePath[1]&$DuplicateFilePath[2])
  128. EndIf
  129. Case $OptionsFile2
  130. $iIndex = _GUICtrlListView_GetSelectedIndices ($ListView2)
  131. $LVSelect = _GUICtrlListView_GetItemText($ListView2, int($iIndex), 0)
  132. If MsgBox(1,"Important","Are you sure you want to delelete " & @CR & @CR & $LVSelect) = 1 Then
  133. _FileDelete($LVSelect,int($iIndex))
  134. EndIf
  135. Case $nMsg = $GUI_EVENT_PRIMARYDOWN
  136. $Pos = GUIGetCursorInfo()
  137. If IsArray($Pos) Then
  138. If ($Pos[4] == $listview1) Then
  139. If $iIndex <> _GUICtrlListView_GetSelectedIndices ($ListView1) Then
  140. $iIndex = _GUICtrlListView_GetSelectedIndices ($ListView1) ; Bug _GUICtrlListView_GetSelectedIndices returns a string i/o Int
  141. $LVSelect = _GUICtrlListView_GetItemText($ListView1, int($iIndex), 3)
  142. _SelectDups($LVSelect)
  143. EndIf
  144. EndIf
  145. EndIf
  146. EndSwitch
  147. WEnd
  148. ;--------------------------------------- Functions ----------------------------------
  149. Func _FindDups_F3()
  150. _FindDups(GUICtrlRead($sFilter),GUICtrlRead($sSize))
  151. EndFunc
  152. Func _FindDups($sExt, $sFSize)
  153. Local $hQuery, $aRow
  154. local $sPathMenu, $i, $y
  155. ;$hWnd = WinGetHandle("Duplicate File Finder")
  156. ;$hMain = _GUICtrlMenu_GetMenu ($hWnd)
  157. ;$hFile = _GUICtrlMenu_GetItemSubMenu ($hMain, 0)
  158. _GUICtrlListView_DeleteAllItems ($ListView1)
  159. _GUICtrlListView_DeleteAllItems ($ListView2)
  160. GuiCtrlSetData($PathLabel,"Reading Files : ")
  161. GuiCtrlSetData($TimeLabel,"Time Elapsed : ")
  162. GuiCtrlSetData($ItemsCnt,"Duplicate Items : 0")
  163. GuiCtrlSetData($FilesCnt,"Number of Files Processed : 0")
  164. _SQLite_Exec (-1, "DELETE FROM Duplicates;")
  165. If $MenuPath = "" Then
  166. MsgBox(0,"Error","No valid Selection made ... Try again")
  167. Return
  168. Else
  169. $sPath = $MenuPath
  170. $sShortPath = StringSplit($sPath,"\")
  171. $ShortMenu = $sShortPath[1]&"\ ...\"&$sShortPath[$sShortPath[0]]
  172. _SQLite_Exec (-1, 'INSERT INTO Bookmarks (Pointer,ShortPointer) VALUES' & '("' & $sPath & '","' & $ShortMenu & '");')
  173. ;_SQlite_Query (-1, "SELECT Count(*) From (SELECT DISTINCT(Pointer) FROM Bookmarks);", $hQuery)
  174. ; While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  175. ; consolewrite("Counter" & $aRow[0] & @CRLF)
  176. ; $y = $aRow[0]
  177. ; WEnd
  178. _SQlite_Query (-1, "SELECT DISTINCT(Pointer) FROM Bookmarks;", $hQuery)
  179. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  180. ;consolewrite("Pointer " & $aRow[0] & @CRLF)
  181. WEnd
  182. _SQlite_Query (-1, "SELECT DISTINCT(ShortPointer) FROM Bookmarks;", $hQuery)
  183. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  184. ;consolewrite("ShortPointer " &$aRow[0] & @CRLF)
  185. GUICtrlSetData($nFileSelFolder3,$aRow[0])
  186. WEnd
  187. EndIf
  188. $Begin = TimerInit()
  189. GuiCtrlSetData($PathLabel,"Reading Files : ")
  190. $aFilesList = _FileListToArrayEx ($sPath, "*."&$sExt)
  191. For $n = 1 To $aFilesList[0]
  192. GUICtrlSetData ($Progressbar1,($n/$aFilesList[0])*100)
  193. $sFileSize = Round(FileGetSize($aFilesList[$n])/1024,2)
  194. $sFileDate = FileGetTime($aFilesList[$n], 1)
  195. $sDateStamp = $sFileDate[2] & "/" & $sFileDate[1] & "/" & $sFileDate[0]
  196. If $sFileSize >= $sFSize Then
  197. $oDict1_key = $oMD5.GetCheckSumFromFile($aFilesList[$n]) ; Or Reverse $oMD5.GetCheckSumFromString
  198. _SQLite_Exec (-1, 'INSERT INTO Duplicates(File,Date,Size,md5) VALUES' & _
  199. '("' & $aFilesList[$n] & '","' & $sDateStamp & '","' & $sFileSize & '","' & $oDict1_key & '");')
  200. EndIf
  201. Sleep (25)
  202. _TicksToTime(Int(TimerDiff($Begin)), $Hour, $Mins, $Secs )
  203. Local $sTime = $Time ; save current time to be able to test and avoid flicker..
  204. $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
  205. GuiCtrlSetData($TimeLabel,"Time Elapsed : " & $Time )
  206. Next
  207. GuiCtrlSetData($FilesCnt,"Number of Files Processed : " & $aFilesList[0])
  208. _SQlite_Query (-1, "SELECT * FROM Duplicates GROUP BY md5 HAVING COUNT(*) > 1;", $hQuery)
  209. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  210. ;ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1]) & @CR)
  211. $DataCol = GUICtrlCreateListViewItem($aRow[0] & "|" & $aRow[1] & "|" & $aRow[2] & "|" & $aRow[3],$ListView1)
  212. WEnd
  213. GuiCtrlSetData($ItemsCnt,"Duplicate Items : " & _GUICtrlListView_GetItemCount ($ListView1))
  214. _GUICtrlListView_SetColumnWidth ($ListView1, 0,$LVSCW_AUTOSIZE) ; AutoSize Listview, needs to be called after filling the LV
  215. EndFunc
  216. Func _SelectDups($LVSelect)
  217. Local $hQuery, $aRow
  218. _GUICtrlListView_DeleteAllItems ($ListView2)
  219. _SQlite_Query (-1, "SELECT * FROM Duplicates WHERE md5='" & $LVSelect & "';", $hQuery)
  220. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  221. ;ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1]) & @CR)
  222. $DataCol = GUICtrlCreateListViewItem($aRow[0] & "|" & $aRow[1] & "|" & $aRow[2] & "|" & $aRow[3],$ListView2)
  223. WEnd
  224. _GUICtrlListView_SetColumnWidth ($ListView2, 0,$LVSCW_AUTOSIZE)
  225. EndFunc
  226. Func _Export()
  227. Local $hQuery, $aRow, $avExport
  228. $file = FileOpen(@ScriptDir & "\Duplicate Files.csv",2)
  229. FileWrite($file,"Path" & ";" & "Date" & ";" & "Size / Kb" & ";" & "Md5" & @LF)
  230. _SQlite_Query (-1, "SELECT * FROM Duplicates WHERE md5 IN (SELECT md5 FROM Duplicates GROUP BY md5 HAVING COUNT(*) > 1) ORDER BY md5;", $hQuery)
  231. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  232. ;ConsoleWrite( $aRow[0] & ";" & $aRow[1] & ";" & StringReplace($aRow[2],".",",") & ";" & $aRow[3] & @LF)
  233. FileWrite($file,$aRow[0] & ";" & $aRow[1] & ";" & StringReplace($aRow[2],".",",") & ";" & $aRow[3] & @LF)
  234. WEnd
  235. FileClose($file)
  236. MsgBox(64,"Info ... ","Report finished.")
  237. EndFunc
  238. Func _FileListToArrayEx($sPath, $sMask='*')
  239. Local $i, $j, $RetList[1], $DirsArr = _FileListToArray($sPath, '*', 2), $SubDirFiles, $FilesArr
  240. $FilesArr = _FileListToArray($sPath, $sMask, 1)
  241. For $i = 1 To UBound($FilesArr) - 1
  242. ReDim $RetList[UBound($RetList)+1]
  243. $RetList[UBound($RetList)-1] = $sPath & "\" & $FilesArr[$i]
  244. GuiCtrlSetData($PathLabel,"Reading Files : " & $sPath & "\" & $FilesArr[$i])
  245. Next
  246. If UBound($DirsArr) > 0 Then
  247. For $i = 1 To $DirsArr[0]
  248. $SubDirFiles = _FileListToArrayEx($sPath & "\" & $DirsArr[$i], $sMask)
  249. If $SubDirFiles[0] > 0 Then
  250. For $j = 1 To $SubDirFiles[0]
  251. ReDim $RetList[UBound($RetList)+1]
  252. $RetList[UBound($RetList)-1] = $SubDirFiles[$j]
  253. GuiCtrlSetData($PathLabel,"Reading Files : " & $SubDirFiles[$j])
  254. Next
  255. Else
  256. $FilesArr = _FileListToArray($sPath & "\" & $DirsArr[$i], $sMask, 1)
  257. For $j = 1 To UBound($FilesArr) - 1
  258. ReDim $RetList[UBound($RetList)+1]
  259. $RetList[UBound($RetList)-1] = $sPath & "\" & $DirsArr[$i] & "\" & $FilesArr[$j]
  260. Next
  261. EndIf
  262. Next
  263. EndIf
  264. $RetList[0] = UBound($RetList) - 1
  265. Return $RetList
  266. EndFunc
  267. Func _FileDelete($Filename,$Index)
  268. FileDelete($Filename)
  269. _SQLite_Exec (-1, 'DELETE FROM Duplicates Where File="'& $Filename & '";')
  270. _GUICtrlListView_DeleteItem($ListView2,$Index)
  271. EndFunc
  272. Func Assoc($Filename)
  273. If StringRight($Filename, 3) = "exe" Or StringInStr($Filename, ".") = 0 Then Return -1
  274. $Ext = StringRight($Filename, 3)
  275. $Descr = RegRead("HKEY_CLASSES_ROOT\" & "." & $Ext, "")
  276. $Program = RegRead("HKEY_CLASSES_ROOT\" & $Descr & "\Shell\Open\Command", "")
  277. $Program = StringReplace($Program, '"', "")
  278. $Match = StringInStr($Program, ".exe")
  279. If $Match = 0 Then
  280. Return $Filename
  281. EndIf
  282. $Program = SubString($Program, 1, $Match + 3, 1, 1)
  283. Return $Program
  284. EndFunc
  285. Func SubString($String, $start, $end, $StartOccur, $EndOccur)
  286. Local $Match1
  287. Local $Match2
  288. Local $i
  289. If IsString($start) Then
  290. $Match1 = StringInStr($String, $start, 0, $StartOccur)
  291. If $Match1 = 0 Then Return 1
  292. Else
  293. $Match1 = $start
  294. EndIf
  295. If IsString($end) Then
  296. $Match2 = StringInStr($String, $end, 0, $EndOccur)
  297. If $Match2 = 0 Then Return 11
  298. Else
  299. $Match2 = $end
  300. EndIf
  301. If $end = -1 Then
  302. $NewString = StringMid($String, $Match1)
  303. Else
  304. For $i = 1 To 3
  305. If IsNumber($Match2) Then ExitLoop
  306. Select
  307. Case $i = 1
  308. $Match2 = StringInStr($String, $end)
  309. Case $i = 2
  310. $TempString = StringTrimLeft($String, $Match1)
  311. $Match2 = StringInStr($TempString, $end)
  312. $Match2 = $Match1 + $Match2
  313. EndSelect
  314. If $Match2 > 0 Then
  315. ExitLoop
  316. ElseIf $i = 3 Then
  317. Return 1
  318. EndIf
  319. Next
  320. $NewString = StringTrimLeft($String, $Match1 - 1)
  321. $NewString = StringTrimRight($NewString, StringLen($String) - $Match2)
  322. EndIf
  323. If IsNumber($NewString) Then Return 2
  324. Return $NewString
  325. EndFunc
  326. Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; HeaderSort
  327. Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
  328. $hWndListView = $ListView1
  329. If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1)
  330. $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
  331. $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
  332. $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
  333. $iCode = DllStructGetData($tNMHDR, "Code")
  334. Switch $hWndFrom
  335. Case $hWndListView
  336. Switch $iCode
  337. Case $LVN_COLUMNCLICK ; A column was clicked
  338. Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
  339. _GUICtrlListView_SimpleSort ($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem"))
  340. ; No return value
  341. EndSwitch
  342. EndSwitch
  343. Return $GUI_RUNDEFMSG
  344. EndFunc
  345. Func MouseOverMenu($hWndGUI, $MsgID, $WParam, $LParam)
  346. Local $id = BitAnd($WParam, 0xFFFF), $hQuery, $aRow
  347. ;ConsoleWrite( "hWndGui= "&$hWndGUI& @LF &"MsgId= "&$MsgID& @LF &"WParam= " &$WParam& @LF &"$LParam= "&$LParam& @LF)
  348. ;ConsoleWrite("ID= "& $id & @LF)
  349. ;ConsoleWrite(GUICtrlRead ($id,1) & @LF)
  350. $sMenuText= GUICtrlRead ($id,1)
  351. ;ConsoleWrite("test" & $sMenuText & @LF)
  352. ToolTip("")
  353. If $ID > 13 Then
  354. _SQlite_Query (-1, "SELECT DISTINCT(Pointer) FROM Bookmarks WHERE Shortpointer='"& $sMenuText & "';", $hQuery)
  355. While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
  356. ;consolewrite($aRow[0] & @CRLF)
  357. ;ConsoleWrite("Output " & $aRow[0] & @LF)
  358. Tooltip($aRow[0])
  359. WEnd
  360. EndIf
  361. Return $GUI_RUNDEFMSG
  362. EndFunc
  363. Func Help()
  364. MsgBox(64,"Help info", _
  365. "IMPORTANT : " & @CRLF & _
  366. "When selecting a folder to scan it is recommended not to select the top level 'C:' drive" & @CRLF & _
  367. "This will take to much time and CPU, to scan and process. Better is select a smaller range to scan." & @CRLF & _
  368. @CRLF & _
  369. "USAGE :" & @CRLF & _
  370. "To start, hoover the mouse over an item in the top listview." & @CRLF & _
  371. "On the bottem listview you will see all duplicate items appear" & @CRLF & @CRLF & _
  372. "Richt click an item in the bottom listview, and select OPEN or DELETE." & @CRLF & _
  373. "OPEN will run the file. If there is an associated application on your system to run it" & @CRLF & @CRLF & _
  374. "Press F3 to start scanning and ESC to quit while processing the MD5 checksums" & @CRLF & _
  375. @CRLF )
  376. EndFunc
  377. Func About()
  378. $GUI = GUICreate ("About ..." , 450 , 130)
  379. GUICtrlCreateLabel ("IMPORTANT : " & @CRLF & _
  380. "This application uses the MD5 Com object from :" & @CRLF, 10 , 15, 400,40)
  381. $link_1 = GUICtrlCreateLabel ("http://www.xstandard.com/en/documentation/xmd5/", 10 , 45, 420,20)
  382. GUICtrlSetFont (-1 , 13 , 600)
  383. GUICtrlSetColor (-1 ,0x004080)
  384. GUICtrlSetCursor (-1 , 0)
  385. GUICtrlCreateLabel ("As well as the SQLite database component." & @CRLF & _
  386. "Make sure both are properly installed on your machine." & @CRLF & _
  387. @CRLF, 10 , 75, 400,40)
  388. GUISetState (@SW_SHOW , $GUI)
  389. While 1
  390. $msg = GUIGetMsg ()
  391. If $msg = $gui_event_close Then Exit
  392. If $msg = $link_1 Then
  393. ShellExecute ("http://www.xstandard.com/en/documentation/xmd5/",1)
  394. EndIf
  395. WEnd
  396. EndFunc
  397. Func MyErrFunc()
  398. $HexNumber=hex($oMyError.number,8)
  399. Msgbox(0,"COM Error Test","We intercepted a COM Error !" & @CRLF & @CRLF & _
  400. "err.description is: " & @TAB & $oMyError.description & @CRLF & _
  401. "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
  402. "err.number is: " & @TAB & $HexNumber & @CRLF & _
  403. "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
  404. "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
  405. "err.source is: " & @TAB & $oMyError.source & @CRLF & _
  406. "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
  407. "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
  408. )
  409. SetError(1) ; to check for after this function returns
  410. Endfunc
  411. Func _Exit()
  412. If _IsPressed("1b", $dll) Then
  413. MsgBox(0,"Esc Key Pressed", "Quit Application")
  414. Exit
  415. EndIf
  416. EndFunc

comments powered by Disqus