AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

nDroid (formerly 320MPH) Ultra Fast Anything-Launcher
Goto page Previous  1, 2, 3 ... , 17, 18, 19  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
HugoV



Joined: 27 May 2007
Posts: 499

PostPosted: Mon Mar 31, 2008 11:26 am    Post subject: Reply with quote

@John_S:
John_S wrote:
My question is, I want the script to scan only ONE fixed drive ( i.e G:\ ) , I'm relatively new to AHK so be gentle Wink


Look up the ReadTree routine around line 758 and change
Code:
;   WhichDrivesToScan=%RParam%
to
Code:
WhichDrivesToScan=G


Note the ; character is removed (means comment) and by setting WhichDrivesToScan to G you bypass any other drives you might enter via
the GUI. I should probably post my updated version at some point Wink
But I'll wait for the nDroid source code as it has a much faster search routine.

If you find that changing the path is sometimes unreliable, just let me know.
I found a more robust method which never fails.
Back to top
View user's profile Send private message
@John_S
Guest





PostPosted: Mon Mar 31, 2008 11:48 am    Post subject: Reply with quote

@ HugoV
Legend!
Thank you very much for the prompt response Smile
A new version? I'm a taker mate! I'll be following this thread for any news then Wink
Back to top
@John_S
Guest





PostPosted: Mon Mar 31, 2008 12:08 pm    Post subject: Reply with quote

@ HugoV
I'm experiencing a rather annoying issue, let's say I'm entering the search term "The Beatles" which should result in about 4 folders:

The Beatles - Album 1
The Beatles - Album 2
The Beatles - Album 3
The Beatles - Album 4

The cursor freezes on the first, second or fourth item so the program doesn't react anymore when using Up Arrow, Down Arrow, Enter.
Could you please shed some light on this.
Back to top
HugoV



Joined: 27 May 2007
Posts: 499

PostPosted: Mon Mar 31, 2008 12:23 pm    Post subject: Reply with quote

Perhaps you press TAB accidentally? In that case the UP/DOWN will not work.
You can comment these lines in the script for the GUI as you don't
need them anymore:
Code:
Gui, Add, Text, x205 y10 w40 h20, Drives:
Gui, Add, Edit, x245 y7 w100 h20 vRParam, %RParam%
...
Gui, Add, Button, 0x8000 x360 y7 w70 h20, &Scan [F2]
If you happen to press TAB now you will jump to the first result (and then you can't use
UP/DOWN either)
Back to top
View user's profile Send private message
@John_S
Guest





PostPosted: Mon Mar 31, 2008 1:33 pm    Post subject: Reply with quote

@ HugoV
Nothing to do with the TAB key, I just had to update treeinfo.wc on G:\
Things are running flawlessly now, thanks Smile
Back to top
fures



Joined: 31 Jan 2008
Posts: 29

PostPosted: Sun Apr 20, 2008 3:09 pm    Post subject: Reply with quote

I worked on Rajat's code (320MPH) a little bit and made my version:


Small view - big icons
Big view - list style

Much faster by removing ControlGetText from each loop in GetText

Results now ordered by mod date (my taste) - a bit longer indexing

Exclude string by starting with minus (-string) like in google
-dir searches only shortcut to directories

Searching in filename or also in path - selectable

Integrated picture preview for AHK-readable picture files

Context menu, Tray menu

Setup GUI

Background indexing based on computer idle time, and paused scanning when using the computer

Integrated Firefox indexing - based also on Rajat's plugin code

... and stuff like this.



It was fun to do it, hope you like...

Code:

;#NoTrayIcon
#SingleInstance FORCE
AutoTrim, Off
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
 OnMessage( 6, "WM_ACTIVATE" )
MainWnd = my320MPHX
SetKeyDelay, 0
id320 = -1
;; ID of 320 MPH Screen
;___________________________________________
Process, Priority,, High
Menu, Tray, Icon, Shell32.dll, 23 ;23 57 172 210
Menu, Tray, Tip, %MainWnd%

Start320:
   IniFile = %A_ScriptDir%\320MPHX.ini
   IniGui_IniFile:=IniFile
   GoSub, ReadIni
   IfNotExist, %IniFile%
      GoSub, WriteIni

   ;AlwaysScan := ExpandVars(AlwaysScanI)
   PathListX := ExpandVars(PathList)
   OpenFolderWithX := ExpandVars(OpenFolderWith)

   StringRight, ExtChk, A_ScriptFullPath, 4
   IfEqual, ExtChk, .exe
      If ShellIntegration
      {
         RegWrite, REG_SZ, HKCR, *\Shell\320MPH\Command,, "%A_ScriptFullPath%" "`%1"
         RegWrite, REG_SZ, HKCR, Folder\shell\320MPH\command,, "%A_ScriptFullPath%" "`%1"
      }
      Else
      {
         RegDelete, HKCR, *\Shell\320MPH,
         RegDelete, HKCR, Folder\Shell\320MPH,
      }

   RParam = %1%

   ;create scanned result list on first run
   IfNotExist, %A_ScriptDir%\%ListFile%
      GoSub, ButtonScan

   ;Check scan date and create menus
   GoSub, CheckScanDate_and_CreateMenus


   ;;JWJ - Avoids drawing GUI again
   if id320 <> -1 ;not the 1st run
      Return

   ;///////////////////////////////////////////////////////////////////////////////////

   ;Read scan file in ItemList
   GoSub, ReadScanFile


   ;Make Gui
   GuiX := ;X0 !!!
   GuiY := ;Y26 !!!
   LVGuiW := 263 ;GuiW - 12
   GuiMargin := 15
   GuiH := 555

   GuiW := LVGuiW + (GuiMargin * 2) ;275 volt, 10 115 - 232 645
   LVGuiH := GuiH - GuiMargin - 48 - 20 - 20 ;64
   StatusY := GuiH -3 - 20 ;25
   Status2Y := GuiH -3 - 20 - 20 ;25
   FEditX := GuiW - GuiMargin - 150
   FEditTY := GuiMargin + 5
   IconSize := 1

   Gui, -Caption +Border +lastfound
   mgH := WinExist()
   Gui, Color, %GuiColor%

   gui, font, s10, %GuiFont%
   Gui, Add, Text, % "x" GuiMargin "y" FEditTY-10, Search:
   Gui, Add, Edit, % "x+15 y" GuiMargin-10 " w200 vCurrText gGetText",
   gui, font, s9, %GuiFont%
   Gui, Add, ListView, Tile x%GuiMargin% y+25 w%LVGuiW% h%LVGuiH% vSelItem gSelection AltSubmit BackgroundBlack CWhite, Name|Ext|Folder
   Gui, Font
   Gui, Add, Button,x0 y0 w0 h0
;   Gui, Add, Text, % "x" GuiMargin+65 " y" GuiMargin+20 " w140 h20 vResults",
   Gui, Add, Text, % "x" GuiMargin+0 " y" GuiMargin+10 " w60 h28 vResults",
   Gui, Add, CheckBox, x%FEditX% y%StatusY% vFindInPath Right w150, &Find in Path
   Gui, Add, CheckBox, x%FEditX% y%Status2Y% vShowTTip Right w150, Show &Tooltip
   Gui, Add, Picture, % "X" GuiW " Y" GuiMargin+40 " W200 H500", %Pth%
   Gui, Add, Text, x%GuiMargin% y%Status2Y%, Max item&s:
   Gui, Add, Edit, x+2 y%Status2Y% w35 h16 vMaxIt gGetText, %MaxItems%
   Gui, Add, Button, % "x" GuiMargin " y" StatusY-2 " h21 gChangeView", Change &View
   Gui, Add, Text,, ;placeholder for the picture preview data-text
   Gui, Add, Button, % "x" GuiMargin+61 " y" GuiMargin-10+28 " w50 h21 gButtonOpen Default", &Open
   Gui, Add, Button, % "x+5" " y" " h21 gButtonDir", &Dir Open
   Gui, Add, Button, % "x+5" " y" " h21 gButtonDirTg", Target-Dir Open
   Gui, Add, Button, % "x+15" " y" " h21 gGoogle", &Google Search
   Gui, Add, Button, % "x+5" " y" " h21 gWikipedia", &Wikipedia

   Gui, Add, Text, % "x" GuiW " y" GuiMargin-10+3+5 " h20", Run-Params:
   Gui, Add, Edit, x+5 yp-3 w100 h20 vRParam, %RParam%
;pwb := IE_Add(mgH, GuiW, GuiMargin+40, 200, 200)


   LV_ModifyCol (1, 210) ;100

   Gui, Show, h%GuiH% w%GuiW% %GuiX% %GuiY%, %MainWnd%
   WinGetPos, GuiX, GuiY,,,%MainWnd%

   WinGet, id320, ID, A
   If FindInPath
     Control,Check,,Button2,%MainWnd%
   If ShowTTip
     Control,Check,,Button3,%MainWnd%
   ControlFocus, Edit1, %MainWnd%

; Gui, 2:+lastfound
; mgHIE := WinExist()
; pwb := IE_Add(mgHIE, 0, 0, 400, 300)
; Gui, 2:Show, NoActivate Hide x10 y50 w400 h300, Preview IE


   LastText = fadsfSDFDFasdFdfsadfsadFDSFDf

   If ShowBigView
      GoSub, ChangeView

   Gosub, GetText
   Control, Choose, 1, SysListView321, %MainWnd%

   GoSub, DoScan


Return
;______END of AUTOEXECUTE section______________________


ReadIni:
   ;SplashImage design attribs:
   Spl_Design = y30 x800 w150 M C11 ZH0 ZW0 ZX5 ZY5 B1 CT236782 CWffffcc FM7 FS7 WM600 WS400

   GoSub, IniGui_Load
Return

WriteIni:
   ;Creating ini File - if not any
   FileAppend,
(
[Scanning]
PathList=%A_MyDocuments%|%A_StartMenuCommon%|%A_StartMenu%|%A_Desktop%|%UserProfile%\Favorites
;List of paths to scan
;Default=%A_MyDocuments%|%A_StartMenuCommon%|%A_StartMenu%|%A_Desktop%|%UserProfile%\Favorites
TypeList=|exe|lnk|ahk|doc|xls|ppt|pdf|dot|xlt|pot|jpg|jpeg|tif|ico|wmf|emf|exif|ani|cur|mpg|mpeg|avi|mov|wmv|asf|url|txt|ini|log|gif|png
;List of extensions to scan for
;Use *** for any extension (time consuming scan!)
ExcludeList=about|history|readme|remove|unins|license
;Strings to exclude from scanning
IncludeList=mustreadme|readmeanyway|zsoft
;Strings to still include, even if in exclude list
;Example: All "uninst" are excluded, but ZSoft Uninstaller is still in
ScanPause=5
;A running scan will pause for this many seconds when you use your computer
ListFile=RunList.lst
;Name of the main index file

[Display]
ShowIcons=1
;Show icons in the list
;Type=boolean
FindInPath=0
;To search also in the path of files
;Otherwise, it only searches the file name
;Type=boolean
;Default=0
ShowTTip=0
;To show tooltip with detailed file info under the main window
;Type=boolean
ShowBigView=0
;Type=boolean
;To use the extended view of the main window
GuiFont=Trebuchet MS Bold
;Font to be used in the main window in case of small view
GuiColor=E3E3E3
;Background color of the main window
MaxItems=25
;Maximum number of search items to find

[Advanced]
OpenFolderWith=Explorer
;What program do you want to use to open folders of searched items
MaxLastUsed=25
;Maximum number of opened items to store in order to show when no search text is entered
WaitTime=200
;Milliseconds to wait for key strokes before search starts when you enter search text
MinLen=2
;Minimum characters before search starts
ShellIntegration=0
;Works only if compiled to exe!
;Shell Integration adds this script to all files' context menu, so that you can launch a file with any application selected in the script.
UsedList=|
;DON'T EDIT THIS UNLESS YOU KNOW WHAT YOU ARE DOING
;This contains the last opened items
),%IniFile%
Return


DoScan:
   ScanCheckTimerInt := 1 * (60*1000) ;mins

   SinceLast := A_TickCount-LastScanTick
   LastScanTick := A_TickCount
   SetTimer, DoScan, %ScanCheckTimerInt%


   GoSub, CheckScanDate_and_CreateMenus
   If (FDDiff > -2) ;less than X hours old listfile
   {
      ;MsgBox,Return at FDDiff
      Return
   }

   If (SinceLast-ScanCheckTimerInt > 10000) ;more than X msec late - coming from hibernate
   {
      ;MsgBox,Return at Late
      Return
   }

   If (A_TimeIdle < (20*1000)) ;Idle for X sec
   {
      ;MsgBox,Return at Idle
      Return
   }

   CntDn = 10
   Loop, %CntDn%
   {
      SplashImage,, %Spl_Design%,% "Scanning starts in " CntDn+1-A_Index " sec...",Computer idle
      If (A_TimeIdle < (20*1000))
      {
         GoSub, RemoveTrT
         Return
      }
      Sleep, 990
      ;GoSub, RemoveTrT
   }
   SetTimer, DoScan, Off
   Gosub, ButtonScan
   LastScanTick := A_TickCount
   SetTimer, DoScan, %ScanCheckTimerInt% ;mins
Return

ReadScanFile:
   IndexFile = %A_ScriptDir%\%ListFile%
   ItemList =
   FileGetSize, LFSize, %IndexFile%
   VarSetCapacity(ItemList,LFSize)

   ln =
   Loop, Read, %IndexFile%
   {
      IfEqual, A_LoopReadLine,
         Continue
      ln ++
      ItemList = %ItemList%|%A_LoopReadLine%
   }

   ;FireFox in nDroid index file
   StringReplace,ItemList,ItemList,<ToRun=,,All
   StringReplace,ItemList,ItemList,<Name=,#,All ; = marad
   StringReplace,ItemList,ItemList,>,,All

   ; ln =
   ; Loop, Parse, ItemList, |
      ; ln ++
   SplashImage,, %Spl_Design%, % round(LFSize/1024) . " K = " . ln . " lines",Item list loaded
   SetTimer, RemoveTrT, 3000
Return

RemoveTrT:
   SetTimer, RemoveTrT, Off
   ;TrayTip
   SplashImage, OFF
return

RemoveTT:
   SetTimer, RemoveTT, Off
   ToolTip
return

MenuFold:
   Run, %A_ScriptDir%
Return

MenuEdit:
   Run, edit %A_ScriptFullPath%
Return

MenuSetup:
   GoSub, Hide320
   GoSub, IniGui_Setup
   ;Reload
Return

MenuIni:
   RunWait, %IniFile%
   Reload
   Sleep, 1300
Return

MenuRel:
   Reload
   Sleep, 300
Return

MenuEx:
   ExitApp
return

CheckScanDate_and_CreateMenus:
  FileGetTime, FDDiff, %A_ScriptDir%\%ListFile%, M  ; Retrieves the modification time by default.
  EnvSub, FDDiff, %A_Now%, minutes
  FDDiff := round(FDDiff/60,2) ;in hours
  SetTimer, CheckScanDate_and_CreateMenus, % 3 * (60*1000) ;mins

If MenuMade
{
   Menu, MyContextMenu, DeleteAll
   Menu, Tray, DeleteAll
}
MenuMade = 1

FDDiff_abs := abs(FDDiff)
FDDiff_min := round( (FDDiff_abs - floor(FDDiff_abs)) / 100*60*100, 0)
If (FDDiff_min < 10)
   FDDiff_min := "0" . FDDiff_min
FDDiff_time := floor(FDDiff_abs) ":" FDDiff_min

   Menu, MyContextMenu, Add, Open, ButtonOpen
   Menu, MyContextMenu, Add, Open containing folder, ButtonDir
   Menu, MyContextMenu, Add, Show file info, MenuWin
   Menu, MyContextMenu, Add, Delete from list, MenuDel
   Menu, MyContextMenu, Add
   Menu, MyContextMenu, Add, % "Scan folders (last scan " . FDDiff_time . " ago)", ButtonScan
   Menu, MyContextMenu, Add, Scan-statistics, ScanStat
   Menu, MyContextMenu, Add
   Menu, MyContextMenu, Add, Change View, ChangeView
   Menu, MyContextMenu, Add
   Menu, MyContextMenu, Add, Setup options, MenuSetup
   Menu, MyContextMenu, Add, Edit settings (ini file), MenuIni
   Menu, MyContextMenu, Add, Save current settings (into ini file), WriteIni
   Menu, MyContextMenu, Add, Open script folder, MenuFold
   Menu, MyContextMenu, Add, Edit this script, MenuEdit
   Menu, MyContextMenu, Add
   Menu, MyContextMenu, Add, Reload this script, MenuRel
   Menu, MyContextMenu, Add, Exit, MenuEx
   ;Menu, MyContextMenu, Default, Reload this script

Menu, Tray, NoStandard
   Menu, Tray, Add, Open Search Window, Show320
   Menu, Tray, Add
   Menu, Tray, Add, % "Scan folders (last scan " . FDDiff_time . " ago)", ButtonScan
   Menu, Tray, Add, Scan-statistics, ScanStat
   Menu, Tray, Add
   Menu, Tray, Add, Change View, ChangeView
   Menu, Tray, Add
   Menu, Tray, Add, Setup options, MenuSetup
   Menu, Tray, Add, Edit settings (ini file), MenuIni
   Menu, Tray, Add, Save current settings (into ini file), WriteIni
   Menu, Tray, Add, Open script folder, MenuFold
   Menu, Tray, Add, Edit this script, MenuEdit
   Menu, Tray, Add
   Menu, Tray, Add, Reload this script, MenuRel
   Menu, Tray, Add, Exit, MenuEx
   Menu, Tray, Default, Open Search Window

Return

ScanStat:
      mExtList =
      Loop, Parse, ItemList, |
      {
         CurrItem = %A_LoopField%
       IfInString,CurrItem,://
         FExt := "FF url"
       else
         SplitPath, CurrItem, FName, FDir, FExt, FNameNoExt, FDrive
         mExtList = %mExtList%|%FExt%
      }
      Sort, mExtList, D|

      mExt =
      mCn =
      aCn = 1
      mSg =
      Loop, Parse, mExtList, |
      {
        IfEqual, mExt, %A_LoopField%
        {
          mCn ++
        }
        else
        {
          mSg = %mSg%%mExt%`t%mCn%`n
          mExt = %A_LoopField%
          mCn = 1
        }
        aCn ++
      }
      MsgBox, %mSg%`n`nAll`t%aCn%
      mExtList =
Return

GetText:
   ControlGet, FindInPath, Checked,, Button2, %MainWnd% ;A FindInPath checkbox állapota
   ControlGetText, MaxItems, Edit2, %MainWnd%
   ControlGetText, CurrText, Edit1, %MainWnd%
   IfEqual, CurrText, %LastText%, Return
   StringLen, Check, CurrText

   IfGreater, Check, 0
      IfLess, Check, %MinLen%
         Return

   LastText = %CurrText%
   StartTime := A_TickCount
   moreth =

   ;from last used_____________________________
   IfEqual, CurrText,
   {
      If ShowIcons
      {
         IL_Destroy(ImageListID1)

         ; Create an ImageList so that the ListView can display some icons:
         ImageListID1 := IL_Create(10, 10, IconSize)
         ; Attach the ImageLists to the ListView so that it can later display the icons:
         LV_SetImageList(ImageListID1)
      }

      LV_Delete()

      Count =

      StringTrimLeft, UsedList0, UsedList, 1
      Loop, Parse, UsedList0, |
      {
         ;check for change in search query
         ControlGetText, CurrText, Edit1, %MainWnd%
         IfNotEqual, CurrText, %LastText%, Goto, GetText

         ;Firefox cucc feldolg
         CurrItem1 =
         CurrItem2 =
         StringSplit,CurrItem,A_LoopField,#
         If CurrItem2
         {
            FName = %CurrItem2%
            FDir = %CurrItem1%
            FNameNoExt = %CurrItem2%
            FExt =
         }
         else
         ;firefox feldolg vége
         SplitPath, A_LoopField, FName, FDir, FExt, FNameNoExt
         Count ++
         IfGreater, Count, %MaxLastUsed%, Break

         If ShowIcons
         {
            IfInString,FDir,://
            {
               IL_Add(ImageListID1,A_ProgramFiles "\Mozilla Firefox\firefox.exe",2)
            }
            else IfEqual,FExt,url
            {
               IL_Add(ImageListID1,A_ProgramFiles "\Internet Explorer\iexplore.exe",2)
            }
            else
            {
               hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, A_LoopField, UShortP, iIndex)
               DllCall("ImageList_ReplaceIcon", UInt, ImageListID1, Int, -1, UInt, hIcon)
               DllCall("DestroyIcon", Uint, hIcon)
            }
         }
         LV_Add("Icon" Count, FNameNoExt, FExt, FDir )

      }
   }


   ;from all items_____________________________
   IfNotEqual, CurrText,
   {
      If ShowIcons
      {
         IL_Destroy(ImageListID1)

         ; Create an ImageList so that the ListView can display some icons:
         ImageListID1 := IL_Create(10, 10, IconSize)
         ; Attach the ImageLists to the ListView so that it can later display the icons:
         LV_SetImageList(ImageListID1)
      }

      LV_Delete()


      ;___________________________________________
      ; Advanced Search
      MatchPList1 =
      MatchPList2 =
      MatchPList3 =
      Count = 0
      Count2 = 0
      ln = 0



      GuiControl,, Results, Searching...


      Loop, Parse, ItemList, |
      {
         IfGreater, Count2, %MaxItems%, Break
         ;check for change in search query
         If (A_TickCount - StartTime > 1000)
         {
            ControlGetText, CurrText, Edit1, %MainWnd%
         }
         IfNotEqual, CurrText, %LastText%, Goto, GetText

         CurrItem = %A_LoopField%

         ;Firefox cucc feldolg
         CurrItem1 =
         CurrItem2 =
         StringSplit,CurrItem,A_LoopField,#
         If CurrItem2
         {
            FName = %CurrItem2%
            FDir = %CurrItem1%
            FNameNoExt = %CurrItem2%
            FExt =
         }
         else
         ;firefox feldolg vége

         SplitPath, CurrItem, FName, FDir, FExt, FNameNoExt, FDrive
         StringLower,FExt,FExt


         ;search everywhere or file name only
         ;fuzzy search

         If FindInPath
            Wht := CurrItem
         else
            Wht := FName

         MatchFound = Y

         Loop, Parse, CurrText, %A_Space%
         {

            StringLeft,opst,A_LoopField,1
            IfEqual,opst,-
            {
               IfEqual,A_LoopField,-dir
               {
                  IfEqual, FExt, lnk
                  {
                     FileGetShortcut, %CurrItem%, TargItem
                     SplitPath, TargItem, TargFName, TargFDir, TargFExt, TargFNameNoExt, TargFDrive
                     IfNotEqual,TargFExt,
                        MatchFound = N
                  }
                  else
                     MatchFound = N
               }
               else
               {
                  StringTrimLeft,Srch,A_LoopField,1
                  IfInString, Wht, %Srch%
                     MatchFound = N
               }
            }
            else ;not -excludeword
            {
               IfNotInString, Wht, %A_LoopField% ;vagy FName helyett CurrItem
                  MatchFound = N
            }
         }

         IfEqual, MatchFound, Y
         {
            MatchPList2 = %MatchPList2%|%CurrItem%
            Count2 ++
            Continue
         }

      } ;end of loop parse searchlist at line 479


      ;used only MatchPList2
      MatchPList = %MatchPList1%%MatchPList2%%MatchPList3%

      StringTrimLeft, MatchPList, MatchPList, 1

      Loop, Parse, MatchPList, |
      {
         ;check for change in search query
         ControlGetText, CurrText, Edit1, %MainWnd%
         IfNotEqual, CurrText, %LastText%, Goto, GetText

         Count ++
         IfGreater, Count, %MaxItems%
         {
            moreth := "+"
            Break
         }
         CurrItem = %A_LoopField%
         ;Firefox cucc feldolg
         CurrItem1 =
         CurrItem2 =
         StringSplit,CurrItem,A_LoopField,#
         If CurrItem2
         {
            FName = %CurrItem2%
            FDir = %CurrItem1%
            FNameNoExt = %CurrItem2%
            FExt =
         }
         else
         ;firefox feldolg vége
         SplitPath, A_LoopField, FName, FDir, FExt, FNameNoExt, FDrive

         If ShowIcons
         {
            IfInString,FDir,://
            {
               IL_Add(ImageListID1,A_ProgramFiles "\Mozilla Firefox\firefox.exe",2)
            }
            else IfEqual,FExt,url
            {
               IL_Add(ImageListID1,A_ProgramFiles "\Internet Explorer\iexplore.exe",2)
            }
            else
            {
               hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, A_LoopField, UShortP, iIndex)
               DllCall("ImageList_ReplaceIcon", UInt, ImageListID1, Int, -1, UInt, hIcon)
               DllCall("DestroyIcon", Uint, hIcon)
            }
         }

         LV_Add("Icon" Count, FNameNoExt, FExt, FDir )
      }

      IfEqual, Count,
         LV_Delete()
   }

   ControlGetText, CurrText, Edit1, %MainWnd%
   IfNotEqual, CurrText, %LastText%, Goto, GetText
   
   ;post results
   Results := LV_GetCount() . moreth

   ElapsedTime := (A_TickCount - StartTime)/1000
   Fstop := round(ElapsedTime,2)

   GuiControl,, Results, %Results% results (%Fstop% sec)
   LV_ModifyCol()

   ;select first item
   ControlSend, SysListView321, {Down}, %MainWnd%
Return


ButtonScan:
;Gosub, Hide320
Menu, Tray, Icon, Shell32.dll, 57 ;23 57 172 210

Sleep, 500
SetTimer, CheckScanPause, 500
FileDelete, %A_ScriptDir%\Scan%ListFile%

   ;generating file list
   IfInString, PathListX, ***
   PathListX = C:
   Loop, Parse, PathListX, |
   {
      IfNotExist, %A_LoopField%, Continue
 
     SplashImage,, %Spl_Design%,%A_LoopField%,Scanning folders...

      ;Skip scanning Favorites if url is not to be indexed
      If A_LoopField contains Favorites
        If Typelist not contains url,***
          Continue

      Loop, %A_LoopField%\*.*, 0, 1
      {
         SplitPath, A_LoopFileFullPath, FName, FDir, FExt, FNameNoExt, FDrive

         ;only filetypes defined are added
         bSupportedExt := FALSE
         Loop PARSE, TypeList, |
         {
         If not A_LoopField
            Continue
            If (FExt = A_LoopField or A_LoopField = "***")
               bSupportedExt := TRUE
         }
         if (not bSupportedExt)
            Continue

         ;excluding items based on ExcludeList
         Cont = 0
         Loop, Parse, ExcludeList, |
         {
            IfInString, A_LoopFileFullPath, %A_LoopField%
            {
               Cont = 1
               Break
            }
         }

         ;including items based on IncludeList
         Loop, Parse, IncludeList, |
         {
            IfInString, A_LoopFileFullPath, %A_LoopField%
            {
               Cont = 0
               Break
            }
         }

         IfEqual, Cont, 1
            Continue

         ;reaching here means that file is not to be excluded and
         ;has a desired extension

         FileAppend, %A_LoopFileFullPath%`n, %A_ScriptDir%\Scan%ListFile%
      }
   }

   ScanItemList =

;--sort by mod-date------------------------------------------------------
   SplashImage,, %Spl_Design%,Sorting by mod date,Scanning folders...
   Loop, Read, %A_ScriptDir%\Scan%ListFile%
   {
      IfEqual, A_LoopReadLine,, Continue
      SplitPath, A_LoopReadLine, FName, FDir, FExt, FNameNoExt
      FPath := A_LoopReadLine
      FileGetTime, FMod, %FPath%, M
      if (InStr(FExt,"lnk"))
         FileGetShortcut, %A_LoopReadLine%, FPath
      ScanItemList = %ScanItemList%%FMod%`t%A_LoopReadLine%`n
   }

   Sort, ScanItemList, R ;Reverse sort
   FileDelete, %A_ScriptDir%\Scan%ListFile%
   if ERRORLEVEL
   {
    MsgBox, The Scan_index file could not be deleted: `n%A_ScriptDir%\Scan%ListFile%. `nSorted results are not written back.
   ;Critical, OFF
   Menu, Tray, Icon, Shell32.dll, 23 ;23 57 172 210
   Return
   }

   SplashImage,, %Spl_Design%,Rewriting sorted items,Scanning folders...
   Loop, parse, ScanItemList, `n
   {
    if A_LoopField =  ; Omit the last linefeed (blank item) at the end of the list.
        continue
    StringSplit, FileItem, A_LoopField, %A_Tab%  ; Split into two parts at the tab char.
    FileAppend, %FileItem2%`n, %A_ScriptDir%\Scan%ListFile%
   }

   ScanItemList =
;--sort by mod-date vége-------------------------------------------------

   SplashImage,, %Spl_Design%,Reading bookmarks,Scanning Firefox BookMarks...
   GoSub, ScanFirefoxBM

   Sleep, 1000
   RenRetry =
ButtonScan_RenameRetry:
   FileMove,%A_ScriptDir%\Scan%ListFile%,%A_ScriptDir%\%ListFile%,1
   if ERRORLEVEL
   {
      RenRetry ++
      Sleep, 1000
      SplashImage,, %Spl_Design%,Retrying %RenRetry% of 10,Scan file rename error...
      If (RenRetry < 11)
         GoTo, ButtonScan_RenameRetry
      SetTimer, RemoveTrT, 100
      MsgBox, Scan Error: The Scan_index file could not be renamed.`n%A_ScriptDir%\Scan%ListFile%. `nScanned results are not updated.
      ;Critical, OFF
      Menu, Tray, Icon, Shell32.dll, 23 ;23 57 172 210
      Return
   }
   Sleep, 1000

   SplashImage,, %Spl_Design%,Reading in new items,Scanning folders...
   GoSub, ReadScanFile
   LastText =
   SplashImage,, %Spl_Design%,,Scanning ready.
   SetTimer, RemoveTrT, 3000
SetTimer, CheckScanPause, OFF
;Critical, OFF
Menu, Tray, Icon, Shell32.dll, 23 ;23 57 172 210
Return


CheckScanPause:
   If (A_TimeIdle > 499)
      Return
   SplashImage,2:, %Spl_Design%,Computer in use.`nWaiting %ScanPause% sec.,Scanning paused
   Sleep, % (ScanPause * 1000)
   SplashImage,2:OFF
Return


ButtonOpen:
   ControlGetFocus, curFoc, %MainWnd%
   IfEqual, curFoc, Edit2
   {
   ControlFocus, Edit1, %MainWnd%
   Return
   }
   Gui, Submit, NoHide
   GetKeyState, ShKey, Shift
   GetKeyState, CtKey, Control
   GetKeyState, WinKey, LWin
   ControlFocus, SysListView321, %MainWnd%

   SelItem := LV_GetNext()

   IfEqual, SelItem, 0
      RunSearch = 1

   IfEqual, CtKey, D
      RunSearch = 1

   IfEqual, RunSearch, 1
   {
      RunItem = %CurrText%

      ;run unrecognised cmd
      IfNotExist, %CurrText%
      {
         FileExist = 0
         Goto, AddToList
      }
   }

   ;running a found file/folder

   IfNotEqual, RunSearch, 1
   LV_GetText(FName, SelItem, 1)
   LV_GetText(FExt, SelItem, 2)
   LV_GetText(FDir, SelItem, 3)

   IfEqual, FExt,
   IfNotInString,FDir,://
    RunItem = %FDir%\%FName%
   else
    RunItem = %FDir%
   IfNotEqual, FExt,
    RunItem = %FDir%\%FName%.%FExt%
   FileExist = 1


   ;remove the last \ from a launched folder's name
   StringRight, check, RunItem, 1
   IfEqual, check, \
      StringTrimRight, RunItem, RunItem, 1

   ;add the \ back if the target is a drive path
   StringLen, check, RunItem
   IfLess, check, 3
      RunItem = %RunItem%\

IfInString,RunItem,://
   Add2History = %RunItem%#%FName%
else
   Add2History = %RunItem%

   ;File info box
   IfEqual, nyomi2, 1
   {
      FileGetShortcut, %RunItem%, LnkTarget
      MsgBox RunItem = %RunItem% `n`nLnkTarget = %LnkTarget%
      Return
   }
   IfEqual, WinKey, D
   {
      FileGetShortcut, %RunItem%, LnkTarget
      MsgBox RunItem = %RunItem% `n`nLnkTarget = %LnkTarget%
      Return
   }

   ;get real file path from shortcut
   StringRight, check, RunItem, 4
   if (InStr(check,".lnk"))
   {
     if LnkDir
     {
        FileGetShortcut, %RunItem%, LnkTarget
        IfNotInString, LnkTarget, {
          IfNotInString, LnkTarget, }
            RunItem = %LnkTarget%
     }
   }


   SplitPath, RunItem, FName, FDir, FExt, FNameNoExt, FDrive

   ;shift key down opens host folder
   IfEqual, ShKey, D
   {
      Run, %OpenFolderWithX% "%FDir%"
      GoSub, Hide320
      Return
   }

   ;Dir button opens host folder
   IfEqual, nyomi, 1
   {
      Run, %OpenFolderWithX% "%FDir%"
      GoSub, Hide320
      Return

   }

   ;simple run
   IfEqual, RParam,
      Run, %RunItem%, %FDir%, UseErrorLevel

   ;runtime param
   IfNotEqual, RParam,
      Run, %RunItem% "%RParam%", %FDir%, UseErrorLevel

AddToList:
   StringReplace, UsedList, UsedList, |%Add2History%,, A
   UsedList = |%Add2History%%UsedList%

   ;leave only max items in list
   ;StringReplace,UsedList,UsedList,||,|,All
   StringTrimLeft, UsedList, UsedList, 1
   StringSplit, UsedItem, UsedList, |
   UsedList =
   Loop, % MaxLastUsed
   {
      CurrItem := UsedItem%A_Index%
      IfEqual, CurrItem,, Continue
      UsedList = %UsedList%|%CurrItem%
   }
   IniWrite, %UsedList%, %IniFile%, Advanced, UsedList
GoSub, Hide320
Return
;;End ButtonOpen

+^t:: ;testing some code: StringSplit
   Test := UsedList
   InputBox, Test, Title Test, Prompt Test, , , , , , , , %Test%
   StringSplit, TestItem, Test, |
   msg:="0: " TestItem0
   Loop, %TestItem0%
   {
      msg := msg "`n" A_Index ": " TestItem%A_Index%
   }
   MsgBox, %msg%
Return

Selection:
  ControlGet, ShowTTip, Checked,, Button3, %MainWnd% ;A ShowTTip checkbox állapota
  GetKeyState, Esckey, Esc
  IfEqual, Esckey, D
    Return

  SelItem := LV_GetNext()
  LV_GetText(0FName, SelItem, 1)
  LV_GetText(0FExt, SelItem, 2)
  LV_GetText(0FDir, SelItem, 3)
   IfInString,0FDir,://
      Pth = %0FDir% [%0FName%]
   else
      Pth = %0FDir%\%0FName%.%0FExt%

  FTarget =

  If Pth
  {
    if (InStr(0FExt,"lnk"))
    {
      FileGetShortcut, %Pth%, FTarget
      SplitPath, FTarget, mFName, mFDir, mFExt
    }
    else
      SplitPath, Pth, mFName, mFDir, mFExt


   If mFExt in jpg,gif,bmp,png,tif,ico,wmf,emf,exif,ani,cur ;Other images in Gui
    {
      WinMove,%MainWnd%,,%GuiX%,%GuiY%,% GuiW + 210,%GuiH% ;Make Gui bigger
      shPng := true
      ; If shIE
         ; IE_Move(pwb, GuiW, GuiMargin+40, 0, 0)
      GuiControl,, Static3, *w0 *h0 %Pth%
      GuiControl,MoveDraw, Static5, % "X" GuiW " Y" GuiMargin+20 " w200 h20"
      GuiControlGet, Pic, Pos, Static3
      GuiControl,, Static5,Picture preview: (%PicW% x %PicH%)
      ;The position/size will be stored in PicX, PicY, PicW, and PicH
      If (PicW > 200)
         GuiControl,, Static3, *w200 *h-1 %Pth%
    }
   ; else If mFExt in ppt,pps,pot ;doc,xls ;IE preview
    ; {
      ; WinMove,%MainWnd%,,%GuiX%,%GuiY%,% GuiW + 210,%GuiH% ;Make Gui bigger
      ; shIE := true
         ; GuiControl,MoveDraw, Static3, w0 h0
      ; If (IE_Busy(pwb))
      ; {
         ; IE_Stop(pwb)
         ; Sleep,1000
      ; }
      ; If (not IE_Busy(pwb))
         ; IE_LoadURL(pwb,Pth)
      ; GuiControl,MoveDraw, Static5, % "X" GuiW " Y" GuiMargin+20 " w200 h20"
      ; GuiControl,, Static5,Preview
      ; ControlFocus,Edit1,%MainWnd%
    ; }
    else if (shPng or shIE)
   {
        WinMove,%MainWnd%,,%GuiX%,%GuiY%,%GuiW%,%GuiH% ;Restore Gui size
      shPng =
      shIE =
   }
  }


  if (Pth && ShowTTip)
  {
    if (InStr(0FExt,"lnk"))
    {
       FileGetTime, FileDate, %FTarget%, M  ; Retrieves the modification time by default.
    }
    else
    {
       FileGetTime, FileDate, %Pth%, M  ; Retrieves the modification time by default.
    }
    FormatTime, FileDate, %FileDate%, yyyy.MM.dd HH:mm
    ToShow = File:`t%Pth%`nTarget:`t%FTarget%`nModif:`t%FileDate%
    If not wH
      WinGetPos, wX, wY, wW, wH, %MainWnd%
    ;ToolTip, %ToShow%, %wW%, 3 ;jobboldalt felül
    ToolTip, %ToShow%, 0, %wH% ;alul
  }

  IfEqual, A_GuiControlEvent, DoubleClick
    GoTo, ButtonOpen
Return



Google:
   doma = com
   If (A_Language = "040e")
      doma = hu
   ControlGetText,Txt,Edit1,%MainWnd%
   Run, www.google.%doma%/search?q=%Txt%
Return

Wikipedia:
   doma = en
   If (A_Language = "040e")
      doma = hu
   ControlGetText,Txt,Edit1,%MainWnd%
   Run, %doma%.wikipedia.org/?search=%Txt%
Return

ButtonDir:
  nyomi = 1
  GoSub, ButtonOpen
  nyomi =
Return

ButtonDirTg:
  LnkDir = 1
  nyomi = 1
  GoSub, ButtonOpen
  LnkDir =
  nyomi =
Return

MenuWin:
  nyomi2 = 1
  GoSub, ButtonOpen
  nyomi2 =
Return

GuiEscape:
  GoSub, Hide320
Return

GuiClose:
  GoSub, Hide320
Return

;Chris made this long ago!
ExpandVars(Var)
{
   var_new = %var%
   in_reference = n
   Loop, parse, var_new, `%
   {
      if in_reference = n
      {
         in_reference = y
         continue
      }
      StringTrimLeft, ref_contents, %A_LoopField%, 0
      StringReplace, var_new, var_new, `%%A_LoopField%`%, %ref_contents%, all
      in_reference = n
   }
   Return, var_new
}



Hide320:
  ControlFocus, SysListView321, %MainWnd% ;removes long name tooltip
   If shPng
     WinMove,%MainWnd%,,%GuiX%,%GuiY%,%GuiW%,%GuiH%

   ControlGetText, zz, Edit1, %MainWnd%

   if id320 <> -1
   {
      WinHide, ahk_id %id320%
      ToolTip
;      GoSub, Start320
   }
   ToolTip
Return


Show320:
   if id320 <> -1
   {
      ;Reload ListItems
      WinShow, ahk_id %id320%
      WinActivate, ahk_id %id320%
      ControlFocus, Edit1, ahk_id %id320%
      GoSub, ReadScanFile
   }
   if (zz)
     ControlSetText,Edit1,%zz%,ahk_id %id320%
   Send, ^a ;select all
Return


Up::
Down::
PgUp::
PgDn::
Home::
End::
   IfWinNotActive, %MainWnd%
   {
      Send, {%A_ThisHotkey%}
      Return
   }
   ControlGetFocus, CurrCtrl, %MainWnd%
   IfEqual, CurrCtrl, Edit1
      ControlSend, SysListView321, {%A_ThisHotkey%}, %MainWnd%
   else
    send, {%A_ThisHotkey%}
Return


AppsKey::
  IfWinNotActive, %MainWnd%
     {
        Send, {AppsKey}
        Return
     }
GuiContextMenu:  ; Launched in response to a right-click or press of the Apps key.
  Hotkey, Up, Off
  Hotkey, Down, Off
  GoSub, CheckScanDate_and_CreateMenus
  Menu, MyContextMenu, Show , 220, 100 ;%A_GuiX%, %A_GuiY%
  Hotkey, Up, On
  Hotkey, Down, On
return

~!f::
   ;Alt-F Toggle FindInPath checkbox
   IfWinNotActive, %MainWnd%
     Return
   ControlClick, Button2, %MainWnd%
   ;A FindInPath checkbox állapota
   ControlGet, FindInPath, Checked,, Button2, %MainWnd%
   IniWrite, %FindInPath%, %IniFile%, Display, FindInPath
   ControlFocus, Edit1, %MainWnd%
   GoTo, GetText
Return

~!s::
   ;Alt-S Edit MaxItems
   IfWinNotActive, %MainWnd%
     Return
   ControlGetFocus, curFoc, %MainWnd%
   IfEqual, curFoc, Edit2
   {
      ControlFocus, Edit1, %MainWnd%
      GoTo, GetText
   }
   else
   {
      ControlFocus, Edit2, %MainWnd%
      Send, {Control Down}a{Control Up}
   }
Return

~!t::
   ;Alt-T Toggle ShowTTip checkbox
   IfWinNotActive, %MainWnd%
     Return
   ControlClick, Button3, %MainWnd%
   ;A ShowTTip checkbox állapota
   ControlGet, ShowTTip, Checked,, Button3, %MainWnd%
   IniWrite, %ShowTTip%, %IniFile%, Display, ShowTTip
   if !ShowTTip
     Tooltip
   ControlFocus, Edit1, %MainWnd%
   GoTo, GetText
Return

ChangeView:
;!v::
   IfWinNotActive, %MainWnd%,, Return
   IfEqual, CurrentView, ;LargeIcons
   {
      ;Make it Report
      IconSize = 0
      sGuiW := GuiW
      sGuiH := GuiH
      sGuiX := GuiX
      GuiW := GuiW + 500
      GuiH := GuiH
      GuiX := GuiX - 250
      WinMove,%MainWnd%,,%GuiX%,%GuiY%,%GuiW%,%GuiH% ;Make Gui restored
      Gui, Font, s8, Tahoma
      GuiControl, Font, SysListView321
      GuiControl, MoveDraw, SysListView321, % "w" LVGuiW+500
      GuiControl, +Report, SysListView321
      GuiControl, +BackgroundWhite +CBlack, SysListView321
      GuiControl, MoveDraw, Static3, % "x" GuiW
      LV_ModifyCol()
      CurrentView = Report
      IniWrite, 1, %IniFile%, Display, ShowBigView
   }
   else
   {
      ;Make it Tile
      IconSize = 1
      GuiW := sGuiW
      GuiH := sGuiH
      GuiX := sGuiX
      WinMove,%MainWnd%,,%GuiX%,%GuiY%,%GuiW%,%GuiH% ;Make Gui restored
      Gui, Font, s9, %GuiFont%
      GuiControl, Font, SysListView321
      GuiControl, MoveDraw, SysListView321, % "w" LVGuiW
      GuiControl, +Tile, SysListView321
      GuiControl, +BackgroundBlack +CWhite, SysListView321
      GuiControl, MoveDraw, Static3, % "x" GuiW
      LV_ModifyCol()
      CurrentView =
      IniWrite, 0, %IniFile%, Display, ShowBigView
   }
   LastText = lskldjfiwjesakjdwoidj
   GoSub, GetText
Return

^Del::
MenuDel:
   IfWinNotActive, %MainWnd%,, Return
   ControlGetText, CurrText, Edit1, %MainWnd%
   IfNotEqual, CurrText,, Return

   SelItem := LV_GetNext()
   LV_GetText(FName, SelItem, 1)
   LV_GetText(FExt, SelItem, 2)
   LV_GetText(FDir, SelItem, 3)

  IfEqual, FExt,
   IfNotInString,FDir,://
    Pth = %FDir%\%FName%
   else
    Pth = %FDir%#%FName%
  IfNotEqual, FExt,
    Pth = %FDir%\%FName%.%FExt%
   StringReplace, UsedList, UsedList, |%pth%,, A
   IniWrite, %UsedList%, %IniFile%, Advanced, UsedList
   LastText = xkhdkhsaoihdiiouwoeiue
   Goto, GetText
Return

;; Configure here your quick-access-key ;;

CapsLock & a::
!d::
   IFWinExist, ahk_id %id320%
   {
      GoSub, Hide320
      Return
   }
   DetectHiddenWindows, ON
   IFWinExist, ahk_id %id320%
      GoSub, Show320
   DetectHiddenWindows, OFF
Return

!^d::
   ExitApp
Return

;; Control the focus of main window. When it lose focus, hide it.
WM_ACTIVATE( wParam, lParam )
{
   if ( wParam = 0 )
      GoSub Hide320
   Return 0
}


ScanFirefoxBM:
IfNotExist, %A_AppData%\Mozilla\Firefox\profiles.ini
{
   MsgBox, Does not exist %A_AppData%\Mozilla\Firefox\profiles.ini
   Return
}

;get path to bookmarks file
Loop
{
   ;don't scan for more than 25 profiles to prevent un-ending loop
   IfGreater, A_Index, 25, Break

   Count := A_Index - 1
   ;see if current profile is Default
   IniRead, IsDefault, %A_AppData%\Mozilla\Firefox\profiles.ini, Profile%Count%, Default, %A_Space%
   IfEqual, IsDefault,
   IniRead, IsDefault, %A_AppData%\Mozilla\Firefox\profiles.ini, Profile%Count%, Name, %A_Space%
   Else
   IsDefault = default
   IfEqual, IsDefault, default
   {
      ;get path to default profile
      IniRead, PPath, %A_AppData%\Mozilla\Firefox\profiles.ini, Profile%Count%, Path, %A_Space%

      ;check for bookmarks file
      IfExist, %PPath%\bookmarks.html
         BMFile = %PPath%\bookmarks.html
      Else IfExist, %A_AppData%\Mozilla\Firefox\%PPath%
         BMFile = %A_AppData%\Mozilla\Firefox\%PPath%\bookmarks.html
      Else
      {
         ;read last saved bookmarks file path
         IniRead, BMFile, %A_ScriptFullPath%, Plugin Settings, Bookmarks, %A_Space%
         IfNotExist, %BMFile%
         {
            MsgBox,, 320MPH Firefox Bookmarks plugin, FireFox Bookmarks file not found.`nIn the next window, please select the file from Firefox Profile folder.
            FileSelectFile, BMFile, 3, bookmarks.html, Select FireFox Bookmarks file, HTML Documents (*.html)

            IfNotExist, %BMFile%
               Return
         If not A_IsCompiled
            IniWrite, %BMFile%, %A_ScriptFullPath%, Plugin Settings, Bookmarks
         }
      }
      Break
   }
}


;last resort -> use profile0
IfEqual, BMFile,
IfExist, %A_AppData%\Mozilla\Firefox\profiles.ini
{
  IniRead, PPath, %A_AppData%\Mozilla\Firefox\profiles.ini, Profile%Count%, Path, %A_Space%

  ;check for bookmarks file
  IfExist, %PPath%\bookmarks.html
     BMFile = %PPath%\bookmarks.html
  Else IfExist, %A_AppData%\Mozilla\Firefox\%PPath%
     BMFile = %A_AppData%\Mozilla\Firefox\%PPath%\bookmarks.html
}

;give up finally
IfNotExist, %BMFile%
   Return


FileRead, BookMarks, %BMFile%

Sclp := ClipboardAll
List2Write =
Loop, Parse, BookMarks, `n, `r
{
   RE = U)\QHREF="\E.*"
   RegExMatch(A_LoopField, RE, ToRun)
   IfEqual, ToRun,, Continue

   StringTrimLeft, ToRun, ToRun, 6
   StringTrimRight, ToRun, ToRun, 1

   RE = U)">.*\Q</A>\E
   FixHighligthing = "
   RegExMatch(A_LoopField, RE, Tags)
   IfEqual, Tags,, Continue
   StringTrimLeft, Tags, Tags, 2
   StringTrimRight, Tags, Tags, 4

;________________________________________________________
   ;IMPORTANT for compatability reasons
   StringReplace, Tags, Tags, |, -, A
   StringReplace, Tags, Tags, #, -, A
;________________________________________________________


   Transform, Clipboard, Unicode, %Tags%
   Tags := Clipboard



;________________________________________________________
   ;APPEND additions to existing cache file
   ;eg.
   ;C:\Folder\File.exe <Search Tags to help find this file>
   List2Write = %List2Write%`n<ToRun=%ToRun%><Name=%Tags%>
;________________________________________________________
}
Clipboard := Sclp
Sclp =


;________________________________________________________
;For all read/write actions to cache file DON'T provide path.
;Use as if the cache file is in plugin's folder.
FileAppend, %List2Write%, %A_ScriptDir%\Scan%ListFile%
;FileAppend, %List2Write%, %IndexFile%
;________________________________________________________
Return


;#Include %A_ScriptDir%\IEControl.ahk
;#Include %A_ScriptDir%\IniGui.ahk


/*
********************************************************
         USER CONFIGURATION AREA

[Plugin Settings]
;FireFox Bookmarks path
Bookmarks=


********************************************************
*/


/*
IniGui
Automaticly generated Gui for a standard INI file
Auto-save any changes
Auto reload all params after closing the Gui

Usage:
#Include IniGui.ahk
IniGui_IniFile = <your_ini_file.ini>
GoSub, IniGui_Setup

Name space: IniGui_ (for Subrutines and Vars)

Features:
Handle sections in the INI file
Handle param types: (commented line under param starting with type=boolean) Boolean (True/False), Short Text or Num, Long Text, Parsing List (separated by |)
Shows default values for params (commented line under param starting with Default=)
Shows help texts for params (any other commented lines under param)

Example INI structure:
[Section Name]
Param1 = any value
;Default=default value
;Type=Boolean
;This is the help text.
;This text appears also in the Gui for user help.

Param2 = True
...

 */

;IniGui_IniFile:="320MPHX.ini"
;GoSub, IniGui_Setup
;Return
 
 

IniGui_Setup:
   If (!IniGui_IniFile)
      Return
   IfNotExist,%IniGui_IniFile%
      Return
   IniGui_Hiba =
   
   Gui, 99:+LastFound
   IniGui_mywin := WinExist()
   Gui, 99:+Resize
   Gui, 99:Default
   Gui, 99:Add, TreeView, vIniGui_MyTree x0 y0 h500 w200 gIniGui_MyTree

   Gui, 99:Add, Text, w400 x210 y20 h105, ;Dummy for type description and Help
   Gui, Font, Bold
   Gui, 99:Add, Text, w400 x210 y130, Value:
   Gui, 99:Add, Text, w400 x210 y330, Default:
   Gui, Font

   Gui, 99:Add, Edit, w400 r10 x210 y150 -Wrap HScroll gIniGui_DoEdit1 vIniGui_Ed1,
   Gui, 99:Add, Edit, w200 r1 x210 y150 gIniGui_DoEdit2 vIniGui_Ed2,
   Gui, 99:Add, Checkbox, w400 x210 y150 gIniGui_DoButton1,

   Gui, 99:Add, Edit, w400 x210 y350 h100, ;Dummy for Default val text

   Gui, 99: Add, Button, x460 y460 w150 h25 gIniGui_DoExit, Close
   GoSub, IniGui_AddTreeItems

   Gui, 99:Show,w620 h500,%A_ScriptName% Setup
Return

IniGui_AddTreeItems:
   Loop, Read, %IniGui_IniFile%
   {
      If (!A_LoopReadLine or SubStr(A_LoopReadLine,1,1)=";")
         Continue
      If (SubStr(A_LoopReadLine,1,1)="[") ;Section
         If not IniGui_Expand
         {
            StringReplace,IniGui_Sect,A_LoopReadLine,[,,All
            StringReplace,IniGui_Sect,IniGui_Sect,],,All
            IniGui_SID := TV_Add(IniGui_Sect,"","Bold Expand")
            IniGui_Expand = 1
         }
         else
         {
            StringReplace,IniGui_Sect,A_LoopReadLine,[,,All
            StringReplace,IniGui_Sect,IniGui_Sect,],,All
            IniGui_SID := TV_Add(IniGui_Sect,"","Bold")
         }
      else ;Param
      {
         StringSplit,IniGui_Item,A_LoopReadLine,=
         IniGui_Par = %IniGui_Item1%
         IniGui_IID := TV_Add(IniGui_Par,IniGui_SID)
      }
   }
Return

IniGui_MyTree:  ; This subroutine handles user actions (such as clicking).
   if A_GuiEvent <> S  ; i.e. an event other than "select new tree item".
       Return  ; Do nothing.
   IniGui_CurrTV := A_EventInfo
   TV_GetText(IniGui_ValName,IniGui_CurrTV)
   IniGui_PID := TV_GetParent(IniGui_CurrTV)
   TV_GetText(IniGui_PName,IniGui_PID)
   IniRead,IniGui_Val,%IniGui_IniFile%,%IniGui_PName%,%IniGui_ValName%
   ;Tooltip, IniRead IniGui_Val "IniGui_IniFile" %IniGui_PName% %IniGui_ValName%
   
   ;Get Help and Default if any
   IniGui_Help = `r`n
   IniGui_Default =
   IniGui_Type =
   IniGui_Kell =
   Loop, Read, %IniGui_IniFile%
   {
      ;IfNotInString,A_LoopReadLine,%IniGui_ValName%
      If (SubStr(A_LoopReadLine,1,StrLen(IniGui_ValName))<>IniGui_ValName)
      {
         If not IniGui_Kell
            Continue
      }
      else
      {
         IniGui_Kell = 1
         Continue
      }
      ;MsgBox, %A_LoopReadLine%
      If (SubStr(A_LoopReadLine,1,8)=";default") ;Default
         IniGui_Default := SubStr(A_LoopReadLine,InStr(A_LoopReadLine,"=")+1)
      else If (SubStr(A_LoopReadLine,1,5)=";type") ;Type
         IniGui_Type := SubStr(A_LoopReadLine,InStr(A_LoopReadLine,"=")+1)
      else If (SubStr(A_LoopReadLine,1,1)=";") ;Help
         IniGui_Help := IniGui_Help . "`r`n" . SubStr(A_LoopReadLine,2)
      else If (!A_LoopReadLine) ;Empty row
         Continue
      else ;New section or Param
         Break
      Continue
   }

   
   Control,Hide,,Static1,ahk_id %IniGui_mywin%
   Control,Hide,,Static2,ahk_id %IniGui_mywin%
   Control,Hide,,Static3,ahk_id %IniGui_mywin%
   Control,Hide,,Edit1,ahk_id %IniGui_mywin%
   Control,Hide,,Edit2,ahk_id %IniGui_mywin%
   Control,Hide,,Edit3,ahk_id %IniGui_mywin%
   Control,Hide,,Button1,ahk_id %IniGui_mywin%
   If (IniGui_Val=="" or IniGui_Val="ERROR")
      Return
   ; StringReplace,IniGui_Help,IniGui_Help,|,`r`n,All
   ; StringReplace,IniGui_Default,IniGui_Default,|,`r`n,All
   Control,Show,,Static1,ahk_id %IniGui_mywin%
   Control,Show,,Static2,ahk_id %IniGui_mywin%

   ;If IniGui_Val in false,true ;Boolean
   If (InStr(IniGui_Type,"bool")) ;Boolean
   {
      ControlSetText,Static1,%IniGui_ValName% (type: Boolean) %IniGui_Help%
      If IniGui_Default
      {
         Control,Show,,Edit3,ahk_id %IniGui_mywin%
         Control,Show,,Static3,ahk_id %IniGui_mywin%
         ControlSetText,Edit3,%IniGui_Default%
      }
      Control,Show,,Button1,ahk_id %IniGui_mywin%
      If (IniGui_Val)
         Control,Check,,Button1,ahk_id %IniGui_mywin%
      else
         Control,UnCheck,,Button1,ahk_id %IniGui_mywin%
      ControlFocus,SysTreeView321,ahk_id %IniGui_mywin%
   }

   else If (InStr(IniGui_Type,"parse") or (InStr(IniGui_Val,"|") and StrLen(IniGui_Val)>1)) ;Parse list
   {
      ControlSetText,Static1,%IniGui_ValName% (type: Parse List) %IniGui_Help%
      If IniGui_Default
      {
         Control,Show,,Edit3,ahk_id %IniGui_mywin%
         Control,Show,,Static3,ahk_id %IniGui_mywin%
         StringReplace,IniGui_Default,IniGui_Default,|,`r`n,All
         ControlSetText,Edit3,%IniGui_Default%
      }
      Control,Show,,Edit1,ahk_id %IniGui_mywin%
      StringReplace,IniGui_Val,IniGui_Val,|,`r`n,All
      ControlSetText,Edit1,% IniGui_Val,ahk_id %IniGui_mywin%
   }

   else If (StrLen(IniGui_Val)<30) ;Short text
   {
      ControlSetText,Static1,%IniGui_ValName% (type: Short Text or Num) %IniGui_Help%
      If IniGui_Default
      {
         Control,Show,,Edit3,ahk_id %IniGui_mywin%
         Control,Show,,Static3,ahk_id %IniGui_mywin%
         ControlSetText,Edit3,%IniGui_Default%
      }
      Control,Show,,Edit2,ahk_id %IniGui_mywin%
      ControlSetText,Edit2,% IniGui_Val,ahk_id %IniGui_mywin%
   }

   else ;Long text noWrap
   {
      ControlSetText,Static1,%IniGui_ValName% (type: Long Text) %IniGui_Help%
      If IniGui_Default
      {
         Control,Show,,Edit3,ahk_id %IniGui_mywin%
         Control,Show,,Static3,ahk_id %IniGui_mywin%
         ControlSetText,Edit3,%IniGui_Default%
      }
      Control,Show,,Edit1,ahk_id %IniGui_mywin%
      ControlSetText,Edit1,% IniGui_Val,ahk_id %IniGui_mywin%
   }
Return

IniGui_DoWriteIni(IniGui_CurrTV,IniGui_Val)
{
Global
   IniGui_ID := TV_GetText(IniGui_Par,IniGui_CurrTV)
   IniGui_PID := TV_GetParent(IniGui_ID)
   TV_GetText(IniGui_PName,IniGui_PID)
   ;Tooltip, % "IniWrite: " IniGui_Par "=" IniGui_Val " Section:" IniGui_PName
   IniWrite, %IniGui_Val%, %IniGui_IniFile%, %IniGui_PName%, %IniGui_Par%
Return
}

IniGui_DoEdit1:
   ControlGetText,IniGui_Ed1,Edit1,ahk_id %IniGui_mywin%
   StringReplace,IniGui_Val,IniGui_Ed1,`r`n,|,All
   StringReplace,IniGui_Val,IniGui_Val,||,|,All
   StringReplace,IniGui_Val,IniGui_Val,||,|,All
   StringReplace,IniGui_Val,IniGui_Val,||,|,All
   IniGui_DoWriteIni(IniGui_CurrTV,IniGui_Val)
Return

IniGui_DoEdit2:
   ControlGetText,IniGui_Ed2,Edit2,ahk_id %IniGui_mywin%
   IniGui_Val := IniGui_Ed2
   IniGui_DoWriteIni(IniGui_CurrTV,IniGui_Val)
Return

IniGui_DoButton1:
   ControlGet, IniGui_Bu1, Checked,, Button1, ahk_id %IniGui_mywin%
   IniGui_Val = 0
   If IniGui_Bu1
      IniGui_Val = 1
   IniGui_DoWriteIni(IniGui_CurrTV,IniGui_Val)
Return

IniGui_DoExit:
99GuiClose:
99GuiEscape:
   Gui, 99:Destroy
   Gui, 1:Default
   Tooltip
   GoSub, IniGui_Load
Return

IniGui_Load:
   If (!IniGui_IniFile)
   {
      MsgBox, IniGui_IniFile is not defined.
      Return
   }
   IfNotExist,%IniGui_IniFile%
   {
      MsgBox, %IniGui_IniFile% not exists.
      Return
   }
   IniGui_Hiba =
   Loop, Read, %IniGui_IniFile%
   {
      If (!A_LoopReadLine or SubStr(A_LoopReadLine,1,1)=";")
         Continue
      If (SubStr(A_LoopReadLine,1,1)="[")
      {
         StringReplace,IniGui_Sect,A_LoopReadLine,[,,All
         StringReplace,IniGui_Sect,IniGui_Sect,],,All
      }
      else
      {
         StringSplit,IniGui_Item,A_LoopReadLine,=
         IniGui_Par = %IniGui_Item1%
         IniRead,%IniGui_Par%,%IniGui_IniFile%,%IniGui_Sect%,%IniGui_Par%
         ;MsgBox, IniRead-%IniGui_Item1%-%IniGui_IniFile%-%IniGui_Sect%-%IniGui_Item1%
      }
   }
Return

Back to top
View user's profile Send private message
Hacker



Joined: 10 Jun 2006
Posts: 65
Location: Bratislava, Slovakia

PostPosted: Thu Apr 24, 2008 9:57 am    Post subject: Reply with quote

rajat,
Hello,
I know how to index all the .exe in c:\Program Files\ and all the .mp3 in c:\Music\. However, I would also like to index all the dirs on the c:\ drive to be able to quickly access them, but I do not want the files inside to be indexed.
Is there a way to do this?

Thank you
Roman
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 499

PostPosted: Thu Apr 24, 2008 11:11 am    Post subject: Reply with quote

@hacker:
Just add this to the ButtonScan routine
Code:
   Loop, c:\*.*, 2,1
   {
      FileAppend, %A_LoopFileFullPath%`n, %A_ScriptDir%\%ListFile%
   }
You could also try to read them from the treeinfo.wc file if you wish.
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 499

PostPosted: Thu Apr 24, 2008 11:18 am    Post subject: Reply with quote

@fures:
Nice!
Back to top
View user's profile Send private message
pockinator



Joined: 06 Dec 2007
Posts: 33

PostPosted: Thu Apr 24, 2008 1:28 pm    Post subject: Reply with quote

HugoV wrote:
@hacker:
Just add this to the ButtonScan routine
Code:
   Loop, c:\*.*, 2,1
   {
      FileAppend, %A_LoopFileFullPath%`n, %A_ScriptDir%\%ListFile%
   }
You could also try to read them from the treeinfo.wc file if you wish.

I guess in order to do this we would have to use a slightly older version of nDroid to access the source code, right?
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 499

PostPosted: Thu Apr 24, 2008 3:05 pm    Post subject: Reply with quote

@pockinator: Yes correct. As far as I know, the nDroid source code is not available yet. Hopefully it will some day.

But you can make your own scan plugins for nDroid:
http://www.codenite.com/forum/viewtopic.php?f=2&t=14
Back to top
View user's profile Send private message
@John_S
Guest





PostPosted: Thu Apr 24, 2008 7:15 pm    Post subject: Reply with quote

fure's script is very fast indeed.
I don't know if it would be possible if you posted a version to look only for folders, not files.
I'd highly appreciated it.
Thanks.
Back to top
Hacker



Joined: 10 Jun 2006
Posts: 65
Location: Bratislava, Slovakia

PostPosted: Fri Apr 25, 2008 3:24 pm    Post subject: Reply with quote

HugoV,
Thanks. I guess a scan plugin is the only way to go.

Roman
Back to top
View user's profile Send private message