AutoHotkey Community

It is currently May 27th, 2012, 5:17 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: January 3rd, 2011, 8:56 pm 
Offline

Joined: December 31st, 2010, 5:58 am
Posts: 10
NTFS-Search I got from here http://sourceforge.net/projects/ntfs-se ... e/download


BareGrep Pro isn't fast at all. I just need something to search text inside files as this feature seems be missing in Windows 7.

grepWin is another that can search text inside files. The developer just released new version.

http://code.google.com/p/grepwin/
http://tools.tortoisesvn.net/


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2011, 10:44 pm 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
Pitbull wrote:
NTFS-Search I got from here http://sourceforge.net/projects/ntfs-se ... e/download


BareGrep Pro isn't fast at all. I just need something to search text inside files as this feature seems be missing in Windows 7.

grepWin is another that can search text inside files. The developer just released new version.

http://code.google.com/p/grepwin/
http://tools.tortoisesvn.net/


Gave Grepwin a spin, wasn't immediately clear how to search, for me, until I looked at the screenshot. Seems that you need to type an awful lot to get it working. Anyway, haven't found any commandline for it.

Locate32 has capabilities to search inside files, but it's nowhere near as fast as Everywhere.
http://www.locate32.net/


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2011, 11:16 pm 
Offline

Joined: December 31st, 2010, 5:58 am
Posts: 10
Locate32 uses Indexing which I rather not use. grepWin was recommended in some microsoft forums which is why I gave it a spin. It can do text search inside files without any problems. There are plenty of others you can find through googling but I don't think there are any more MFT searchers, I might be wrong.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2011, 12:29 am 
Offline

Joined: June 14th, 2009, 7:48 pm
Posts: 331
An other one to search inside files called:
SearchMyFiles

Maestr0 wrote:
BareGrepPro hadn't been mentioned in this thread yet. It only has a paid variant? Is it better than the free BareGrep version? Because in comparison to Everything, that's slo-o-oooow.... on the other hand, Everything can't search inside files, but I left that empty.


Searching inside files is way longer than just searching for files names.
That's why it's so long compared to Everything.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2011, 10:21 am 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
awannaknow wrote:
An other one to search inside files called:
SearchMyFiles

I'll give it a spin.

awannaknow wrote:
Maestr0 wrote:
BareGrepPro hadn't been mentioned in this thread yet. It only has a paid variant? Is it better than the free BareGrep version? Because in comparison to Everything, that's slo-o-oooow.... on the other hand, Everything can't search inside files, but I left that empty.


Searching inside files is way longer than just searching for files names.
That's why it's so long compared to Everything.

I understand, however, why not use just filenames searching when the field for searching inside the file names is empty?
Best would be in case of searching in files to first search for filenames (using Everything for instance) and then inside those files with something else. That's what I'm going for at the moment anyway.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2011, 12:25 pm 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
I'm thinking of using QGrep or FindStr to search inside the results I find with Everything.
I'll use se.exe to export the everything results and then use FindStr to search in there.

I'm a long time fan of SysInternals tools, figures they have something handy too:
http://technet.microsoft.com/en-us/sysi ... s/bb897439

Update:

oh man, this works like a charm! a direct copy from my convoluted script, enough to give you an idea, I hope:
Code:
   ifexist %result_filename%
   {
      if search_in_results = 1
      {
         if search_inside <>
         {
            ifnotexist findstr.exe
            {
               ifexist C:\WINDOWS\system32\findstr.exe
                  FileCopy C:\WINDOWS\system32\findstr.exe, findstr.exe
            }
            Runwait, %comspec% %debug% "findstr /M /I /F:"%result_filename%" "%search_inside%" > "%result_filename2%"" , %A_ScriptDir% , hide
            if logging > 2
               OutputDebug %app_name% %app_version% (%A_LineNumber%) GUI_fill_results: Runwait, %comspec% %debug% "findstr /M /I /F:"%result_filename%" "%search_inside%" > "%result_filename%"" , %A_ScriptDir% , hide
            FileDelete %result_filename%
            FileMove %result_filename2%, %result_filename%
         }
      }
   }


Last edited by Maestr0 on January 4th, 2011, 1:24 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2011, 1:17 pm 
Offline

Joined: November 17th, 2005, 10:14 pm
Posts: 196
Location: Leicester, UK
I've been using tFind for a while, here's my script:
Code:
;__________________________
; \____K - tFindGUI_____/

; Coded by MsgBox.                                          Last Edit:- 08/02/09

; This script is only for systems where the filesystem is NTFS. It is a front
; end for "TFind - NTFS Disk Searcher" -- http://deadnode.org/sw/tfind/
; which is a VERY VERY FAST command line NTFS MFT (Master File Table) search tool.
;
; To use, download tFind: http://cdn.deadnode.org/tfind32.zip
; and place tFind.exe in %SYSTEMROOT%\System32 folder or any directory in your PATH.

#SingleInstance Force
SetBatchLines -1

; This is needed for (my!) Windows Vista. The drawback is that all files and folders
; opened with K - tFindGUI will be run in Admin mode! -- Remove if not needed.
if not A_IsAdmin
{
   DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath
      , str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
   ExitApp
}

DriveGet allDrives, list, fixed           ; Get drive list
Loop Parse, allDrives                     ; Extract all NTFS drives
{
   l := A_LoopField
   DriveGet thisDrive, FS, %l%:
   If thisDrive = ntfs
   {
      If !firstDrive                      ; First drive found (usually C:)
         firstDrive := l
      ntfsDrives = %ntfsDrives%  %l%
      }
   }

progName = K - tFindGui
progNameSB = %progName% - Click status bar to copy files full path.
driveShow = Available NTFS drives: %ntfsDrives%

Gui Margin, 5, 5
Gui Add, GroupBox, w300 h70
Gui Add, Text, xs+10 ys23, Drive:
Gui Add, Text, x+63 , Find this:
Gui Add, CheckBox, x+10 vpartialMatch, &Partial match
Gui Add, Button, x+18 ys+15 h20 gsHelp, &Help

Gui Add, Button, x+50 yp-9 w232 h25 vss Disabled, %driveShow%
Gui Add, Text, yp+50 w130 vnof, Files found: 0
Gui Add, Text, x+10 w120 vst, Start time: 00:00:00


Gui Add, Edit, xs+10 ys+40 w70 vfDrive Uppercase, %firstDrive%
Gui Add, Edit, x+20 w150 vfQuery
Gui Add, Button, x+5 h20 gGetResults Default, &Find

Gui Add, Text, x+50 yp+2 w120 vtt, Total time:   0
Gui Add, Text, x+21 w120 vet, End time:  00:00:00

Gui Add, ListView, xm w700 r15 gopenFolder AltSubmit, Result|File|Ext|Size|Path
LV_ModifyCol(1, 0)
LV_ModifyCol(2, 200)
LV_ModifyCol(3, 45)
LV_ModifyCol(4, 60)
LV_ModifyCol(5, 370)
Gui Add, StatusBar, gcopyPath, %progNameSB%
Gui Show,, %progName%
GuiControl focus, edit2
Return

fillInfo:
GuiControl,, nof, Files found: %Cnt%
GuiControl,, st, Start time: %startTime%
GuiControl,, tt, Total time:   %totalSpeed% %sSeconds%
GuiControl,, et, End time:  %endTime%
Return

GetResults:
Gui Submit, NoHide
If !fQuery
{
   MsgBox,, %progName%, No query entered.
   Return
   }
If partialMatch
   fQuery = *%fQuery%*
If !fDrive
   cmdInput = "%fQuery%" %ntfsDrives%  ; Bugfix. If drive letter is omitted (search all),
Else                                   ; tFind produces "Unable to access volume '\\.'"
   cmdInput = "%fQuery%" %fDrive%      ; along with the results.
GuiControl,, ss, Searching.....
CMDin := "cmd /c tFind " . cmdInput
LV_Delete()

FormatTime startTime,,H:mm:ss
startSpeed := A_Now

CMDret_Stream(CMDin)
LV_ModifyCol(1 ,"Sort")
FormatTime endTime,,H:mm:ss
endSpeed := A_Now
totalSpeed := endSpeed-startSpeed
If totalSpeed < 2
   sSeconds = second
Else
   sSeconds = seconds
   
If yesRslt =
{
   Cnt = 0
   Gosub fillInfo
   noResult = No results for "%fQuery%"
   LV_Add("","" , noResult)
   GuiControl,, ss,  %driveShow%
   Return
   }
yesRslt =
GuiControl,, ss, %driveShow%
GoSub fillInfo
cnt=
Return

openFolder:
LV_GetText(fChoice,A_EventInfo)
If (A_GuiEvent = "DoubleClick") {
   Menu myMenu, Add, &Open Directory, doMenu
   Menu myMenu, Add, &Run File, doMenu
   Menu myMenu, Add
   Menu myMenu, Add, &Copy Full Path, doMenu
   Menu myMenu, Show
   Menu myMenu, DeleteAll ; Prevents separator lines appearing at bottom of menu.
   }
If (A_GuiEvent = "Normal" || A_GuiEvent = "I") {
   SB_SetText(fChoice)
   }
Return

doMenu:
If ( !ThisMenuItem )
   ThisMenuItem = %A_ThisMenuItem%
If (ThisMenuItem = "&Open Directory")
   Run explorer `/select`, %fChoice%
If (ThisMenuItem = "&Run File")
   Run %fChoice%
If (ThisMenuItem = "&Copy Full Path")
   SetTimer copyPath, on
ThisMenuItem =
Return

copyPath:
If (fChoice = "Result") {
   GuiControl,, ss, Nothing to copy!
   SB_SetText("Please make a selection first!")
   Sleep 3000
   GuiControl,, ss, %driveShow%
   SB_SetText(progNameSB)
   Return
   }
Clipboard = %fChoice%
GuiControl,, ss, Full path copied to the clipboard.
SB_SetText(fChoice " -- COPIED")
Sleep 3000
GuiControl,, ss, %driveShow%
SB_SetText(fChoice)
SetTimer copyPath, off
Return

sHelp:
MsgBox,, %progName% - Help, Drives:`nSeparate multi-drive search with a space, eg. C E`nClear drive edit box to search ALL NTFS drives.`n`nWild cards:`n? any single charactor, eg. tF??dG?i.exe`n* any charactors, eg. tFind*, *.ahk`nCan be used in combination, eg. *F?nd*`n`nPartial Match:`nChecking this box is the equivalent of using *query*`n`nPattern matching is NOT case-sensitive.`n`nDouble-clicking a found file brings up a menu offering the choice of running the file or locate and select it in Explorer.`n`nTo copy the files full path to the clipboard click the status bar.
Return

GuiEscape:
GuiClose:
ExitApp
Return

CMDret_Output(CMDout, CMDname="")
{
   global yesRslt, Cnt
   If (CMDout) {
      Cnt++
      SplitPath CMDout, fName, fPath, fExt
      FileGetSize fSize, %CMDout%, K
      LV_Add("", CMDout, fName, fExt, fSize, fPath)
      yesRslt = 1
      }
   
}

CMDret_Stream(CMDin, CMDname="", WorkingDir=0)
{
  Global cmdretPID
  tcWrk := WorkingDir=0 ? "Int" : "Str"
  idltm := A_TickCount + 20
  LivePos = 1
  VarSetCapacity(CMDout, 1, 32)
  VarSetCapacity(sui,68, 0)
  VarSetCapacity(pi, 16, 0)
  VarSetCapacity(pa, 12, 0)
  Loop, 4 {
    DllCall("RtlFillMemory", UInt,&pa+A_Index-1, UInt,1, UChar,12 >> 8*A_Index-8)
    DllCall("RtlFillMemory", UInt,&pa+8+A_Index-1, UInt,1, UChar,1 >> 8*A_Index-8)
  }
  IF (DllCall("CreatePipe", "UInt*",hRead, "UInt*",hWrite, "UInt",&pa, "Int",0) <> 0) {
    Loop, 4
      DllCall("RtlFillMemory", UInt,&sui+A_Index-1, UInt,1, UChar,68 >> 8*A_Index-8)
    DllCall("GetStartupInfo", "UInt", &sui)
    Loop, 4 {
      DllCall("RtlFillMemory", UInt,&sui+44+A_Index-1, UInt,1, UChar,257 >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&sui+60+A_Index-1, UInt,1, UChar,hWrite >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&sui+64+A_Index-1, UInt,1, UChar,hWrite >> 8*A_Index-8)
      DllCall("RtlFillMemory", UInt,&sui+48+A_Index-1, UInt,1, UChar,0 >> 8*A_Index-8)
    }
    IF (DllCall("CreateProcess", Int,0, Str,CMDin, Int,0, Int,0, Int,1, "UInt",0, Int,0, tcWrk, WorkingDir, UInt,&sui, UInt,&pi) <> 0) {
      Loop, 4
        cmdretPID += *(&pi+8+A_Index-1) << 8*A_Index-8
      Loop {
        idltm2 := A_TickCount - idltm
        If (idltm2 < 15) {
          DllCall("Sleep", Int, 15)
          Continue
        }
        IF (DllCall("PeekNamedPipe", "uint", hRead, "uint", 0, "uint", 0, "uint", 0, "uint*", bSize, "uint", 0 ) <> 0 ) {
          Process, Exist, %cmdretPID%
          IF (ErrorLevel OR bSize > 0) {
            IF (bSize > 0) {
              VarSetCapacity(lpBuffer, bSize+1, 0)
              IF (DllCall("ReadFile", "UInt",hRead, "Str", lpBuffer, "Int",bSize, "UInt*",bRead, "Int",0) > 0) {
                IF (bRead > 0) {
                  IF (StrLen(lpBuffer) < bRead) {
                    VarSetCapacity(CMcpy, bRead, 32)
                    bRead2 = %bRead%
                    Loop {
                      DllCall("RtlZeroMemory", "UInt", &CMcpy, Int, bRead)
                      NULLptr := StrLen(lpBuffer)
                      cpsize := bread - NULLptr
                      DllCall("RtlMoveMemory", "UInt", &CMcpy, "UInt", (&lpBuffer + NULLptr + 2), "Int", (cpsize - 1))
                      DllCall("RtlZeroMemory", "UInt", (&lpBuffer + NULLptr), Int, cpsize)
                      DllCall("RtlMoveMemory", "UInt", (&lpBuffer + NULLptr), "UInt", &CMcpy, "Int", cpsize)
                      bRead2 --
                      IF (StrLen(lpBuffer) > bRead2)
                        break
                    }
                  }
              VarSetCapacity(lpBuffer, -1)
                  CMDout .= lpBuffer
                  bRead = 0
                }
              }
            }
          }
          ELSE
            break
        }
        ELSE
          break
        idltm := A_TickCount
        LiveFound := RegExMatch(CMDout, "m)^(.*)", LiveOut, LivePos)
        Sleep 100 ; kj
        If (LiveFound)
          SetTimer, cmdretSTR, 5
      }
      cmdretPID=
      DllCall("CloseHandle", UInt, hWrite)
      DllCall("CloseHandle", UInt, hRead)
    }
  }
  ;msgbox "%cmdout%" ; kj
  StringTrimLeft, LiveRes, CMDout, %LivePos%
  If LiveRes <>
    Loop, Parse, LiveRes, `n
    {
      FileLine = %A_LoopField%
      StringTrimRight, FileLine, FileLine, 1
      CMDret_Output(FileLine, CMDname)
    }
  StringTrimLeft, CMDout, CMDout, 1
  cmdretPID = 0
  Return, CMDout
cmdretSTR:
SetTimer, cmdretSTR, Off
If (LivePosLast <> LiveFound) {
  FileLine = %LiveOut1%
  LivePos := LiveFound + StrLen(FileLine) + 1
  LivePosLast := LivePos
  CMDret_Output(FileLine, CMDname)
}
Return
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2011, 1:38 pm 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
MsgBox wrote:
I've been using tFind for a while, here's my script:


Thank you for your input!
I've tried tFind as well, as you can see in an earlier post of mine in this thread. "Everything" is faster than tFind. Try it and see.

I like your GUI, very nicely done.
Some suggestions:

1)
download and put tfind in the folder with the script
maybe with something like:
Code:
      ifnotexist %A_ScriptDir%\app\tfind64.exe
         URLDownloadToFile , http://cdn.deadnode.org/tfind64.zip , %A_ScriptDir%\app\tfind64.zip
      ifnotexist %A_ScriptDir%\app\tfind32.exe
         URLDownloadToFile , http://cdn.deadnode.org/tfind32.zip , %A_ScriptDir%\app\tfind32.zip

(you could then unzip the zips with another commandline util like 7zip or zip)


2)
look at the OS and decide whether to use 32- or 64bit version of tFind
You could use something like:
Code:
      if A_OSType contains 64
         find_app = %A_ScriptDir%\app\tfind64.exe
      else
         find_app = %A_ScriptDir%\app\tfind32.exe


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2011, 11:45 pm 
Offline

Joined: November 17th, 2005, 10:14 pm
Posts: 196
Location: Leicester, UK
I tried Everything and you're right it IS fast! 8)

The only problem I can see so far is that I can't paste a files path into another program, whereas with my gui I can :(


As for my script, it's an old project now and I probably won't update it. I just posted it as an example of a front end.

I might do something similar with Everything so as to cure my copy/paste file path problem. :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2011, 12:17 am 
Offline

Joined: November 17th, 2005, 10:14 pm
Posts: 196
Location: Leicester, UK
Quote:
The only problem I can see so far is that I can't paste a files path into another program, whereas with my gui I can Sad
Just found the right click menu entries. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2011, 2:11 pm 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
MsgBox wrote:
Quote:
The only problem I can see so far is that I can't paste a files path into another program, whereas with my gui I can Sad
Just found the right click menu entries. :)


If you read earlier in this thread, there is a commandline executable that can be used in conjunction with everything.
The output contains the paths.

I've managed to combine everything/es.exe with findstr.exe and it's wicked fast. The only problem I have is that for speed I need to limit the results to about a 1000 hits. If I keep under that, I get results in 99% under 1 second.

Edit: some working script to show what I've done:
Code:
app_name         = Everything FindStr
app_version         = 0.04
GUI_name         = %app_name% %app_version%
result_filename    = output_everything.txt
result_filename2   = output_findstr.txt
app_folder         = %A_ScriptDir%\app
find_app          = %app_folder%\es.exe
everything_app      = %app_folder%\everything.exe
max_results         = 10000

error_1155          = No application is associated with the specified file for this operation.
error_15          = The system cannot find the drive specified.
error_2          = The system cannot find the file specified.
error_21          = The device is not ready.
error_25          = Windows cannot find the network path.`nVerify that the network path is correct and the destination computer is not busy or turned off.`nIf Windows still cannot find the network path, contact your network administrator.
error_3          = The system cannot find the path specified.
error_4          = The system cannot open the file.
error_5          = Access is denied.

menu , Tray , icon, Shell32.dll, 147

check:
ifnotexist %find_app%
{
   msgbox , 4, %app_name% %app_version%, Essential file not found, click yes to download the necessary files (es.exe and everything.exe) to %app_folder%.
   ifmsgbox Yes
   {
      ifnotexist %app_folder%
         FileCreateDir %app_folder%
      ifnotexist %find_app%
         URLDownloadToFile , http://www.voidtools.com/es.exe , %find_app%
      ifnotexist %everything_app%
         URLDownloadToFile , http://www.voidtools.com/Everything-1.2.1.371.exe , %everything_app%
   }
   exitapp
}
#SingleInstance Force
SetBatchLines -1       ; maximum speed for loops

GUI:
   GUI +MinSize ToolWindow +LastFound

   ifwinexist , %GUI_name%
   {
      GUIControl , focus, command_search
      return
   }
   
   GUI font, norm cblack, Verdana

   GUI ADD, Picture, x4 y9 h16 w16 vtarget_icon Icon147 section, Shell32.dll
   GUI ADD, Edit, x25 ys-3 w390 vcommand_search gsearch section r1 default,
   GUI ADD, Button, ys-1 gcommand_run default hidden, OK
   GUI ADD, Text, x4 h16 w16 section, for
   GUI ADD, Edit, x25 ys-3 w390 vsearch_inside gsearch section r1 default, %parameter%
   
   GUI ADD, ListView, x5 r20 w410 vhitlist gfunction_lv_cmd -multi count%max_results% sort, Name|ext|Path
   LV_ModifyCol(1,200)     ; -- resizes column 1
   GUI Show , w420, %GUI_name%
return
GuiContextMenu:
   if last_check <>
   {
      if A_GUIControl = %last_check%
         Menu , Context, DeleteAll
   }
   if A_EventInfo > 0
   {
      last_check = %A_GUIControl%
      LV_GetText(command_name, A_EventInfo, 1)
      LV_GetText(command, A_EventInfo, 3)
      Menu , Context, Add, Open File %command_name%, command_run
      Menu , Context, Add, Copy path to clipboard, GUI_add_copypath
      Menu , Context, Add, Delete File %command_name%, GUI_delete
      Menu , Context, Add, Properties for %command_name%, GUI_add_properties
      Menu , Context, Add, Browse folder containing %command_name%, GUI_add_browse
      Menu, Context, Show, %A_GuiX%, %A_GuiY%
   }
   Menu, Context, DeleteALL   ; -- required to delete the sensitive options
return
GUI_add_copypath:
   clipboard := command_path
return
GUI_delete:
   ifexist command_path
   {
      msgbox , 4 , %app_name% , Are you sure you want to delete the following file?`n`n%command_path%
      IfMsgBox Yes
         FileDelete %command_path%
   }
   else
      msgbox ,  , %app_name% , File not found.`n`n%command_path%
return
GUI_add_properties:
   Run , properties "%command_path%", , UseErrorLevel
return
GUI_add_browse:
   Splitpath , command_path , , outdir
   ifexist %outdir%
      Run , explore %outdir%
return
search:
 SetTimer, execute_search, -250  ;Wait 250 milliseconds after typing stops.
return
execute_search:
   ; retrieve the variables from the GUI
   Gui, Submit, NoHide

   ; check if the everything process is running in the background
   Process , exist , everything.exe
   if errorlevel = 0
   {
      run , %everything_app%,, hide , everythingPID
      sleep 500
   }
   
   ; check if the temporary output file exists, if so, delete it
   ifexist %result_filename%
      FileDelete %result_filename%
   outputdebug %comspec% /c "%find_app%" "%command_search%" -n %max_results% > "%result_filename%"" , %A_ScriptDir% , hide
   Runwait, %comspec% /c ""%find_app%" "%command_search%" -n %max_results% > "%result_filename%"" , %A_ScriptDir% , hide
   
   ; check if the temporary (filtered) output file exists, if so, delete it
   ifexist %result_filename2%
      FileDelete %result_filename2%
   ; only do this if the user typed something into the edit box to search inside the hits for
   if search_inside <>
   {
      ifnotexist findstr.exe
      {
         ifexist C:\WINDOWS\system32\findstr.exe
            FileCopy C:\WINDOWS\system32\findstr.exe, %app_folder%\findstr.exe
      }
      Runwait, %comspec% /c ""%app_folder%\findstr.exe" /M /I /F:"%result_filename%" "%search_inside%" > "%result_filename2%"" , %A_ScriptDir% , hide
      outputdebug %comspec% /c ""%app_folder%\findstr.exe" /M /I /F:"%result_filename%" "%search_inside%" > "%result_filename2%"" , %A_ScriptDir% , hide
      FileDelete %result_filename%
      FileMove %result_filename2%, %result_filename%
   }
   
   ; now read the (filtered) outputfile to a variable
   ifexist %result_filename%
   {
      LV_Delete()   ; -- empty the list to ready it for the results
      FileRead , results, %result_filename%
      Sort , results , U
      StringReplace , results , results , `r`n, `n, ALL   ; needed for the listview
      
      GuiControl, -Redraw, Hitlist
      Loop , parse , results , `n
      {
         SplitPath, A_LoopField , OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]
         if OutExtension contains %A_Space%
         {
            StringGetPos , OutExtension_space, OutExtension, %A_Space%
            StringLeft , OutExtension , OutExtension , %OutExtension_space%
         }
         if outfilename <>
            LV_Add("", OutFileName, OutExtension, A_LoopField)
      }
      GuiControl, +Redraw, Hitlist
   }
   LV_ModifyCol(2)        ; -- resizes column 2
   LV_ModifyCol(3,"AutoHdr")     ; -- resizes column 3
   LV_Modify(1, "Select")   ; select the first row
   ; empty the variable to free up memory
   results :=
return
function_lv_cmd:
   if A_GuiEvent = DoubleClick
   {
      LV_GetText(command, A_EventInfo, 3)
      gosub command_run
   }
return
command_run:
   if A_EventInfo = 0
      selected_row = 1
   else
      selected_row := A_EventInfo
   LV_GetText(command, selected_row, 3)
   if command_path =
      Splitpath , command , , command_path
   run , %command% , %command_path% , UseErrorLevel
   GoSub function_errorlevel      ; -- needed so the msgbox contains the right feedback to the user pertaining the error
   command :=
   command_path :=
return
function_errorlevel:
   if A_LastError <> 0
   {
      if A_LastError = 2
         msgbox ,  , %app_name% , Error %A_LastError%: %error_2%
      if A_LastError = 3
         msgbox ,  , %app_name% , Error %A_LastError%: %error_3%
      if A_LastError = 4
         msgbox ,  , %app_name% , Error %A_LastError%: %error_4%
      if A_LastError = 5
         msgbox ,  , %app_name% , Error %A_LastError%: %error_5%
      if A_LastError = 15
         msgbox ,  , %app_name% , Error %A_LastError%: %error_15%
      if A_LastError = 21
         msgbox ,  , %app_name% , Error %A_LastError%: %error_21%
      if A_LastError = 25
         msgbox ,  , %app_name% , Error %A_LastError%: %error_25%
      if A_LastError = 1155
         msgbox ,  , %app_name% , Error %A_LastError%: %error_1155%
   }
return
onexit:
   if everythingPID <>
      WinKill ahk_pid %everythingPID%
   exitapp


In the following thread I got some help with some problems I had with the code above: http://www.autohotkey.com/forum/viewtop ... 085#412085

Update:
version 0.04:
- Thanh004's suggestion added
- made the app folder into a var so changing it is easier
- pressing enter after typing will run/open the top line
- changed the icon so the script will be easier to find in the systray
- changed the columns in the listview (now name, ext, path)


Last edited by Maestr0 on January 8th, 2011, 10:43 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 7th, 2011, 10:07 pm 
the messagbox does not have a yes/no ! :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 7th, 2011, 10:15 pm 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
Anonymous wrote:
the messagbox does not have a yes/no ! :)


lol, forgot a 4 in there somewhere, thanks! ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2011, 10:06 am 
Offline

Joined: February 7th, 2008, 9:48 pm
Posts: 509
If the app subdir does not exist it will not save the downloaded files(on my system).So i added a check for the dir.I also added "else" to prevent exitapp after a successful download.

It has been already very useful ! :)


Code:
check:
ifnotexist %find_app%
{
   msgbox , 4 , %app_name% %app_version%, Essential file not found, click yes to download the necessary files (es.exe and everything.exe) to %A_ScriptDir%\app.
   ifmsgbox Yes
   {
IfNotExist %A_ScriptDir%\app
filecreatedir %A_ScriptDir%\app

ifnotexist %find_app%
URLDownloadToFile , http://www.voidtools.com/es.exe , %find_app%
if errorlevel
MsgBox, error downloading es.exe

ifnotexist %everything_app%
URLDownloadToFile , http://www.voidtools.com/Everything-1.2.1.371.exe , %everything_app%
if errorlevel
MsgBox, error downloading everything.exe
   }
   else
   exitapp
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2011, 2:26 pm 
Offline

Joined: November 17th, 2005, 10:14 pm
Posts: 196
Location: Leicester, UK
Hi Maestr0,
I've been having a play around with your script and came up with this: http://www.autohotkey.com/forum/viewtopic.php?t=67512 :)

I've also been looking for an alternative to findstr and found "agrep":
http://www.tgries.de/agrep/
http://www.tgries.de/agrep/#DOWNLOAD
http://www.tgries.de/agrep/337/agrepw32.zip
http://www.tgries.de/agrep/agrephlp.html

Quote:
AGREP 3.37 for WIN32 compiled with Borland C (Sep 14 1998)

Approximate Pattern Matching GREP -- Get Regular Expression
Usage:
AGREP [-#cdehi[a|#]klnprstvwxyABDGIRS] [-f patternfile] [-H dir] pattern [files]

-# find matches with at most # errors -A always output filenames
-c output the number of matched records -B find best match to the pattern
-d define record delimiter -Dk deletion cost is k
-e for use when pattern begins with - -G output the files with a match
-f name of file containing patterns -Ik insertion cost is k
-h do not display file names -Sk substitution cost is k
-i case-insensitive search; ISO <> ASCII -ia ISO chars mapped to lower ASCII
-i# digits-match-digits, letters-letters -i0 case-sensitive search
-k treat pattern literally - no meta-characters
-l output the names of files that contain a match
-n output record prefixed by line number
-p supersequence search -CP 850|437 set codepage
-r recurse subdirectories (UNIX style) -s silent
-t for use when delimiter is at the end of records
-v output those records without matches -V[012345V] version / verbose more
-w pattern has to match as a word: "win" will not match "wind"
-x pattern must match a whole line
-y suppresses the prompt when used with -B option
@listfile use the filenames in listfile <1>23456Q
AGREP [-#cdehi[a|#]klnprstvwxyABDGIRS] [-f patternfile] [-H dir] pattern [files]

The pattern MUST BE ENCLOSED in "DOUBLE QUOTES" if it contains one of the
following METASYMBOLS. Good practice is always to include it in double quotes.

METASYMBOLS:
\z turns off any special meaning of character z (\# matches #)
^ begin-of-line symbol
$ end-of-line symbol
. matches any single character (except newline)
# matches any number > 0 of arbitrary characters
(a)* matches zero or more instances of preceding token a (Kleene closure)
a(a)* matches one or more instances of preceding token a
(Use this as replacement for (a)+ which is not implemented yet.)

[b-dq-tz] matches characters b c d q r s t z
[^b-diq-tz] matches all characters EXCEPT b c d i q r s t z
ab|cd matches "ab" OR "cd"
<abcd> matches exactly, no errors allowed in string "abcd"
(overrides the -1 option)

cat,dog matches records having "cat" OR "dog"
cat;dog matches records having "cat" AND "dog"
(operators ; and , must not appear together in a pattern)
1<2>3456Q
AGREP [-#cdehi[a|#]klnprstvwxyABDGIRS] [-f patternfile] [-H dir] pattern [files]
agrep "colo#r" foo
show lines in file foo having strings "color" or "colour" or
"colonizer" or "coloniser" etc.
agrep -2 -ci miscellaneous foo
count lines in file foo having string "miscellaneous", within 2 errors,
case insensitive
agrep "^From#\.edu$" foo
show lines in file foo having string "From" at the beginning of a line
and string ".edu" at the end of the line
agrep "abc[0-9](de|fg)*[x-z]" foo
show lines in file foo having string beginning "abc", followed by
one digit, then zero or more repetitions of "de" or "fg", and
finally x, y or z.
agrep -d "^From " "search;retriev" mbox
show messages in file mbox having string "search" and string "retriev"
(Messages are delimited by the string "From " at the beginning of a line)
agrep -1 -d "$$" "<bug> <report>" foo
show lines in file foo having string "bug report", or string "bug" at
end of a line and the string "report" at the beginning of the next line
agrep -p "EPO" foo
find records in file foo that contain a supersequence of the pattern:
"EPO" will match "European Patent Office"
agrep -i# "11zz11" foo
matches "74LS04" because of the digit-digit-letter(..) pattern 12<3>456Q
AGREP [-#cdehi[a|#]klnprstvwxyABDGIRS] [-f patternfile] [-H dir] pattern [files]

And, how to search for double quotes " ?

To search for string" in all files *.c and to pipe the result
into a file x.x, use the following command:

>x.x AGREP "string\\\"" *.c

Comment: The sequence \\\" appears in AGREP as \" (search for ").

The current default options as defined in the environment variable AGREPOPTS:

(no default options)

You could use "SET AGREPOPTS=<your options>" to change the default options.
The actual options in the command line take precedence.

The current codepage is CP 850.

The codepage setting affects the uppercase-lowercase translation table
built-in AGREP when you use one of the options -i, -ia or -i# .
The translation table can be printed by using verbose option -V5.

The default verbose option is 1 123<4>56Q
AGREP [-#cdehi[a|#]klnprstvwxyABDGIRS] [-f patternfile] [-H dir] pattern [files]
AGREP (C) COPYRIGHT

Glimpse was developed by Udi Manber and Burra Gopal of the University of
Arizona, and Sun Wu of the National Chung-Cheng University, Taiwan.
Permission is granted to copy this software, to redistribute it
on a nonprofit basis, and to use it for any purpose, subject to
the following restrictions and understandings.

1. Any copy made of this software must include this copyright notice in full.

2. All materials developed as a consequence of the use of this
software shall duly acknowledge such use, in accordance with the usual
standards of acknowledging credit in academic research.

3. The authors have made no warranty or representation that the
operation of this software will be error-free or suitable for any
application, and they are under under no obligation to provide any
services, by way of maintenance, update, or otherwise. The software
is an experimental prototype offered on an as-is basis.

4. Redistribution for profit requires the express, written permission
of the authors. Non-exclusive licenses can be obtained for a small fee.
Contact the authors at glimpse@cs.arizona.edu.

1234<5>6Q
AGREP [-#cdehi[a|#]klnprstvwxyABDGIRS] [-f patternfile] [-H dir] pattern [files]

AGREP is a powerful tool for searching a file or many files for a string or
regular expression, with approximate matching capabilities and user-definable
records. AGREP was developed 1989-1991 by Sun Wu and Udi Manber and many others
(please read CONTRIB.TXT and MANUAL.DOC).

AGREP is the search engine and part of the GLIMPSE tool for searching and
indexing whole file systems. GLIMPSE stands for GLobal IMPlicit SEarch and is
part of the HARVEST Information Discovery and Access System.

CONTACT ADDRESSES IN GENERAL as of Sep 14 1998:
===============================================
The author Prof. Udi Manber, Univ. of Arizona glimpse@cs.arizona.edu
To be put on GLIMPSE mailing list, send mail to glimpse-request@cs.arizona.edu
The home page for AGREP and GLIMPSE in general http://glimpse.cs.arizona.edu
The home page for HARVEST http://harvest.transarc.com

CONTACT ADDRESSES FOR THIS PORT OF AGREP:
=========================================
Bug reports to gries@ibm.net
Home page AGREP http://www.geocities.com/SiliconValley/ ... agrep.html

Thank you for using AGREP.
12345<6>Q


I can't get @filelist to work though. :(


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group