Sign in to follow this  
Followers 0
GreenCan

File Search

4 posts in this topic

#1 ·  Posted (edited)

OK, I know I am not the biggest contributor to this forum...

Anyhow, wanted to share this with you

File search can create 4 possible outputs:

- Hardlinks (NTFS only)

- Shortcuts

- Thumbnail GUI (slow compared to previous but identifies corrupted images)

- Text report

Feedback Appreciated

GreenCan

I cannot get the code below embedded without doing this silly thing, strange...

You first have to create the resources for Directory search (required for the thumbnails)

$VariableName = WriteResource( _
    "0xFFD8FFE000104A46494600010101006000600000FFDB00430003020203020203030303040303040508050504" & _
    "04050A070706080C0A0C0C0B0A0B0B0D0E12100D0E110E0B0B1016101113141515150C0F171816141812141514" & _
    "FFDB00430103040405040509050509140D0B0D1414141414141414141414141414141414141414141414141414" & _
    "141414141414141414141414141414141414141414141414FFC0001108005F006803012200021101031101FFC4" & _
    "001F0000010501010101010100000000000000000102030405060708090A0BFFC400B510000201030302040305" & _
    "0504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F0243362728209" & _
    "0A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A7374" & _
    "75767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5" & _
    "C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F01000301010101" & _
    "01010101010000000000000102030405060708090A0BFFC400B511000201020404030407050404000102770001" & _
    "02031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A" & _
    "262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A8283" & _
    "8485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3" & _
    "D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00FD45796569CC" & _
    "50C68ECAA19B7B95EA4E3A03E868C5EFFCF183FEFF0037FF00114B6FFF002119FF00EB927F37ABB4014717BFF3" & _
    "C60FFBFCDFFC4518BDFF009E307FDFE6FF00E22AF514014717BFF3C60FFBFCDFFC4532596E6DD43CB0C41372A9" & _
    "2B29246481D368F5AD1AA7AAFF00C79FFDB58FFF00435A00928A28A0028A28A0028A28A0028A28A00C7D53C49A" & _
    "7786EF1E4D46E0DBC72420AB796CC3E52D9FBA0E3A8AAA7E28F861490753C11FF4C25FFE26B535BFF903DEFF00" & _
    "D716FE55CF5CC5FE912FFBE7F9D34265CFF85A5E17FF00A0A0FF00BF12FF00F1347FC2D2F0BFFD0507FDF897FF" & _
    "0089ACFF002AB275CD4750D35A1163A1DC6AE1C1DE609A18FCBC6319F319739F6F4A7615CE9BFE169785FF00E8" & _
    "283FEFC4BFFC4D57BFF88DA05FDB8B7B4BFF003AE5E4411A79320C9DE0F52B8AE37FE125D7BFE84BD43FF032D3" & _
    "FF008ED1FF00092EBFFF00425EA1FF0081969FFC769F28B98EDFFB766FEE9FFBE8D1FDBB37F74FFDF46B89FF00" & _
    "84975FFF00A12F50FF00C0CB4FFE3B47FC24BAFF00FD097A87FE065A7FF1DA394573B6FEDD9BFBA7FEFA347F6E" & _
    "CDFDD3FF007D1AE27FE125D7FF00E84BD43FF032D3FF008ED4B69E20D6E7BA86397C257D6D13BAABCCF776CC23" & _
    "04F2C409092075E0668B0EE763FDBB37F74FFDF468FEDD9BFBA7FEFA354BCBA3CBA5619D569F334F6AAEC7272C" & _
    "3F224514CD2BFE3C97FDE7FF00D08D15250DD6FF00E40F7BFF005C5BF9564DC4599E4FF78FF3AD6D6FFE40F7BF" & _
    "F5C5BF9553993F7CFF00EF1A684CA3E551E555BD946CA649CBEB9E11975ABC59D35ED5F4C0102793612C6A8792" & _
    "7710D1B1CF3EBD85677FC2BAB8FF00A1BFC49FF81107FF0019AEE7651B29DC2C70DFF0AEAE3FE86FF127FE0441" & _
    "FF00C668FF00857571FF00437F893FF0220FFE335DCECA3653BB158E1BFE15D5C7FD0DFE24FF00C0883FF8CD75" & _
    "DE555BD946CA57B8EC54F2A8F2AADECA365203474AFF008F25FF0079FF00F423451A57FC792FFBCFFF00A11A2A" & _
    "4B1BADFF00C81EF7FEB8B7F2AAF2AFEF5F8EE6AC6B7FF207BDFF00AE2DFCAA3907EF1FEA680382835280FC54D5" & _
    "ACBFE12795A68F4A595B42F27E5B71B87EFC39E09E40C63BF39E00CFFEDED3FF00E8A16ABFF80B6BFF00C8B5BF" & _
    "0DCDFF00FC2C5D4A13AA6926C174E468EC40CDE46FBBFD63F4FDDF27BF71D3A983FB5357FF00A1B7C31FF82F7F" & _
    "FE4BAD0831FF00B7B4FF00FA285AAFFE02DAFF00F22D6D787633AC482E6CFC61A9EA50C120F322782D551BBED3" & _
    "8B756C1F620FBD37FB5357FF00A1B7C31FF82F7FFE4BABDA536BB7B3A4835FD0EFAD51C79AB69A748188EE037D" & _
    "A5829C7720FD0D260743B7DAAABCB3DCDD9B3B18D5E7003492C99F2E107A16C7527B28EBDC81CD59BA9D2CED66" & _
    "9E4384890BB7D00C9ABDE1DB16B0D2A112E3ED528F3AE187791B96FC0741EC00ED525191AB786FC8D1AFAE27D4" & _
    "2F279E3B77914C727928AC149C809838CF6626BC974DF1CEB9A6480FDAFEDF103CC37601C8F6703703EE73F4AF" & _
    "73F111FF008A7F54FF00AF597FF4035F326ABAC586856C2E352BEB6D3E03D24BA996256F60588C9F615B4126B5" & _
    "32A8ED6B1EEDE1BF115AF89AC7ED16E0C6E876CB0BFDE8DBD0FA8F43DEB5B6FB57CCBF0CFE3B785EE3E27E95A2" & _
    "699A8497D36A45AD5DE1858439DA594166C12770C02011F31E79AFA7B6D6728F2B2A12E6458D2BFE3C97FDE7FF" & _
    "00D08D14695FF1E4BFEF3FFE8468A8341BADFF00C81EF7FEB8B7F2A5913F78DF5349ADFF00C81EF7FEB8B7F2AB" & _
    "0E3E76E7BD023878348BB5F891A95F1F0DE9E96B269AB126B7B97ED13BEEE6061C909DF38C703AF415BFB0752F" & _
    "FA127C2FFF0081EDFF00C895DDDD26FB69570AD94230CDB41E3B91D3EB5C2DAD87D97C1DE1D822B6D3A248ADB6" & _
    "8886BF3C5120C2E024AAAC661EEDD3DF3569DC913FB0752FFA127C2FFF0081EDFF00C895A3A3DBEB7A7CC91A78" & _
    "6F43D3ED5DC79CD69A8BEE03B90BF6650C40EC48FA8AC9FB349FF3C74CFF00C2AEEFFF008D574FE1289A3B69F7" & _
    "2DBA7CE3FE3DF5396F474EED22A95FA0A18932E6AB626FF4BBCB65E1A685E307EAA47F5A934ED685FD85BDCAFC" & _
    "A2540DB4F5524720FB8E95771EE2B9BD46CAE347B996E2DE36B8B0958C9245102CF0B9EACA3F894F520720E4F3" & _
    "9E2515736EE664BBB796097263950A30562A70460E08E47D457E62FED1DF08F54F84FE3F9E1B9B8B8D4749D40B" & _
    "4FA7EA170E5DE44CF31BB1EAE9900FA820F7C0FD18B6D5E1BC42F04C932838251B383E87D0D719F17BC17A37C5" & _
    "4F08DD786F5439B99479B66F12EF9E0987DD911472719C1E808241201AD60F9599548F3A3E22FD943C3D71E21F" & _
    "8EFE1910A314B395AF26603854452727EA768FC6BF4D36578C7ECC7FB3BC7F04F419EEB52921BAF13EA0A05CCB" & _
    "11CA4283911213D79E49EE71E82BDBB1EE29549733D02945C23A91E95FF1E4BFEF3FFE8468A34AFF008F25FF00" & _
    "79FF00F42345646E375BFF00903DEFFD716FE556197E63F5A74F0A5CC2F1483723A9561EA0D621F06DA924FDBF" & _
    "58E7D355B8FF00E2E8035DE2591191C0656182A4641154A1D034DB6B2B7B38B4FB58ED2DD76430242A1225F455" & _
    "C600FA555FF8432D3FE7FF0058FF00C1ADC7FF001747FC21969FF3FF00AC7FE0D6E3FF008BA00B7FD85A77FCF8" & _
    "5AFF00DF95FF000A9EDAC60B352B0431C009C911A05CFE559BFF000865A7FCFF00EB1FF835B8FF00E2E8FF0084" & _
    "32D3FE7FF58FFC1ADC7FF17401B1B68DB58FFF000865A7FCFF00EB1FF835B8FF00E2E8FF008432D3FE7FF58FFC" & _
    "1ADC7FF174016EEF42D3B5097CDBAB0B5B99318DF342AC71F522A5B2D32D34D429696D0DAA9392B0C6101FCAB3" & _
    "FF00E10CB4FF009FFD63FF0006B71FFC5D1FF0865A7FCFFEB1FF00835B8FFE2E803636D1B6B1FF00E10CB4FF00" & _
    "9FFD63FF0006B71FFC5D1FF0865AFF00CFFEB1FF00835B8FFE2E8034F4AFF8F25FF79FFF00423454F6B6C9696E" & _
    "90C7BB620C0DCC589FA93C9345007FFFD9", $ExportDirectory, "_pps.jpg")

Exit
#FUNCTION# ==============================================================
Func WriteResource($sbStringRes , $Fullpath = '',  $FileName = '')
    Local $sTempFile
    If $Fullpath = '' Then $Fullpath = @ScriptDir
    If StringRight($Fullpath,1) <> '\' Then $Fullpath &= '\'
    If $FileName = '' Then
        Do
            $sTempFile = $Fullpath & 'temp' & Hex(Random(0, 65535), 4)
        Until not FileExists($sTempFile)
    Else
        $sTempFile = $Fullpath & $FileName
    EndIf
    Local $hFile = FileOpen($sTempFile, 2+16+8)
    FileWrite($hFile, $sbStringRes)
    FileClose($hFile)
    Return $sTempFile
EndFunc
#FUNCTION# ==============================================================

Then you can start the FileSearch script

#cs

    FileSearch.au3
    
    Author:
        GreenCan
        
    Purpose:
        File search (initially for graphic formats)
        Creates 4 possible outputs:
            - Hardlinks
            - Shortcuts
            - Thumbnail GUI (slower compared to first 2 options but identifies corrupted images)
            - Text report
            
        Each of the options have their own pros and cons
    
    All searches and builds can be stopped by pressing the space bar.
    
    FileSearch.au3 creates a ini file in the same directory where it is located
    FileSearch.au3 requires some graphic thumbnail files that are created by another script (Create resources for Directory search.au3)
    The thumbnail graphics are created in the subfolder 'Resource'

    Third Party Code by:
    - Button_AddIcon by Holger
    ~ _ArraySort_MultiColumn by UEZ
    - _GuiImageHole by ... me 
    
#ce
#include "_FileListToArrayEx.au3"
#Include <Array.au3>
#Include <File.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <GuiListView.au3>
#Include <GDIPlus.au3>
#include <GuiImageList.au3>
#Include <GuiButton.au3>
#include <StaticConstants.au3>


Opt("TrayIconHide", 1)
; Avoid double runs 
If  _Singleton(@ScriptName,1) =  0 Then
    If Not @Compiled Then Msgbox(0,"Warning",@ScriptName & " is already running",3)
    Exit
EndIf

#region Settings 
Global $Search = False
Global $Interrupt = False
Global $hListView, $ThumbnailGUI, $hiList
Global $version = "1.00" , $VersionDate = "Oct 2010"

Const $White = 0xFFFFFF

#endregion Settings 

#region IniRead
$iniFile = @ScriptDir & "\Directory Search.ini"
; the different html loops will be in this array
Global $RFSFilepattern = IniRead($inifile,"Global","RFSFilepattern","") 
;If @error Then
;   MsgBox(48, "Error", "Error occurred while trying to open " & $inifile)
;   Exit
;EndIf
Global $Default_directory = IniRead($inifile,"Global","Default_directory",@MyDocumentsDir)
Global $DestinationFolder = IniRead($inifile,"Global","DestinationFolder",@MyDocumentsDir & "\Search Results")
Global $RFSFileExtension = IniRead($inifile,"Global","RFSFileExtension","")
Global $RFSFolderpattern = IniRead($inifile,"Global","RFSFolderpattern","")
Global $RFSFlag = IniRead($inifile,"Global","RFSFlag",1)
If $RFSFlag = 1 Then
    $RFSFlag = True
Else
    $RFSFlag = False
EndIf
Global $RFSrecurse = IniRead($inifile,"Global","RFSrecurse",1)
If $RFSrecurse = 1 Then
    $RFSrecurse = True
Else
    $RFSrecurse = False
EndIf
Global $RFlinks = IniRead($inifile,"Global","RFSlinks",3)
#endregion IniRead

Local $window_width = 420
Local $window_heigth = 260
$SearchGui = GUICreate("File Search", $window_width, $window_heigth, 200, 100, BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_GROUP,$WS_BORDER), BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_WINDOWEDGE,$WS_EX_ACCEPTFILES))
GUISetFont(10)

$_Default_directory = GUICtrlCreateButton ("Select Root Folder", 10,10,195,30)
Button_AddIcon($_Default_directory, "shell32.dll", 4, $BUTTON_IMAGELIST_ALIGN_LEFT)
GUICtrlSetTip ($_Default_directory, $Default_directory & " (" & DriveGetFileSystem (StringLeft($Default_directory,3)) & ")")

$_DestinationFolder = GUICtrlCreateButton ("Select Destination Folder", 215,10,195,30)
Button_AddIcon($_DestinationFolder, "shell32.dll", 4, $BUTTON_IMAGELIST_ALIGN_LEFT)
GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "This is the folder where Hardlinks will be created.")

GUICtrlCreateLabel ("Search pattern",  15, 48, 110, 20)
$_RFSFilepattern = GuiCtrlCreateInput($RFSFilepattern, 135, 45, 100, 20)
GUICtrlSetTip ($_RFSFilepattern, "File pattern to search for, the string can be located anywhere in the file name. "& @CR & "Empty is ALL.")

GUICtrlCreateLabel ("File extension filter",  15, 78, 110, 20)
$_RFSFileExtension = GuiCtrlCreateInput($RFSFileExtension, 135, 75, 100, 20)
GUICtrlSetTip ($_RFSFileExtension, "Limit the search To File Extension. "& @CR & "Empty is ALL.")

GUICtrlCreateLabel ("Folder filter",  15, 110, 108, 20)
$_RFSFolderpattern = GuiCtrlCreateInput($RFSFolderpattern, 135, 105, 100, 20)   
GUICtrlSetTip ($_RFSFolderpattern, "Limit the search to the Folder Names containing the criteria as entered."& @CR & "Empty is ALL.")

$_RFSFlag = GUICtrlCreateCheckbox ("Include folder Names", 250, 46, 150, 20)
If $RFSFlag = True Then GUICtrlSetState ( $_RFSFlag, $GUI_CHECKED )
GUICtrlSetTip ($_RFSFlag, "If marked, Search will include folder names matching the search criteria.")
    
$_RFSrecurse = GUICtrlCreateCheckbox ("Include Sub Folders", 250, 76, 150, 20)
If $RFSrecurse = True Then GUICtrlSetState ( $_RFSrecurse, $GUI_CHECKED )
GUICtrlSetTip ($_RFSrecurse, "If marked, Search will also look in sub folders starting from the root folder.")

GUICtrlCreateGroup (" Links ", 10, 127, 330, 65)
$_RFShardlinks = GUICtrlCreateRadio ("Create HardLinks", 20, 145, 135, 20)
GUICtrlSetTip (-1, "A Hardlink will be created to the files matching the search.  Hardlinks will be created in the Destination folder and will have a prefix ' HL_'" & @CR & "If 'Include Folder Names' is tagged, then a shortcut to the folder will be created." )
$_RFSSoftlinks = GUICtrlCreateRadio ("Create Shortcuts", 20, 165, 135, 20)
GUICtrlSetTip (-1, "A Shortcut will be created to the files (and folders) matching the search.  Shortcuts will be created in the Destination folder")
$_RFSThumbnails = GUICtrlCreateRadio ("Create Thumbnails", 210, 145, 135, 20)
GUICtrlSetTip (-1, "A Thumbnail window will be created with a link to the files (and folders) matching the search." & @CR & "The Thumbnails will be active as long as the Window is not closed")
$_RFSTextfile = GUICtrlCreateRadio ("Create TextFile", 210, 165, 135, 20)
GUICtrlSetTip (-1, "Serach result will output to a text file only." )
If $RFlinks = 1 Then
    GUICtrlSetState ( $_RFShardlinks, $GUI_CHECKED )
ElseIf $RFlinks = 2 Then
    GUICtrlSetState ( $_RFSSoftlinks, $GUI_CHECKED )
ElseIf $RFlinks = 3 Then
    GUICtrlSetState ( $_RFSThumbnails, $GUI_CHECKED )
Else
    GUICtrlSetState ( $_RFSTextfile, $GUI_CHECKED ) 
EndIf

$_About = GUICtrlCreateButton ("About", 362,141,40,40, $BS_BITMAP)
_GUICtrlButton_SetImage(-1, "shell32.dll", 23, True)

If StringLeft($Default_directory,1) <> StringLeft($DestinationFolder,1) Then
    GUICtrlSetState ( $_RFShardlinks, $GUI_UNCHECKED )  
    GUICtrlSetState ( $_RFShardlinks, $GUI_DISABLE )
    GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "Drive mismatch!" & @CR & "Hardlink can only be created on the same source and destination drive")
ElseIf DriveGetFileSystem (StringLeft($Default_directory,3)) <> "NTFS" And DriveGetFileSystem (StringLeft($_DestinationFolder,3)) <> "NTFS" Then
    GUICtrlSetState ( $_RFShardlinks, $GUI_UNCHECKED )  
    GUICtrlSetState ( $_RFShardlinks, $GUI_DISABLE )
    GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "Drive is not NTFS!" & @CR & "Hardlink can only be created on NTFS drives") 
EndIf
    
$buttonGo = GUICtrlCreateButton ("Go", 10,$window_heigth - 65,310,30, $BS_DEFPUSHBUTTON)
Button_AddIcon($buttonGo, "shell32.dll", 176, $BUTTON_IMAGELIST_ALIGN_LEFT)
GUICtrlSetTip (-1, "Start Search")

$buttonClose = GUICtrlCreateButton ("Close", 330,$window_heigth - 65,80,30)
Button_AddIcon($buttonClose, "shell32.dll", -28, $BUTTON_IMAGELIST_ALIGN_LEFT)
GUICtrlSetTip (-1, "Close")

GUISetState(@SW_SHOW)
While 1

    $mainmsg = GUIGetMsg()
    Select
    Case $mainmsg = $_Default_directory
            $fsf = FileSelectFolder ("Select Source folder",@DesktopDir,6,$Default_directory,$SearchGui)
            If Not @error = 1 Then 
                $Default_directory = $fsf
                GUICtrlSetTip ($_Default_directory, $Default_directory & " (" & DriveGetFileSystem (StringLeft($Default_directory,3)) & ")")
            EndIf
            If StringLeft($Default_directory,1) <> StringLeft($DestinationFolder,1) Then
                GUICtrlSetState ( $_RFShardlinks, $GUI_UNCHECKED )  
                GUICtrlSetState ( $_RFShardlinks, $GUI_DISABLE )
                GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "Drive mismatch!" & @CR & "Hardlink can only be created on the same source and destination drive")
            ElseIf DriveGetFileSystem (StringLeft($Default_directory,3)) <> "NTFS" And DriveGetFileSystem (StringLeft($_DestinationFolder,3)) <> "NTFS" Then
                GUICtrlSetState ( $_RFShardlinks, $GUI_UNCHECKED )  
                GUICtrlSetState ( $_RFShardlinks, $GUI_DISABLE )
                GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "Drive is not NTFS!" & @CR & "Hardlink can only be created on NTFS drives") 
            Else
                GUICtrlSetState ( $_RFShardlinks, $GUI_ENABLE )
            EndIf
            
        Case $mainmsg = $_DestinationFolder
            $fsf = FileSelectFolder ("Select Destination folder",@DesktopDir,7,$DestinationFolder,$SearchGui)
            If Not @error = 1 Then 
                $DestinationFolder = $fsf
                GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "This is the folder where Hardlinks will be created.")
            EndIf
            If StringLeft($Default_directory,1) <> StringLeft($DestinationFolder,1) Then
                GUICtrlSetState ( $_RFShardlinks, $GUI_UNCHECKED )  
                GUICtrlSetState ( $_RFShardlinks, $GUI_DISABLE )
                GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "Drive mismatch!" & @CR & "Hardlink can only be created on the same source and destination drive")
            ElseIf DriveGetFileSystem (StringLeft($Default_directory,3)) <> "NTFS" And DriveGetFileSystem (StringLeft($_DestinationFolder,3)) <> "NTFS" Then
                GUICtrlSetState ( $_RFShardlinks, $GUI_UNCHECKED )  
                GUICtrlSetState ( $_RFShardlinks, $GUI_DISABLE )
                GUICtrlSetTip ($_DestinationFolder, $DestinationFolder & " (" & DriveGetFileSystem (StringLeft($DestinationFolder,3)) & ")" & @CR & "Drive is not NTFS!" & @CR & "Hardlink can only be created on NTFS drives") 
            Else
                GUICtrlSetState ( $_RFShardlinks, $GUI_ENABLE )
            EndIf

        Case $mainmsg = $buttonGo
            $Search = True
            GUICtrlSetData ( $buttonGo, "Searching... ('SPACE' to stop)")
            $RFSFilepattern = GUICtrlRead($_RFSFilepattern)
            If $RFSFilepattern = "" Then 
                $RFSFilepattern2 = "."
            Else
                $RFSFilepattern2 = $RFSFilepattern
            EndIf
            
            $RFSFileExtension = GUICtrlRead($_RFSFileExtension)
            If $RFSFileExtension = "" Then 
                $RFSFileExtension2 = "."
            Else
                $RFSFileExtension2 = $RFSFileExtension
            EndIf           
            
            $RFSFolderpattern = GUICtrlRead($_RFSFolderpattern)
            If $RFSFolderpattern = "" Then 
                $RFSFolderpattern2 = "."
            Else
                $RFSFolderpattern2 = $RFSFolderpattern
            EndIf       
            
            If BitAnd(GUICtrlRead($_RFSFlag),$GUI_CHECKED) Then
                $_RFSFlag2 = True
            Else
                $_RFSFlag2 = False
            EndIf
            
            If BitAnd(GUICtrlRead($_RFSrecurse),$GUI_CHECKED) Then
                $_RFSrecurse2 = True
            Else
                $_RFSrecurse2 = False
            EndIf

            If BitAnd(GUICtrlRead($_RFShardlinks),$GUI_CHECKED) Then
                $RFlinks = 1
            ElseIf BitAnd(GUICtrlRead($_RFSSoftlinks),$GUI_CHECKED) Then
                $RFlinks = 2
            ElseIf BitAnd(GUICtrlRead($_RFSThumbnails),$GUI_CHECKED) Then
                $RFlinks = 3
            Else
                $RFlinks = 4
            EndIf

            ; now search
            GUICtrlSetData ( $buttonGo, "Searching... 0 found.  ('SPACE' to stop)")
            HotKeySet("{SPACE}", "Interrupt")
            $FileSearchArray =  RecursiveFileSearch($Default_directory, $RFSFilepattern2, $RFSFileExtension2, $RFSFolderpattern2, $_RFSFlag2, $_RFSrecurse2)
            HotKeySet("{SPACE}", "dummy")
            If $Interrupt = True Then
                $Interrupt = False
                GUICtrlSetData ( $buttonGo, "Go")
            Else
                If UBound($FileSearchArray) <= 1 Then
                    MsgBox(0,"Search", "No files are matching the search criteria." & @CR & "Check if your folders are correctly set.")
                Else
                    If BitAnd(GUICtrlRead($_RFShardlinks),$GUI_CHECKED) Or BitAnd(GUICtrlRead($_RFSSoftlinks),$GUI_CHECKED) Then
                        ; Hardlinks or shortcuts
                        $Create_Links = False
                        If $FileSearchArray[0][0] > 200 Then
                            If BitAnd(GUICtrlRead($_RFShardlinks),$GUI_CHECKED) Then
                                $Type = "HardLink"
                            Else
                                $Type = "Shortcut"
                            EndIf
                            If MsgBox(4,"Creating " & $Type,"Found  " & $FileSearchArray[0][0] & " files to link" & @cr & "Confirm that you want to continue" & @CR & "You can always press 'Space' to interrupt the process.", 0, $SearchGui) = 6 Then
                                $Create_Links = True
                            Else
                                $Create_Links = False
                            EndIf
                        Else
                            $Create_Links = True
                        EndIf
                        
                        ; identify window title 
                        $CurrentFolder = StringTrimRight($DestinationFolder, 1)
                        Local $CurrentFolder2 = StringRight($CurrentFolder, StringLen( $CurrentFolder ) - StringInStr($CurrentFolder,"\", 0, -1))
                        $window_open = WinList ($CurrentFolder2 )
                        If $window_open[0][0] > 0 Then 
                            WinActivate ( $CurrentFolder2 )
                        Else                    
                            $return = Run(@WindowsDir & "\explorer.exe /n,/root, " & $DestinationFolder)
                        EndIf
                    
                        If $Create_Links = True Then
                            $Not_Created = ""
                            GUICtrlSetData ( $buttonGo, "Creating Hardlinks")                   
                            ; create hardlinks of found files in $DestinationFolder
                            ; Works only on NTFS Drive
                            If StringRight($DestinationFolder, 1) <> "\" Then $DestinationFolder &= "\"
                            DirCreate($DestinationFolder)
                            Local $errorHL = False
                            HotKeySet("{SPACE}", "Interrupt")
                            For $i = 1 to $FileSearchArray[0][0]
                                ; check if hardlink file already exists 
                                If Not FileExists($DestinationFolder & "HL_" & $FileSearchArray[$i][0]) Then
                                    If FileGetAttrib ($FileSearchArray[$i][0]) = "D" Then
                                        ; Remove drive letter and illegal characters from directory name
                                        $CurrentFile = StringReplace(StringTrimLeft($FileSearchArray[$i][0],3), "\", "_")
                                        If Not FileExists($DestinationFolder & $CurrentFile & ".lnk") Then
                                            $return = FileCreateShortcut ( $FileSearchArray[$i][0],  $DestinationFolder & $CurrentFile & ".lnk"  )
                                            If $return = 0 Then 
                                                $Not_Created &= "  - " & $FileSearchArray[$i][0] & " Shortcut" & @CR
                                                $errorHL = True
                                            EndIf
                                        EndIf
                                    Else
                                        If BitAnd(GUICtrlRead($_RFShardlinks),$GUI_CHECKED) Then
                                            $return = FileCreateNTFSLink($FileSearchArray[$i][1] & $FileSearchArray[$i][0], $DestinationFolder & "HL_" & $FileSearchArray[$i][0], 0)
                                        Else
                                            $CurrentFile = StringReplace(StringTrimLeft($FileSearchArray[$i][1] & $FileSearchArray[$i][0],3), "\", "_")
                                            $return = FileCreateShortcut ( $FileSearchArray[$i][1] & $FileSearchArray[$i][0],  $DestinationFolder & $CurrentFile & ".lnk"  )
                                        EndIf

                                        If $return = 0 Then 
                                            $Not_Created &= "  - HL_" & $FileSearchArray[$i][0] & @CR
                                            $errorHL = True
                                        EndIf
                                    EndIf
                                EndIf
                                If $Interrupt = True Then 
                                    BuildReport("Following files were not created:" & @CRLF & @CRLF, $i + 1)
                                    ExitLoop
                                EndIf
                            Next
                            $Interrupt = False
                            Beep(2000,300)
                            ; done
                            GUICtrlSetData ( $buttonGo, "Go")
                            
                            If $errorHL Then MsgBox(48,"Error", "Following Hardlink files were not created:" &@CR & $Not_Created)
                        Else
                            ; user stop
                            GUICtrlSetData ( $buttonGo, "Go")
                            MsgBox(48,"Info", $Type & " files were not created!",2)             
                        EndIf           
                    Else
                        ; thumbs or text output
                        Beep(2000,300)
                        Dim $aI[2] = [ 1, 0]
                        GUICtrlSetData ( $buttonGo, "Sorting")
                        _ArraySort_MultiColumn($FileSearchArray, $aI)                   
                        If BitAnd(GUICtrlRead($_RFSThumbnails),$GUI_CHECKED) Then
                            GUICtrlSetData ( $buttonGo, "Go")
                            $Create_Links = False
                            If $FileSearchArray[0][0] > 200 Then
                                If MsgBox(4,"Creating Thumbs" ,"Found  " & $FileSearchArray[0][0] & " files to link" & @cr & "Confirm that you want to continue" & @CR & "You can always press 'Space' to interrupt the process.", 0, $SearchGui) = 6 Then
                                    $Create_Links = True
                                Else
                                    $Create_Links = False
                                EndIf
                            Else
                                $Create_Links = True
                            EndIf
                            If $Create_Links = True Then
                                DisplayThumbs($FileSearchArray)
                                $Interrupt = False
                            EndIf
                        Else
                            ; put result in a text File
                            BuildReport("")
                        EndIf
                        GUICtrlSetData ( $buttonGo, "Go")
                    EndIf
                EndIf
            EndIf
            $FileSearchArray= "" 
            
        Case $mainmsg = $_about
            about()
            
        Case $mainmsg = $buttonClose Or $mainmsg = $GUI_EVENT_CLOSE
            Terminate()
    
    EndSelect
WEnd

Exit

Exit
#Region Functions
#FUNCTION# ==============================================================
; #FUNCTION# =============================================================================
; Name...........:  _ArraySort_MultiColumn
; Description ...:  sorts an array at given colums (multi colum sort)
; Syntax.........:  _ArraySort_MultiColumn(ByRef $aSort, ByRef $aIndices)
; Parameters ....:  $aSort - array to sort
;       $aIndices - array with colum indices which should be sorted in
;                   specified order
; Autor .........:  UEZ
; Version .......:  v0.55 build 2010-03-10 Beta
; =========================================================================================
Func _ArraySort_MultiColumn(ByRef $aSort, ByRef $aIndices, $dir = 0)
    Local $1st, $2nd
    If Not IsArray($aIndices) Or Not IsArray($aSort) Then ;checks if $aIndices is an array
        Return SetError(1, 0, 0) ;no array
    EndIf
    If UBound($aIndices) > UBound($aSort, 2) Then ;check if $aIndices array is greater the $aSort array
        Return SetError(2, 0, 0) ;$aIndices array is greater
    EndIf
    Local $x
    For $x = 0 To UBound($aIndices) - 1 ;check if array content makes sense
        If Not IsInt($aIndices[$x]) Then
            Return SetError(3, 0, 0) ;array content is not numeric
        EndIf
    Next
    If UBound($aIndices) = 1 Then ;check if only one index is given
        Return _ArraySort($aSort, $dir, 0, 0, $aIndices[0])
    EndIf
    Local $j, $k, $l = 0
    _ArraySort($aSort, $dir, 0, 0, $aIndices[0])
    Do
        $1st = $aIndices[$l]
        $2nd = $aIndices[$l + 1]
        $j = 0
        $k = 1
        While $k < UBound($aSort)
            If $aSort[$j][$1st] <> $aSort[$k][$1st] Then
                If $k - $j > 1 Then
                    _ArraySort($aSort, $dir , $j, $k - 1, $2nd)
                    $j = $k
                Else
                    $j = $k
                EndIf
            EndIf
            $k += 1
        WEnd
        If $k - $j > 1 Then _ArraySort($aSort, $dir, $j, $k, $2nd)
        $l += 1
    Until $l = UBound($aIndices) - 1
    Return SetError(0, 0, 1)
EndFunc ;==>_ArraySort_MultiColumn
#FUNCTION# ==============================================================
Func RecursiveFileSearch($RFSstartDir, $RFSFilepattern = ".", $RFSFileExtension= ".", $RFSFolderpattern = ".", $RFSFlag = True, $RFSrecurse = True, $RFSdepth = 0)
    #cs
    recursive case insensitive file search 
    
    parameters:
        1. $RFSstartDir = root directory to start searching in
        
      optional:
      
        2. $RFSFilepattern = the pattern to search for
            Default: "." will show all Files
            
        3. $RFSFileExtension = limit the search to files with given extension 
            Default: "." will search all File extension
            
        4. $RFSFolderpattern = if set the patern will limit the search in folders containing the pattern
            Default: "." will search all Folders
            
        5. $RFSFlag 
            True = Default: Add the full paths in col 1
            False = No paths
            
        6. $RFSrecurse
            Recursive file search (including sub folders)
            True = Default
            False
            
        System only:
        
        7. $RFSdepth
            Always 0, used for recursive search
                
    Returns:
        returns a 2 dimentional array containing 
            Col 0 =  File name
            Col 1 =  Full path
        
    example
    Search starting in 'D:\Pictures' for 'jpg' formats containing string 'fish' in folders containing string 'nature', don't show folder names, recursive search
        $array = RecursiveFileSearch("D:\Pictures", "fish", ".jpg", "nature", True,  True)
    #ce

    $RFSFilepattern = StringUpper($RFSFilepattern)
    ; Ensure file extension always start with .
    If StringLeft($RFSFileExtension,1) <> "." Then  $RFSFileExtension = "." & $RFSFileExtension
    If $RFSFileExtension = "." Then $RFSFileExtension = "" 

    ;Ensure starting folder has a trailing slash
    If StringRight($RFSstartDir, 1) <> "\" Then $RFSstartDir &= "\"
    
    ; If a folder patern is given, include the root folder in the filter match.
    If $RFSFolderpattern = "." Or StringInStr($RFSstartDir, $RFSFolderpattern) > 0 Then
        $SelectRootfolder = True
    Else
        $SelectRootfolder = False
    EndIf   

    ; initial pass - define array
    If $RFSdepth = 0 Then
        ;Get count of all files in subfolders for initial array definition
        $RFSfilecount = DirGetSize($RFSstartDir, 1)
        ;File count + folder count (will be resized when the function returns)
        If IsArray($RFSfilecount) Then 
            Global $RFSarray[$RFSfilecount[1] + $RFSfilecount[2] + 1][2]
        Else
            SetError(1)
            Return
        EndIf
    EndIf

    ; find first file
    $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 and recurse flag is set and regex matches
        If StringInStr(FileGetAttrib($RFSstartDir & $RFSnext), "D") Then
            If $RFSrecurse then
                RecursiveFileSearch($RFSstartDir & $RFSnext, $RFSFilepattern, $RFSFileExtension, $RFSFolderpattern, $RFSFlag, $RFSrecurse, $RFSdepth + 1)
                If $RFSFlag Then
                    $_RFSnext = StringUpper($RFSnext)
                    If StringRegExp($_RFSnext, $RFSFilepattern, 0) Then 
                        ;Append folder name to array
                        $RFSarray[$RFSarray[0][0] + 1][0] = $RFSstartDir & $RFSnext
                        $RFSarray[0][0] += 1
                    EndIf
                
                EndIf
            EndIf
        Else
            If $SelectRootfolder = True Then
                ; upperize the file name for caseless comparison
                $_RFSnext = StringUpper($RFSnext)
                ; only select the files with correct extension
                If StringRight($_RFSnext,StringLen($RFSFileExtension)) = $RFSFileExtension Then
                    If StringRegExp($_RFSnext, $RFSFilepattern, 0) Then; AND $RFSFlag Then
                        ;Append file name to array
                        $RFSarray[$RFSarray[0][0] + 1][0] =  $RFSnext   
                        $RFSarray[$RFSarray[0][0] + 1][1] =  $RFSstartDir                   
                        $RFSarray[0][0] += 1
                        ; added for the sake of knowledge - following line is not part of the function and shuld be removed if used elsewhere
                        If $RFSarray[0][0] < 11 Or $RFSarray[0][0]/10 = Int($RFSarray[0][0]/10) Then GUICtrlSetData ( $buttonGo, "Searching... " & $RFSarray[0][0] & " found. ('SPACE' to stop)")
                    EndIf
                EndIf
            EndIf
        EndIf
        If $Interrupt = True Then ; space pressed
            If $RFSdepth = 0 Then
                Redim $RFSarray[$RFSarray[0][0] + 1][2]
                Return $RFSarray
            Else
                Return $RFSarray
            EndIf
        EndIf
    WEnd
    FileClose($RFSsearch)

    If $RFSdepth = 0 Then
        Redim $RFSarray[$RFSarray[0][0] + 1][2]
    EndIf
    Return $RFSarray    
EndFunc ;==>RecursiveFileSearch
#FUNCTION# ==============================================================
Func DisplayThumbs(ByRef $FileSearchArray)
    ; Hide main window first
    GUISetState(@SW_HIDE, $SearchGui )
    _GDIPlus_Startup()

    Local $window_width = 900
    Local $window_heigth = 600
    $ThumbnailGUI = GUICreate("Search result - Thumbnails", $window_width, $window_heigth);, Default, Default, $WS_SIZEBOX)
    Local $ProgessLabel = GUICtrlCreateLabel ( "", 5, 5, $window_width-70 , 20 )
    Local $buttonClose = GUICtrlCreateButton ("Close", $window_width-70 ,1,68,21)
    Button_AddIcon($buttonClose, "shell32.dll", -28, $BUTTON_IMAGELIST_ALIGN_LEFT)
    GUICtrlSetTip (-1, "Close")
    GUICtrlSetState ( $buttonClose, $GUI_DISABLE )

    $hListView = GUICtrlCreateListView("", 2, 22, $window_width-4, $window_heigth-24)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_TRACKSELECT))
    GUICtrlSetStyle($hListView, $LVS_ICON)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_BORDERSELECT)

    GUISetState()

    Global $DoubleClicked = False
    ; create image list
    $hiList = _GUIImageList_Create(96, 96, 5, 0, 1, 10000)

    ; create parent graphic object
    $hwnd = _WinAPI_GetDesktopWindow()
    $hDC = _WinAPI_GetDC($hwnd)
    $hGraphics1 = _GDIPlus_GraphicsCreateFromHDC($hDC)
    _WinAPI_ReleaseDC($hwnd, $hDC)

    

    For $i = 1 To $FileSearchArray[0][0]
        If $i > 2 Then HotKeySet("{SPACE}", "Interrupt")
        GUICtrlSetData ( $ProgessLabel, "Thumbnail " & $i & " of " & $FileSearchArray[0][0] & ": " & $FileSearchArray[$i][1] & $FileSearchArray[$i][0] )

        ; create resized graphic to place the image into
        $hBmp = _GDIPlus_BitmapCreateFromGraphics(96, 96, $hGraphics1)
        $hGraphics2 = _GDIPlus_ImageGetGraphicsContext($hBmp)

        If $Interrupt = False Then 
            ; load image
            $hImage = _GDIPlus_ImageLoadFromFile($FileSearchArray[$i][1] & $FileSearchArray[$i][0])
            
            If FileGetAttrib ($FileSearchArray[$i][1] & $FileSearchArray[$i][0]) = "D" Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_Folder.jpg")
                $x = 0
                $h = 96
                $w = 96
                $size = "" ; this is obvious                
            ElseIf StringInStr(".bmp.jpg.gif.tif.png.ico",StringRight($FileSearchArray[$i][0],4))>0 Then
                $Width = _GDIPlus_ImageGetWidth($hImage)
                $Height = _GDIPlus_ImageGetHeight($hImage)
                If $hImage = 0x00000000 Then 
                    $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_None.jpg")            
                    $size = ""
                    $x = 12
                    $h = 70
                    $w = 70
                    $size =  "Corrupt !!!"
                Else
                    $size = $Width & " x " & $Height
                    If $Width <= $Height Then
                        $h = 96 
                        $w = 96 / ( $Height / $Width)
                        $x = ( 96 - $w ) / 2 
                    Else
                        $h = 96 / ($Width / $Height)    
                        $w = 96
                        $x = 0
                    EndIf       
                EndIf
            ElseIf StringInStr(".txt",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_Text.jpg")
                $size = ""
                $x = 3
                $h = 96
                $w = 90
                $size = "Text File" 
            ElseIf StringInStr(".wma",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_wma.jpg")
                $size = ""
                $x = 6
                $h = 96
                $w = 78
                $size = "" ; this is obvious
            ElseIf StringInStr(".mp3",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_mp3.jpg")
                $size = ""
                $x = 6
                $h = 96
                $w = 78
                $size = "" ; this is obvious
            ElseIf StringInStr(".wmv",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_wmv.jpg")
                $size = ""
                $x = 6
                $h = 96
                $w = 78
                $size = "Video format" 
            ElseIf StringInStr(".htm",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_html.jpg")
                $size = ""
                $x = 0
                $h = 96
                $w = 96
                $size = "" ; this is obvious
            ElseIf StringInStr(".pdf",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_pdf.jpg")
                $size = ""
                $x = 6
                $h = 96
                $w = 84
                $size = "" ; this is obvious
            ElseIf StringInStr(".doc",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_doc.jpg")
                $size = ""
                $x = 0
                $h = 96
                $w = 96
                $size = "Word Document" 
            ElseIf StringInStr(".pps",StringRight($FileSearchArray[$i][0],4))>0 Or StringInStr(".ppt",StringRight($FileSearchArray[$i][0],4))> 0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_pps.jpg")
                $size = ""
                $x = 0
                $h = 80
                $w = 96
                $size = "Powerpoint"                    
            ElseIf StringInStr(".xls",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_xls.jpg")
                $size = ""
                $x = 0
                $h = 96
                $w = 96
                $size = "Excel Document"    
            ElseIf StringInStr(".url",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_url.jpg")
                $size = ""
                $x = 0
                $h = 96
                $w = 96
                $size = "" ; this is obvious
            ElseIf StringInStr(".lnk",StringRight($FileSearchArray[$i][0],4))>0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_ShortCut.jpg")
                $size = ""
                $x = 25
                $h = 45
                $w = 45
                $size = "ShortCut"  
; add your own here             
            Else
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Resource\_Unsupported.jpg")
                $size = ""
                $x = 24
                $h = 50 
                $w = 50
                $size = "" ;No thumbnail
            EndIf

            ; draw the resized image and get handle to HBITMAP
            _GDIPlus_GraphicsDrawImageRect($hGraphics2, $hImage, $x, (96 - $h) / 2,  $w, $h)
            $hHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
        Else
            ; remove the following 3 lines to continue building the listview without the thumbs
            ; space bar pressed, display a text file of what has not been displayed
            BuildReport("Thumbnails build interrupted. Following files are not displayed:" & @CRLF & @CRLF, $i)
            ExitLoop 
        EndIf       
        ; set new image into list
        _GUIImageList_Add($hiList, $hHBMP)

        ; dispose objects
        _GDIPlus_ImageDispose($hBmp)
        _GDIPlus_GraphicsDispose($hGraphics2)
        _GDIPlus_ImageDispose($hImage)
        _WinAPI_DeleteObject($hHBMP)

        ; set image list to control
        _GUICtrlListView_SetImageList($hListView, $hiList)
        $index =  _GUICtrlListView_AddItem($hListView, $FileSearchArray[$i][0] & @CR & $size, $i - 1)       

    Next
    $Interrupt = False
    GUICtrlSetData ( $ProgessLabel, "Result:  " & $FileSearchArray[0][0] & "  items.   Double click the object to open")
    ; dispose parent graphic
    _GDIPlus_GraphicsDispose($hGraphics1)
    _GUICtrlListView_SetItemSelected($hListView, 0)
    
    GUICtrlSetState ( $buttonClose, $GUI_ENABLE )
    
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    While 1
        $mainmsg = GUIGetMsg()
        Select  
            Case $DoubleClicked 
                $DoubleClicked = False
                $indice = _GUICtrlListView_GetSelectedIndices($hListView, False)+1
                $return = ShellExecute ($FileSearchArray[$indice][1] & $FileSearchArray[$indice][0] ) 
                
            Case $mainmsg = $GUI_EVENT_CLOSE  Or $mainmsg = $buttonClose ; Close Window
                ;If MsgBox(4,"Close","Close Windoow?",3, $ThumbnailGUI) = 6 Then
                    ; final cleanup
                    GUIDelete($ThumbnailGUI)
                    _GUIImageList_Destroy($hiList)
                    _GDIPlus_Shutdown() 
                    ; show main window 
                    GUISetState(@SW_SHOW , $SearchGui )     
                    Return
                ;EndIf
    
        EndSelect
    WEnd
EndFunc ; ==>DisplayThumbs
#FUNCTION# ==============================================================
Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
    ; notify used for Double click in Main menu
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $hListView And $code = -3 Then 
        $DoubleClicked = True
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc ; ==>WM_NOTIFY
#FUNCTION# ==============================================================
Func BuildReport($message, $start = 1)
    If $_RFSrecurse2 Then
        $result = "Recursive File Search result"
    Else
        $result = "File Search result" 
    EndIf
    $result &= @CRLF & "  Root Folder   : " & $Default_directory & @CRLF & "  Search pattern: " & $RFSFilepattern2 & @CRLF & "  File Extension: " & $RFSFileExtension2 & @CRLF & "  Folder filter : " & $RFSFolderpattern2 & @CRLF & @CRLF & $message
    For $i = $start to $FileSearchArray[0][0]
        If $FileSearchArray[$i][1] = "" Then
            $result &= $FileSearchArray[$i][0] & " (Folder)" & @CRLF
        Else
            $result &= $FileSearchArray[$i][1] & $FileSearchArray[$i][0] & @CRLF
        EndIf
    Next
    $file = FileOpen ( @MyDocumentsDir & "\Search result.txt", 2 )
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
    Else
        FileWrite($file, $result)
        FileClose($file)
    EndIf
    $return = ShellExecute ( @MyDocumentsDir & "\Search result.txt")
    Return
EndFunc ; ==>BuildReport
#FUNCTION# ==============================================================
Func dummy()
    Return
EndFunc ; ==>dummy
#FUNCTION# ==============================================================
Func Interrupt()
    Beep(2000,300)
    $Interrupt = True
    HotKeySet("{SPACE}", "dummy")
    Return
EndFunc ; ==>Interrupt
#FUNCTION# ==============================================================
Func Terminate()
    If MsgBox(4,"The End","Quit?",3, $SearchGui) = 6 Then
        If $Search = True Then
            ; write ini because a search was performed and we save the current settings
            IniWrite ($inifile,"Global","Default_directory", $Default_directory )           
            IniWrite ($inifile,"Global","DestinationFolder", $DestinationFolder )           
            IniWrite ($inifile,"Global","RFSFilepattern", $RFSFilepattern )
            IniWrite ($inifile,"Global","RFSFileExtension", $RFSFileExtension ) 
            IniWrite ($inifile,"Global","RFSFolderpattern", $RFSFolderpattern )
            
            If BitAnd(GUICtrlRead($_RFSFlag),$GUI_CHECKED) Then 
                IniWrite ($inifile,"Global","RFSFlag", 1 )  
            Else
                IniWrite ($inifile,"Global","RFSFlag", 2 )  
            EndIf               
            If BitAnd(GUICtrlRead($_RFSrecurse),$GUI_CHECKED) Then
                IniWrite ($inifile,"Global","RFSrecurse", 1 )
            Else
                IniWrite ($inifile,"Global","RFSrecurse", 0 )
            EndIf               
            If BitAnd(GUICtrlRead($_RFShardlinks),$GUI_CHECKED) Then
                IniWrite ($inifile,"Global","RFSlinks", 1 )
            ElseIf BitAnd(GUICtrlRead($_RFSSoftlinks),$GUI_CHECKED) Then
                IniWrite ($inifile,"Global","RFSlinks", 2 )
            ElseIf BitAnd(GUICtrlRead($_RFSThumbnails),$GUI_CHECKED) Then
                IniWrite ($inifile,"Global","RFSlinks", 3 )
            Else
                IniWrite ($inifile,"Global","RFSlinks", 4 )
            EndIf               
        EndIf
        GUIDelete($SearchGui)
        Exit
    EndIf
EndFunc ; ==>Terminate
#FUNCTION# ==============================================================
Func About()
    Local $msg
    Local $window_width = 280
    Local $window_heigth = 130
    Local $About = GuiCreate("                              Directory Search" , $window_width, $window_heigth, Default, Default,$WS_CAPTION, $WS_EX_TOPMOST)
    GuiCtrlCreateLabel("Author: A. GreenCan" & @CR & "Ver " & $version & @CR & $VersionDate, ($window_width-120)/2, 10,180,50)

    GuiCtrlCreateLabel("____________________________________________", 10,50, $window_width - 20,15, $SS_CENTER) ; separator
    
    GuiCtrlCreateLabel("Listen to Jeff Beck's 'Emotion and Commotion'", 5, 68,$window_width -10,20, $SS_CENTER) ; he he!
    Local $ok = GUICtrlCreateButton("OK", 10, $window_heigth - 25, 70,22, $BS_DEFPUSHBUTTON )

    #Region Perforated Image
    ; Perforated Image
    # ==> Start
    Local $_Left_pos, $_Top_pos, $_GUI_NAME
    $_Left_pos = $window_width - 145; 338 ; Replace with correct position
    $_Top_pos = $window_heigth - 18; 521 ; Replace with correct position
    _GuiImageHole($About, $_Left_pos, $_Top_pos, 136, 41)
    # <== End
    #EndRegion Perforated Image

    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $ok
            ExitLoop
        EndSelect
    WEnd
    GUIDelete($About)
    Return
EndFunc  ;==>About
#FUNCTION# ==============================================================
#Region Button icons
; Button functions by Holger
Func Button_AddIcon($nID, $sIconFile, $nIconID, $nAlign)

    Local $hIL    = ImageList_Create(16, 16, BitOr($ILC_MASK, $ILC_COLOR32), 0, 1)

    Local $stIcon   = DllStructCreate("int")
    ExtractIconEx($sIconFile, $nIconID, DllStructGetPtr($stIcon), 0, 1)

    ImageList_AddIcon($hIL, DllStructGetData($stIcon, 1))
    DestroyIcon(DllStructGetData($stIcon, 1))

    Local $stBIL    = DllStructCreate("dword;int[4];uint")

    DllStructSetData($stBIL, 1, $hIL)

    DllStructSetData($stBIL, 2, 1, 1)
    DllStructSetData($stBIL, 2, 1, 2)
    DllStructSetData($stBIL, 2, 1, 3)
    DllStructSetData($stBIL, 2, 1, 4)

    DllStructSetData($stBIL, 3, $nAlign)

    GUICtrlSendMsg($nID, $BCM_SETIMAGELIST, 0, DllStructGetPtr($stBIL))
EndFunc ;==>Button_AddIcon
#FUNCTION# ==============================================================
Func ImageList_Create($nImageWidth, $nImageHeight, $nFlags, $nInitial, $nGrow)
    Local $hImageList = DllCall('comctl32.dll', 'hwnd', 'ImageList_Create', _
                        'int', $nImageWidth, _
                        'int', $nImageHeight, _
                        'int', $nFlags, _
                        'int', $nInitial, _
                        'int', $nGrow)
    Return $hImageList[0]
EndFunc ;==>ImageList_Create
#FUNCTION# ==============================================================
Func ImageList_AddIcon($hIml, $hIcon)
    Local $nIndex = DllCall('comctl32.dll', 'int', 'ImageList_AddIcon', _
                    'hwnd', $hIml, _
                    'hwnd', $hIcon)
    Return $nIndex[0]
EndFunc ;==>
#FUNCTION# ==============================================================
Func ImageList_Destroy($hIml)
    Local $bResult = DllCall('comctl32.dll', 'int', 'ImageList_Destroy', _
                    'hwnd', $hIml)
    Return $bResult[0]
EndFunc ;==>ImageList_Destroy
#FUNCTION# ==============================================================
Func ExtractIconEx($sIconFile, $nIconID, $ptrIconLarge, $ptrIconSmall, $nIcons)
    Local $nCount = DllCall('shell32.dll', 'int', 'ExtractIconEx', _
                    'str', $sIconFile, _
                    'int', $nIconID, _
                    'ptr', $ptrIconLarge, _
                    'ptr', $ptrIconSmall, _
                    'int', $nIcons)
    Return $nCount[0]
EndFunc ;==>ExtractIconEx
#FUNCTION# ==============================================================
Func DestroyIcon($hIcon)
    Local $bResult = DllCall('user32.dll', 'int', 'DestroyIcon', _
                    'hwnd', $hIcon)
    Return $bResult[0]
EndFunc ;==>DestroyIcon
#EndRegion Button icons
#FUNCTION# ==============================================================
#Region Perforated Image
#comments-start
    The lines below will generate the perforated image (bewteen start and end)
    Move these lines into your GUI code, usually just before GUISetState()
    Don't forget to fill in the correct coordinates for $Left_pos, $Top_pos
    and enter the GUI Window Handle in the last line

# ==> Start
Local $_Left_pos, $_Top_pos, $_GUI_NAME
$_Left_pos = 10 ; Replace with correct position
$_Top_pos = 10 ; Replace with correct position
$_GUI_NAME = 'The name of your GUI window'
_GuiImageHole($_GUI_NAME, $_Left_pos, $_Top_pos, 136, 45)
# <== End

#comments-end

#FUNCTION# ==============================================================
Func _GuiImageHole($window_handle, $pos_x, $pos_y,$Image_Width ,$Image_Height)
    Local $aClassList, $aM_Mask, $aMask
    #Region picture array
    Local $PictArray[262] = [ _
    '3,1,48,1','50,1,137,1','3,2,48,2','50,2,93,2','94,2,137,2','1,3,2,3','4,3,47,3','49,3,92,3','95,3,137,3','1,4,3,4','5,4,25,4','28,4,46,4','48,4,92,4','95,4,137,4','1,5,3,5','5,5,25,5','29,5,45,5','48,5,92,5','95,5,137,5','1,6,4,6', _
    '6,6,24,6','30,6,45,6','47,6,92,6','96,6,137,6','1,7,5,7','7,7,9,7','10,7,23,7','30,7,38,7','42,7,44,7','46,7,93,7','96,7,137,7','1,8,6,8','11,8,24,8','29,8,37,8','45,8,66,8','68,8,93,8','96,8,137,8','1,9,6,9','13,9,24,9','30,9,36,9', _
    '44,9,66,9','69,9,87,9','91,9,93,9','97,9,137,9','1,10,6,10','13,10,23,10','31,10,37,10','43,10,65,10','71,10,86,10','92,10,93,10','97,10,137,10','1,11,6,11','12,11,22,11','32,11,35,11','42,11,65,11','71,11,86,11','92,11,93,11','97,11,137,11','1,12,6,12','15,12,22,12', _
    '32,12,34,12','43,12,50,12','54,12,65,12','70,12,86,12','97,12,137,12','1,13,5,13','18,13,21,13','32,13,33,13','44,13,49,13','55,13,65,13','72,13,86,13','96,13,137,13','1,14,5,14','15,14,16,14','44,14,48,14','55,14,64,14','73,14,86,14','96,14,137,14','1,15,4,15','15,15,20,15', _
    '45,15,48,15','54,15,64,15','74,15,85,15','96,15,137,15','1,16,4,16','17,16,19,16','46,16,48,16','55,16,63,16','75,16,84,16','96,16,137,16','1,17,5,17','17,17,18,17','46,17,47,17','56,17,63,17','76,17,84,17','97,17,137,17','1,18,5,18','17,18,18,18','46,18,47,18','56,18,63,18', _
    '77,18,84,18','97,18,137,18','1,19,6,19','16,19,18,19','33,19,34,19','57,19,63,19','77,19,84,19','98,19,137,19','1,20,6,20','16,20,17,20','32,20,34,20','58,20,63,20','77,20,84,20','98,20,137,20','1,21,6,21','16,21,17,21','32,21,34,21','58,21,63,21','78,21,83,21','98,21,137,21', _
    '1,22,6,22','32,22,34,22','58,22,63,22','78,22,83,22','98,22,137,22','1,23,6,23','57,23,64,23','78,23,82,23','98,23,137,23','1,24,6,24','57,24,65,24','78,24,82,24','98,24,137,24','1,25,6,25','58,25,65,25','77,25,82,25','99,25,137,25','1,26,6,26','58,26,64,26','76,26,83,26', _
    '99,26,137,26','1,27,7,27','32,27,33,27','46,27,47,27','58,27,64,27','77,27,83,27','100,27,137,27','1,28,7,28','31,28,33,28','46,28,47,28','58,28,65,28','77,28,83,28','99,28,137,28','2,29,7,29','31,29,33,29','59,29,65,29','78,29,84,29','98,29,137,29','7,30,8,30','16,30,18,30', _
    '31,30,33,30','46,30,47,30','59,30,65,30','79,30,84,30','96,30,137,30','8,31,10,31','15,31,18,31','25,31,26,31','31,31,34,31','45,31,47,31','60,31,62,31','79,31,85,31','95,31,137,31','3,32,6,32','8,32,10,32','15,32,21,32','25,32,26,32','33,32,34,32','42,32,48,32','60,32,62,32', _
    '78,32,85,32','95,32,137,32','34,33,35,33','39,33,40,33','42,33,49,33','60,33,62,33','76,33,86,33','95,33,120,33','125,33,130,33','135,33,137,33','38,34,39,34','44,34,51,34','76,34,88,34','95,34,122,34','125,34,129,34','131,34,134,34','135,34,137,34','47,35,51,35','55,35,60,35','64,35,65,35', _
    '76,35,88,35','95,35,121,35','123,35,124,35','126,35,128,35','130,35,134,35','135,35,137,35','49,36,51,36','56,36,62,36','65,36,66,36','69,36,70,36','76,36,81,36','83,36,88,36','95,36,120,36','122,36,124,36','126,36,127,36','129,36,137,36','56,37,58,37','66,37,70,37','76,37,78,37','84,37,88,37', _
    '95,37,120,37','122,37,124,37','126,37,127,37','129,37,131,37','135,37,137,37','67,38,71,38','77,38,79,38','84,38,89,38','95,38,119,38','126,38,127,38','129,38,132,38','134,38,137,38','32,39,33,39','85,39,89,39','95,39,118,39','120,39,124,39','126,39,127,39','129,39,132,39','134,39,137,39','18,40,24,40', _
    '26,40,41,40','86,40,89,40','95,40,117,40','121,40,123,40','127,40,128,40','134,40,137,40','14,41,46,41','85,41,89,41','95,41,137,41','9,42,52,42','88,42,89,42','97,42,137,42','7,43,55,43','57,43,59,43','62,43,65,43','67,43,69,43','70,43,73,43','100,43,137,43','6,44,79,44','100,44,137,44', _
    '4,45,81,45','100,45,137,45']
    #EndRegion picture array
    ; get the size of the active window
    $size = WinGetClientSize($window_handle)
    $Window_width = $size[0]
    $Window_height = $size[1]+33 ; including the title bar
    ; First hide the window
    $aClassList = StringSplit(_WinGetClassListEx($window_handle), @LF)
    $aM_Mask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', 0, 'long', 0)
    ; rectangle A - left side
    $aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $pos_x, 'long', $Window_height)
    DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
    ; rectangle B - Top
    $aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $Window_width, 'long', $pos_y)
    DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
    ; rectangle C - Right side
    $aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $pos_x  + $Image_Width , 'long', 0 , 'long', $Window_width + 30, 'long', $Window_height)
    DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
    ; rectangle D - Bottom
    $aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0 , 'long', $pos_y + $Image_Height, 'long', $Window_width, 'long', $Window_height)
    DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
    ; now unhide all regions as defined  in array $PictArray
    For $i = 0 To (UBound($PictArray) - 1)
        $Block_value = StringSplit($PictArray[$i],',')
        $aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $pos_x + $Block_value[1] - 1 , 'long', $pos_y + $Block_value[2], 'long', $pos_x + $Block_value[3], 'long', $pos_y + $Block_value[4] -1)
        DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
    Next
    DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $window_handle, 'long', $aM_Mask[0], 'int', 1)
    $PictArray='' ; empty array
EndFunc  ;==>_GuiImageHole
#FUNCTION# ==============================================================
Func _WinGetClassListEx($sTitle)
    Local $sClassList = WinGetClassList($sTitle)
    Local $aClassList = StringSplit($sClassList, @LF)
    Local $sRetClassList = '', $sHold_List = '|'
    Local $aiInHold, $iInHold
    For $i = 1 To UBound($aClassList) - 1
        If $aClassList[$i] = '' Then ContinueLoop
        If StringRegExp($sHold_List, '\|' & $aClassList[$i] & '~(\d+)\|') Then
            $aiInHold = StringRegExp($sHold_List, '.*\|' & $aClassList[$i] & '~(\d+)\|.*', 1)
            $iInHold = Number($aiInHold[UBound($aiInHold)-1])
            If $iInHold = 0 Then $iInHold += 1
            $aClassList[$i] &= '~' & $iInHold + 1
            $sHold_List &= $aClassList[$i] & '|'
            $sRetClassList &= $aClassList[$i] & @LF
        Else
            $aClassList[$i] &= '~1'
            $sHold_List &= $aClassList[$i] & '|'
            $sRetClassList &= $aClassList[$i] & @LF
        EndIf
    Next
    Return StringReplace(StringStripWS($sRetClassList, 3), '~', '')
EndFunc ;==>_WinGetClassListEx
#EndRegion Perforated Image
#FUNCTION# ==============================================================
#EndRegion Functions
Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites



Huh? Editing a post is simple! Just click the button that says 'Edit'. Trust me, I do it all of the time.

Yes?

How do you explain my previous message, all garbage once again and the tags are correct. I don't have an explanation.

If I try to edit my previous entries, I receive a message 'you have to enter a post' and I can't save it.


Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Please just save your script to an .au3 file, then upload it.

Edit:

Removed bad imported code post.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0