Page 1 of 2

Everything Search Tool

Posted: Sat Nov 09, 2019 1:24 am
by AUGE_OHR
hi,

did you often search a file :?:

i most have used Total Commander and ALT-F7
since TC Version 8.5x there was a Option "Everything" ... hm

i install it from
https://www.voidtools.com/
and it search now much faster than before. :o

i found out that i can use Everything.DLL in my Xbase++ App.

this Version now is for harbour / HMG
hb_Everything.jpg
hb_Everything.jpg (180.42 KiB) Viewed 3567 times
HBEVERY.ZIP
(2.42 KiB) Downloaded 261 times
! Note : have use BCC582 see HBC

---

Question : how to detect if a DLL can be load :?:

Code: Select all

   nDLL := LoadLibrary("Everything32.dll")
this Code does not work with HMG (perhaps Extended Version can do it)

Re: Everything Search Tool

Posted: Sat Nov 09, 2019 4:31 am
by AUGE_OHR
when found what you search you can "goto" it with this Code

add under GRID_1

Code: Select all

    ON DBLCLICK GoToDir(EVFORM.Grid_1.Value,ThisWindow.Name,This.Name)
and insert this Code

Code: Select all

STATIC PROCEDURE GoToDir(nDir,cForm,cGrid)
LOCAL cText  := ""
LOCAL cPath  := ""

   cPath := GetProperty( cForm, cGrid, "CELL", nDir, 1 )

   cText  := "explorer /e,/select,"+cPath
   MemoWrit("ChangeDir.BAT",cText)

   RUN ChangeDir.BAT

RETURN

Re: Everything Search Tool

Posted: Sat Nov 09, 2019 6:21 pm
by jairpinho
AUGE_OHR wrote: Sat Nov 09, 2019 1:24 am hi,

did you often search a file :?:

i most have used Total Commander and ALT-F7
since TC Version 8.5x there was a Option "Everything" ... hm

i install it from
https://www.voidtools.com/
and it search now much faster than before. :o

i found out that i can use Everything.DLL in my Xbase++ App.

this Version now is for harbour / HMG
hb_Everything.jpg

HBEVERY.ZIP

! Note : have use BCC582 see HBC

---

Question : how to detect if a DLL can be load :?:

Code: Select all

   nDLL := LoadLibrary("Everything32.dll")
this Code does not work with HMG (perhaps Extended Version can do it)

hello could do with ide use without using bcc582

Re: Everything Search Tool

Posted: Sat Nov 09, 2019 7:08 pm
by AUGE_OHR
hi,
jairpinho wrote: Sat Nov 09, 2019 6:21 pm hello could do with ide use without using bcc582
i have take out from hbEVERY.HBC

Code: Select all

libpaths=C:\BCC582\lib
and it still work with HMG IDE

Re: Everything Search Tool

Posted: Sun Nov 10, 2019 9:21 am
by AUGE_OHR
hi,

forgot to say : please download 32 Bit (!) Version of Everything.

have not test it with harbour / HMG 64 Bit yet.

---

Demo Code use "A"nsi function
if you need Unicode please change those "A" function to "W"

Re: Everything Search Tool

Posted: Mon Nov 11, 2019 12:08 am
by AUGE_OHR
i also use Everything to find files with Attribut "A" for Backup.

you have to configure Everything in Setup and enable Attribut.
Every_Setup.jpg
Every_Setup.jpg (87.42 KiB) Viewed 3409 times
than you can search with

Code: Select all

"D:\ALASKA\ attrib:A"
this will search for all files with Attribut "A" under D:\ALASKA\

you have to modify Code for Attribut with other Constant this Way

Code: Select all

      // set search
      @ Everything32:Everything_SetSearchA( cText )

      // what to search
      @ Everything32:Everything_SetRequestFlags( nor( EVERYTHING_REQUEST_PATH, EVERYTHING_REQUEST_FILE_NAME, EVERYTHING_REQUEST_ATTRIBUTES, EVERYTHING_REQUEST_EXTENSION ) )

      // sort result
      @ Everything32:Everything_SetSort( EVERYTHING_SORT_ATTRIBUTES_DESCENDING )

      // execute the query
      @ Everything32:Everything_QueryA( .T. )

      nNum := @Everything32:Everything_GetNumResults()
      FOR n := 1 TO nNum
         // is it a File (other are Folder/Volumn
         bIsFileResult := @Everything32:Everything_IsFileResult(n-1)
         IF bIsFileResult = 1
            // get full path filename
            buf := SPACE( bufsize )
            @ Everything32:Everything_GetResultFullPathNameA( n-1, @buf, bufsize )

            cItem := ALLTRIM( STRTRAN(buf,CHR(0),"") )
            IF IsFileNotDir(cItem)
               // check for Attribute
               nAttribut := @ Everything32:Everything_GetResultAttributes(n-1)
               cAttribut := Num2Attribut(nAttribut)
               DO CASE
                  CASE "H" $ cAttribut
                  CASE "D" $ cAttribut
                  CASE "A" $ cAttribut
                     AADD( aResult, {cItem,LTRIM(STR(nAttribut)),cAttribut} )
               ENDCASE
            ENDIF
         ENDIF
      NEXT


Code: Select all

FUNCTION Num2Attribut(nMode)
LOCAL cRet  := ""
LOCAL nRest := 0
LOCAL i,iMax
LOCAL aType := {;
{EVERYTHING_FILE_ATTRIBUTE_READONLY           ,"READONLY           ","R" },;
{EVERYTHING_FILE_ATTRIBUTE_HIDDEN             ,"HIDDEN             ","H" },;
{EVERYTHING_FILE_ATTRIBUTE_SYSTEM             ,"SYSTEM             ","S" },;
{EVERYTHING_FILE_ATTRIBUTE_DIRECTORY          ,"DIRECTORY          ","D" },;
{EVERYTHING_FILE_ATTRIBUTE_ARCHIVE            ,"ARCHIVE            ","A" },;
{EVERYTHING_FILE_ATTRIBUTE_DEVICE             ,"DEVICE             ","V" },;
{EVERYTHING_FILE_ATTRIBUTE_NORMAL             ,"NORMAL             ","N" },;
{EVERYTHING_FILE_ATTRIBUTE_TEMPORARY          ,"TEMPORARY          ","T" },;
{EVERYTHING_FILE_ATTRIBUTE_SPARSE_FILE        ,"SPARSE_FILE        ","S" },;
{EVERYTHING_FILE_ATTRIBUTE_REPARSE_POINT      ,"REPARSE_POINT      ","P" },;
{EVERYTHING_FILE_ATTRIBUTE_COMPRESSED         ,"COMPRESSED         ","C" },;
{EVERYTHING_FILE_ATTRIBUTE_OFFLINE            ,"OFFLINE            ","O" },;
{EVERYTHING_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED,"NOT_CONTENT_INDEXED","I" },;
{EVERYTHING_FILE_ATTRIBUTE_ENCRYPTED          ,"ENCRYPTED          ","E" } }

   ASORT(aType,,,{|aX,aY| aX[1] > aY[1]})

   nRest := nMode

   DO WHILE .T.
      IF nRest > aType[1,1]
        nRest -= aType[1,1]
      ELSE
         EXIT
      ENDIF
   ENDDO

   iMax  := LEN(aType)
   FOR i := 1 TO iMax
      IF nRest > 0
      ELSE
         EXIT
      ENDIF
      IF aType[i,1] $ nRest
        cRet  += aType[i,3]
        nRest -= aType[i,1]
      ENDIF
   NEXT

RETURN cRet

FUNCTION IsDir(cDirName)     // NO wildcards !!!
   local aNames, lReturn
   if right(cDirName,1) = "\"
      cDirName := left(cDirName,len(cDirName)-1)
   endif
   aNames := directory(cDirName,"D")
   if empty(aNames)
      lReturn := .f.
   else
      lReturn := .t.
   endif
return lReturn

FUNCTION IsFileNotDir(cItem)
   local aNames, lReturn := .F.

   aNames := directory(cItem,"D")
   if empty(aNames)
      lReturn := .f.
   else
      IF EMPTY(aNames[1][F_SIZE] )
         lReturn := .f.
      ELSE
         lReturn := .t.
      endif
   endif
return lReturn
i use Array with full-path-filename with ShOperation API to copy it to USB-Stick / Drive

have fun

Re: Everything Search Tool

Posted: Tue Nov 26, 2019 7:28 am
by AUGE_OHR
hi,

i notice that i have used ANSI Version where function have "A" at End
this i was used under Xbase++ ... (v1.9x does not support UNICODE and v2.x just begin)

Code: Select all

     DllCall( nDLL, ,"Everything_SetSearchA",cText)
     DllCall( nDLL, ,"Everything_QueryA",.T.)
     DllCall( nDLL, ,"Everything_GetResultFullPathNameA",n, @buf, bufsize)
under harbour / HMG some Sample does not work without UNICODE
if you use UNICODE / IDE you must change these line to "W" at End

Code: Select all

     DllCall( nDLL, ,"Everything_SetSearchW",cText)
     DllCall( nDLL, ,"Everything_QueryW",.T.)
     DllCall( nDLL, ,"Everything_GetResultFullPathNameW",n, @buf, bufsize)
sorry that i not thought about UNICODE :roll:

have fun

Re: Everything Search Tool

Posted: Wed Nov 27, 2019 9:26 am
by dragancesu
Why not with HMG? Not perfect but work

Re: Everything Search Tool

Posted: Wed Nov 27, 2019 6:06 pm
by AUGE_OHR
hi,
dragancesu wrote: Wed Nov 27, 2019 9:26 am Why not with HMG? Not perfect but work
have you test Everything :?:

how long does it take to get all files on a 10 TB HDD :?:
how long does it take to "update" if you add or delete a Folder with files :?:

Everything is like Windows Search which have a own database.
it does NOT read in normal Way, it read the NTFS "Table"

please read at https://www.voidtools.com/ how it work.

Re: Everything Search Tool

Posted: Wed Nov 27, 2019 6:45 pm
by dragancesu
I know what is Everything, use every day from TC
This is little game (program) with HMG, it can everything

This is HMGforum, it's time to accept HMG