AutoHotkey Community

It is currently May 25th, 2012, 6:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 356 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15 ... 24  Next
Author Message
 Post subject:
PostPosted: March 12th, 2007, 6:25 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
SanskritFritz wrote:
We also miss you! Plans to develop further? ;-)

yes ofcourse! ...what i currently use is even faster and improved but needs some fixes... only a matter of time till i get to smoothen things.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2007, 9:53 pm 
Offline

Joined: February 17th, 2005, 10:06 am
Posts: 280
Location: Hungary, Budapest
Great news! Thanks Rajat!

_________________
Is there another word for synonym?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Wow this rocks
PostPosted: March 18th, 2007, 7:40 am 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
Wow this rocks.
Blazing fast. so fast it makes you wonder !
:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: 320 MPH Customized ;)
PostPosted: May 10th, 2007, 7:31 pm 
Hi folks !!!

Before anything, I would like to thank you Rajat and all the others who have contributed to develop this great, amazing, SUPER-KICK-ASS tool !!! It rocks !

Well, I'm a VB, Delphi, C++, php, java, ... etc ... and autohotkey programmer. And I thought I could achieve a little more speed with this tool. So, I've customized it for me, and I would like to share it with you all.

Sorry, I didn't read all threads from this post ... It'd be very time consuming. So, my apologizes if anybody has already done it before.

Well, the modifications are:
Instead of using EXITAPP when it loads a program, I keep it running hidden and assigned a hotkey to bring it back to screen. This little modification makes it runs even faster !

The code :

Code:
/*

___________________________________________





              320MPH by Rajat



        Ultra Fast Anything-Launcher

        Modified by: Johann Wilfried Josefy



Order of Results:

   - Recently used items

   - Items with name starting with search querry

   - Items with search querry anywhere in their name

   - Items with search querry anywhere in their path

___________________________________________

*/



#SingleInstance force

AutoTrim, Off

SetBatchLines, -1



MainWnd = 320MPH -- Rajat

SetKeyDelay, 0

id320 = -1 ;; ID of 320 MPH Screen



;___________________________________________


Start320:

IniFile = %A_ScriptDir%\320MPH.ini



IfNotExist, %IniFile%

{

   MsgBox,, 320MPH, 320MPH.ini not found. Program will now exit

   ExitApp

}



;Reading Settings

IniRead, PathList, %IniFile%, Settings, PathList, %A_MyDocuments%|%A_ProgramFiles%

IniRead, TypeList, %IniFile%, Settings, TypeList, exe|lnk|ahk|url|mp3

IniRead, ExcludeList, %IniFile%, Settings, ExcludeList, about|history|readme|remove|uninstall|license

IniRead, AlwaysScan, %IniFile%, Settings, AlwaysScan, %UserProfile%\Recent|%A_StartMenuCommon%|%A_StartMenu%|%A_Desktop%

IniRead, MaxLastUsed, %IniFile%, Settings, MaxLastUsed, 50

IniRead, WaitTime, %IniFile%, Settings, WaitTime, 100

IniRead, ShowIcons, %IniFile%, Settings, ShowIcons, 1

IniRead, MinLen, %IniFile%, Settings, MinLen, 2

IniRead, ListFile, %IniFile%, Settings, ListFile, RunList.txt

IniRead, ShellIntegration, %IniFile%, Settings, ShellIntegration, 1

IniRead, GuiWMinus, %IniFile%, Settings, GuiWMinus, 20

IniRead, GuiHMinus, %IniFile%, Settings, GuiHMinus, 250

IniRead, UsedList, %IniFile%, Settings, UsedList, |

LastUsedList = %UsedList%



GuiW := A_ScreenWidth - GuiWMinus

GuiH := A_ScreenHeight - GuiHMinus



AlwaysScan := ExpandVars(AlwaysScan)

PathList := ExpandVars(PathList)





StringRight, ExtChk, A_ScriptFullPath, 4

IfEqual, ExtChk, .exe

IfEqual, ShellIntegration, 1

{

   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%





IniRead, UsedList, %IniFile%, Settings, UsedList

IfEqual, UsedList, ERROR

   UsedList =



UsedList0 =

Loop, Parse, UsedList, |

{

   IfNotExist, %A_LoopField%, Continue

   UsedList0 = %UsedList0%|%A_LoopField%

}



UsedList = %UsedList0%

;___________________________________________











;create scanned result list on first run

IfExist, %A_ScriptDir%\%ListFile%

{

   ItemList =

   Loop, Read, %A_ScriptDir%\%ListFile%

   {

      IfEqual, A_LoopReadLine,, Continue

      ItemList = %ItemList%|%A_LoopReadLine%

   }

}

Else

   Gosub, ButtonScan





;scan always updated list

Loop, Parse, AlwaysScan, |

{

   Loop, %A_LoopField%\*.*, 0, 1

   {

      SplitPath, A_LoopFileFullPath, FName, FDir, FExt, FNameNoExt, FDrive



      ;only filetypes defined are added

      IfNotInString, TypeList, %FExt%, Continue

      

      ;excluding items based on ExcludeList

      Cont = 0

      Loop, Parse, ExcludeList, |

      {

         IfInString, FName, %A_LoopField%

         {

            Cont = 1

            Break

         }

      }

      

      IfEqual, Cont, 1

         Continue

      

      ;reaching here means that file is not to be excluded and

      ;has a desired extension

      

      RecentList = %RecentList%|%A_LoopFileFullPath%

   }

}



StringTrimLeft, RecentList, RecentList, 1

ItemList = %RecentList%%ItemList%

;;JWJ - Avoids drawing GUI again
if id320 <> -1
   Return

DrawGUI:

LVGuiW := GuiW - 12

LVGuiH := GuiH - 64

StatusY := GuiH - 25



Gui, -Caption +Border


Gui, Add, Text, x6 y7 w40 h20, Search:

Gui, Add, Edit, x46 y5 w150 h20 vCurrText gGetText,



Gui, Add, Text, x210 y7 w40 h20, Params:

Gui, Add, Edit, x250 y5 w250 h20 vRParam, %RParam%



Gui, Add, ListView, x6 y35 w%LVGuiW% h%LVGuiH% vSelItem HScroll gSelection AltSubmit, Name|Ext|Folder

Gui, Add, Button, 0x8000 x516 y5 w50 h20 Default, &Open

Gui, Add, Button, 0x8000 x576 y5 w50 h20, &Scan

Gui, Add, Text, x6 y%StatusY% w120 h20 vResults,

Gui, Font, S10 CDefault Italic Bold, Verdana

Gui, Add, Text, x450 y%StatusY% w150 h20 Right, %MainWnd%



LV_ModifyCol(1, 100)

LV_ModifyCol(2, 60)

LV_ModifyCol(3, 250)



Gui, Show, h%GuiH% w%GuiW%, %MainWnd%

;JWJ; Get's the ID of 320MPH Window, so it can control Hide and Show
WinGet, id320, ID, A


LastText = fadsfSDFDFasdFdfsadfsadFDSFDf





;SetTimer, GetText, 200

Gosub, GetText

;Sleep, 200

Control, Choose, 1, SysListView321, %MainWnd%

Return







Up::

   IfWinNotActive, %MainWnd%,

   {

      Send, {Up}

      Return

   }

   ControlGetFocus, CurrCtrl, %MainWnd%

   IfEqual, CurrCtrl, Edit1

      ControlSend, SysListView321, {Up}, %MainWnd%

Return

   



Down::

   IfWinNotActive, %MainWnd%,

   {

      Send, {Down}

      Return

   }

   ControlGetFocus, CurrCtrl, %MainWnd%

   IfEqual, CurrCtrl, Edit1

      ControlSend, SysListView321, {Down}, %MainWnd%

Return





^Del::

   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,

      Pth = %FDir%\%FName%

   IfNotEqual, FExt,

      Pth = %FDir%\%FName%.%FExt%



   StringReplace, UsedList, UsedList, |%pth%,, A

   IniWrite, %UsedList%, %IniFile%, Settings, UsedList

   LastText = x

   Goto, GetText

Return





GetText:

   ControlGetText, CurrText, Edit1, %MainWnd%

   IfEqual, CurrText, %LastText%, Return

   StringLen, Check, CurrText



   IfGreater, Check, 0

   IfLess, Check, %MinLen%

      Return

   

   LastText = %CurrText%



   ;from last used_____________________________

   IfEqual, CurrText,

   {

      IfEqual, ShowIcons, 1

      {

         IL_Destroy(ImageListID1)

   

         ; Create an ImageList so that the ListView can display some icons:

         ImageListID1 := IL_Create(5, 10)      

         ; 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 querry

         ControlGetText, CurrText, Edit1, %MainWnd%

         IfNotEqual, CurrText, %LastText%, Goto, GetText



         SplitPath, A_LoopField, FName, FDir, FExt, FNameNoExt

         Count ++

         IfGreater, Count, %MaxLastUsed%, Break



         IfEqual, ShowIcons, 1

         {

            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 )



         ;select first item

         IfEqual, A_Index, 1

            ControlSend, SysListView321, {Down}, %MainWnd%

      }

   }



   

   ;from all items_____________________________

   IfNotEqual, CurrText,

   {

      IfInString, ItemList, %CurrText%

         IfEqual, ShowIcons, 1

         {

            IL_Destroy(ImageListID1)

      

            ; Create an ImageList so that the ListView can display some icons:

            ImageListID1 := IL_Create(20, 50)      

            ; 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 =      

      

      ;earliest in searh results are recently used items

      SearchList = %UsedList%%ItemList%



      Loop, Parse, SearchList, |

      {

         ;check for change in search querry

         ControlGetText, CurrText, Edit1, %MainWnd%

         IfNotEqual, CurrText, %LastText%, Goto, GetText



         CurrItem = %A_LoopField%



         ;remove duplicate entry that exists both in usedlist and itemlist

         CheckList = %MatchPList1%%MatchPList2%%MatchPList3%|

         IfInString, CheckList, |%CurrItem%|, Continue



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



         StringLen, Len, CurrText

         StringLeft, LText, FName, %Len%



         ;Matching leftmost text

         IfEqual, LText, %CurrText%

         {

            MatchPList1 = %MatchPList1%|%CurrItem%

            Continue

         }



         ;Matching file name only

         ;fuzzy search

         MatchFound = Y



         Loop, Parse, CurrText, %A_Space%

            IfNotInString, FName, %A_LoopField%

               MatchFound = N



         IfEqual, MatchFound, Y

         {

            MatchPList2 = %MatchPList2%|%CurrItem%

            Continue

         }





         ;search everywhere

         ;fuzzy search

         MatchFound = Y

         

         Loop, Parse, CurrText, %A_Space%

            IfNotInString, CurrItem, %A_LoopField%

               MatchFound = N

         

         IfEqual, MatchFound, Y

         {

            MatchPList3 = %MatchPList3%|%CurrItem%

            Continue

         }

      }

      

      MatchPList = %MatchPList1%%MatchPList2%%MatchPList3%

      

      StringTrimLeft, MatchPList, MatchPList, 1

      

      Loop, Parse, MatchPList, |

      {

         ;check for change in search querry

         ControlGetText, CurrText, Edit1, %MainWnd%

         IfNotEqual, CurrText, %LastText%, Goto, GetText



         Count ++

         SplitPath, A_LoopField, FName, FDir, FExt, FNameNoExt, FDrive



         IfEqual, ShowIcons, 1

         {

            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 )



         ;select first item

         IfEqual, A_Index, 1

            ControlSend, SysListView321, {Down}, %MainWnd%

      }

      

      IfEqual, Count,

         LV_Delete()

   }



   ;post results      

   Results := LV_GetCount()

   GuiControl,, Results, Results = %Results%

   LV_ModifyCol()

Return





ButtonScan:

   SplashImage,, W190 H30 B1,, Scanning..,



   FileDelete, %A_ScriptDir%\%ListFile%

   

   ;generating file list   

   Loop, Parse, PathList, |

   {

      IfNotExist, %A_LoopField%, Continue

      

      Loop, %A_LoopField%\*.*, 0, 1

      {

         SplitPath, A_LoopFileFullPath, FName, FDir, FExt, FNameNoExt, FDrive



         ;only filetypes defined are added

         IfNotInString, TypeList, %FExt%, Continue



         ;excluding items based on ExcludeList

         Cont = 0

         Loop, Parse, ExcludeList, |

         {

            IfInString, FName, %A_LoopField%

            {

               Cont = 1

               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%\%ListFile%

      }

   }

   ItemList =

   Loop, Read, %A_ScriptDir%\%ListFile%

   {

      IfEqual, A_LoopReadLine,, Continue

      ItemList = %ItemList%|%A_LoopReadLine%

   }



   

   ItemList = %RecentList%%ItemList%

   LastText =

   

   SplashImage, Off

Return





ButtonOpen:

   Gui, Submit, NoHide

   GetKeyState, ShKey, Shift

   GetKeyState, CtKey, Control

   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

   Loop

   {

      LV_GetText(FName, SelItem, 1)

      LV_GetText(FExt, SelItem, 2)

      LV_GetText(FDir, SelItem, 3)



      IfEqual, FExt,

         RunItem = %FDir%\%FName%

      IfNotEqual, FExt,

         RunItem = %FDir%\%FName%.%FExt%



      IfExist, %RunItem%

      {

         FileExist = 1

         Break

      }

   }



   

   ;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%\



   Add2History = %RunItem%



   ;get real file path from shortcut

   StringRight, check, RunItem, 4

   IfEqual, check, .lnk

   {

      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, Explorer %FDir%,, UseErrorLevel

      ;ExitApp
      GoSub, Hide320
      Return

   }





   AddToList:



   ;simple run

   IfEqual, RParam,

      Run, %RunItem%, %FDir%, UseErrorLevel



   ;runtime param

   IfNotEqual, RParam,

      Run, %RunItem% "%RParam%", %FDir%, UseErrorLevel

   

   IfEqual, FileExist, 1

      StringReplace, UsedList, UsedList, |%Add2History%,, A

   

   ;leave only max items in list

   StringSplit, UsedItem, UsedList, |

   UsedList =

   Loop, %MaxLastUsed%

   {

      CurrItem := UsedItem%A_Index%

      IfEqual, CurrItem,, Continue

      UsedList = %UsedList%|%CurrItem%

   }



   IniWrite, |%Add2History%%UsedList%, %IniFile%, Settings, UsedList

   IniWrite, %LastUsedList%, %IniFile%, Settings, LastUsedList

;;JWJ;;
;ExitApp
GoSub, Hide320

Return

;;End ButtonOpen






Selection:

  SelItem := LV_GetNext()

   LV_GetText(0FName, SelItem, 1)

   LV_GetText(0FExt, SelItem, 2)

   LV_GetText(0FDir, SelItem, 3)

   Pth = %0FDir%\%0FName%.%0FExt%



   IfEqual, FExt, lnk

   {

      WinGetPos, wX, wY, wW, wH, %MainWnd%



      FileGetShortcut, %Pth%, FTarget

      ToShow = %FTarget%

      ToolTip, %ToShow%, 0, %wH%

   }

   Else

      ToolTip



  IfEqual, A_GuiControlEvent, DoubleClick

    GoTo, ButtonOpen

Return







GuiEscape:

GuiClose:

   ;ExitApp
   
   ;;JWJ;;
   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

      }

      ; Otherwise, A_LoopField is a variable reference:

      StringTrimLeft, ref_contents, %A_LoopField%, 0

      StringReplace, var_new, var_new, `%%A_LoopField%`%, %ref_contents%, all

      in_reference = n

   }

   Return, var_new

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Code added by Johann

Hide320:
if id320 <> -1
{
   WinHide, ahk_id %id320%

   ControlSetText, Edit1, , ahk_id %id320%
   ToolTip
   GoSub, Start320
   GoSub, GetText
}

Return


Show320:
if id320 <> -1
{
   WinShow, ahk_id %id320%   
   ControlFocus, Edit1
   
   ;; I prefer not to do this, once that without this line it runs lightning fast !
   ;; But if u wanna reload the original list, uncomment the line below
   ;ControlSetText, Edit1, ZZ
   
   ControlSetText, Edit1,
}
Return

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

SC115::
DetectHiddenWindows, ON
IFWinExist, ahk_id %id320%
   GoSub, Show320
DetectHiddenWindows, OFF
Return

^SC115::
ExitApp

;; TO-DO: Control the focus of main window. When it lose focus, hide it.



I apreciate your comments on it !. Please contact me, feel free to tell me what you thought about it.
My email is jwjosefy (at) gmail (dot) com

Hugs !!!
Johann


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2007, 8:22 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
thanks Johann! .. i have also toyed with the idea of making it so that it keeps running and popping at need... i wasn't sure if everybody would like that. but i guess there're ppl who will.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2007, 12:37 am 
Thanks again Rajat. I got this idea today at the work ... I had another idea, but have little time to make: Create a Timer which checks if 320 is the active window. When it's no more, hide it. I guess this can give a little more power for heavy users like me, who are used to work with more than 15 apps at the same time.

By the way, I'm from Brazil, São Paulo =)

Hugs !


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2007, 10:29 am 
Offline

Joined: February 17th, 2005, 10:06 am
Posts: 280
Location: Hungary, Budapest
I also like the idea, and nicely done, unobtrusive and elegant!
Thanks!

One thing: I uncommented the ZZ line, but it looks ugly. Could this be done right after the window was hidden? I will look into this, but no time now :roll:

EDIT: ok, I took some time, and if you replace the line
ControlSetText, Edit1, ZZ
with
LastText := "ZZ"
you get the same result, but nicer and quicker. I will investigate further later.

_________________
Is there another word for synonym?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2007, 10:51 pm 
Offline

Joined: February 17th, 2005, 10:06 am
Posts: 280
Location: Hungary, Budapest
Code:
OnMessage( 6, "WM_ACTIVATE" )

...


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

_________________
Is there another word for synonym?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2007, 6:37 pm 
Indeed, very cool this idea ! I couldn't imagine that solution...

I was wondering another thing these days... What if 320MPH used a SQLite archive to make the queries ? Wouldn't that be faster ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2007, 7:54 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Edit August 16:

Requirement: Running instance of Total Commander and I use Alt-F10 to launch it

- (3rd) Modified version of 320MPH script to work with directories only
as alternative for Alt-F10 in Total Commander (works a bit like XCD)

- It CAN use treeinfo.wc (see ini) but also scan drives in one big directory
list (RunList4Folders.txt). All fixed drives can be (re)scanned at once
or separately.

- NOTE: the Scan function replaces treeinfo.wc files, but the result is not
a 100% the same as when done by TC. As far as I can tell it does not seem
to affect TC (Once you create/remove a dir in TC treeinfo.wc will be
'corrected' by TC)

- Control Enter opens folder in new tab

- Shift Enter opens folder in a new tab in the opposite panel

- Creates INI on first run

- Most of the original code is there, commented out... (except for ButtonScan: which has been replaced)

- It no longer searches items with search query anywhere in their path

- Alt-F10 closes App and launches the Total Commander Directory tree

- Scanning creates a new Gui so you can now have it scan in background,
when it is finished it reloads the script.

- Replaced clipboard and ^v method of sending the path with postmessages
and sendinput/play so it should work more accurate now.

I haven't been able to test it very thoroughly so YMMV

Code:
/*
References:
320mph script
http://www.autohotkey.com/forum/topic3010.html

Alternative for Alt-F10/Directory tree
http://www.ghisler.ch/board/viewtopic.php?t=12429

WARNING: CODE IS VERY MESSY, and it rewrites treeinfo.wc if you
use the totcmd method so use at your own risk...
Also scanning (network) drives can take a long time so be patient
___________________________________________
320MPH-Tree

- Modified version of 320MPH script to work with directories only
  as alternative for Alt-F10 in Total Commander (works a bit like XCD)

- It CAN use treeinfo.wc (see ini) but also scan drives in one big directory
  list (RunList4Folders.txt). All fixed drives can be (re)scanned at once
  or separately.

- NOTE: the Scan function replaces treeinfo.wc files, but the result is not
  a 100% the same as when done by TC. As far as I can tell it does not seem
  to affect TC (Once you create/remove a dir in TC treeinfo.wc will be
  'corrected' by TC)

- Control+Enter opens directory in new tab

- Shift+Enter opens directory in a new tab in the opposite panel

- Creates INI on first run

- Most of the original code is there, commented out...

- INI settings:

  * UseTreeinfo=1 in INI means use treeinfo.wc, 0 do not use treeinfo.wc
    but use RunList4Folders.txt

  * UseNetworkDrives=1 in INI means include network drives in search 0 do not include
  (you can toggle this via the checkbox as well, it will remember the last choice made)

- Added F2 key to start scanning

Edit August 16:
- Alt-F10 closes App and launches the Total Commander Directory tree

- Scanning creates a new Gui so you can now have it scan in background,
when it is finished it reloads the script.

- Replaced clipboard and ^v method of sending the path with postmessages
and sendinput/play so it should work more accurate now.

TODO:
- Speed up? Search can be a bit slow with many directories
- Make it work with (Microsoft Office) Open/Save dialogs, browse folders, explorer?
___________________________________________
  320MPH by Rajat
  Ultra Fast Anything-Launcher
  Order of Results:
   - Recently used items
   - Items with name starting with search querry
   - Items with search query anywhere in their name
   NO LONGER SEARCHES: - Items with search query anywhere in their path
___________________________________________
*/
#SingleInstance ignore
#NoTrayIcon
AutoTrim, Off
SetBatchLines, -1
MainWnd = 320mph-Tree
SetKeyDelay, 0
;___________________________________________

IniFile = %A_ScriptDir%\320mph4folders.ini

; create ini on first run if it does not Exist
IfNotExist, %IniFile%
{
   {
      ini=
(
[Settings]
UseTreeinfo=1
UseNetworkDrives=0
MaxLastUsed=100
WaitTime=100
ShowIcons=1
MinLen=2
ListFile=RunList4Folders.txt
GuiWMinus=100
GuiHMinus=250
UsedList=
LastUsedList=
)
  FileAppend,%ini%,%IniFile%
  ini=
   }
}

;Reading Settings
   ;IniRead, PathList, %IniFile%, Settings, PathList, %A_MyDocuments%|%A_ProgramFiles%
   ;IniRead, TypeList, %IniFile%, Settings, TypeList, exe|lnk|ahk|url|mp3
   ;IniRead, ExcludeList, %IniFile%, Settings, ExcludeList, about|history|readme|remove|uninstall|license
   ;IniRead, AlwaysScan, %IniFile%, Settings, AlwaysScan, %UserProfile%\Recent|%A_StartMenuCommon%|%A_StartMenu%|%A_Desktop%
IniRead, UseTreeinfo, %IniFile%, Settings, UseTreeinfo, 0 ; new ini value
IniRead, UseNetworkDrives, %IniFile%, Settings, UseNetworkDrives, 0 ; new ini value
IniRead, MaxLastUsed, %IniFile%, Settings, MaxLastUsed, 50
IniRead, WaitTime, %IniFile%, Settings, WaitTime, 100
IniRead, ShowIcons, %IniFile%, Settings, ShowIcons, 1
IniRead, MinLen, %IniFile%, Settings, MinLen, 2
IniRead, ListFile, %IniFile%, Settings, ListFile, RunList4Folders.txt
IniRead, ShellIntegration, %IniFile%, Settings, ShellIntegration, 1
IniRead, GuiWMinus, %IniFile%, Settings, GuiWMinus, 20
IniRead, GuiHMinus, %IniFile%, Settings, GuiHMinus, 250
IniRead, UsedList, %IniFile%, Settings, UsedList, |
LastUsedList = %UsedList%
GuiW := A_ScreenWidth - GuiWMinus
GuiH := A_ScreenHeight - GuiHMinus
   ;AlwaysScan := ExpandVars(AlwaysScan)
   ;PathList := ExpandVars(PathList)

/*
StringRight, ExtChk, A_ScriptFullPath, 4
IfEqual, ExtChk, .exe
IfEqual, ShellIntegration, 1
{
   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%
DriveGet, FixedDrives, List, FIXED ; get fixed drives
DriveGet, NetworkDrives, List, NETWORK ; get mapped network drives

IfEqual, UseNetworkDrives, 1
   RParam=%FixedDrives%%NetworkDrives%
Else
   RParam=%FixedDrives%

IniRead, UsedList, %IniFile%, Settings, UsedList
IfEqual, UsedList, ERROR
UsedList =
UsedList0 =
Loop, Parse, UsedList, |
{
   IfNotExist, %A_LoopField%, Continue
   UsedList0 = %UsedList0%|%A_LoopField%
}

UsedList = %UsedList0%

;___________________________________________

;create scanned result list on first run
WhichDrivesToScan=%RParam%
; moved to separate scan routine
Gosub, ReadTree

/*
;scan always updated list
Loop, Parse, AlwaysScan, |
{
  Loop, %A_LoopField%\*.*, 0, 1
   {
      SplitPath, A_LoopFileFullPath, FName, FDir, FExt, FNameNoExt, FDrive
      FDir=%FDir%\%FName%

      ;only filetypes defined are added
      ;IfNotInString, TypeList, %FExt%, Continue

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

      IfEqual, Cont, 1
         Continue

      ;reaching here means that file is not to be excluded and
      ;has a desired extension
      RecentList = %RecentList%|%A_LoopFileFullPath%
   }
}
*/

StringTrimLeft, RecentList, RecentList, 1
ItemList = %RecentList%%ItemList%
LVGuiW := GuiW - 12
LVGuiH := GuiH - 64
StatusY := GuiH - 25

Gui, -Caption +Border
Gui, Add, Text, x6 y10 w40 h20, Search:
Gui, Add, Edit, x46 y7 w150 h20 vCurrText gGetText,
Gui, Add, Text, x205 y10 w40 h20, Drives:
Gui, Add, Edit, x245 y7 w100 h20 vRParam, %RParam%
Gui, Add, ListView, x6 y35 w%LVGuiW% h%LVGuiH% vSelItem HScroll gSelection AltSubmit, Folder|Full Path
Gui, Add, Button, 0x8000 x445 y7 w50 h20 Default, &Open
Gui, Add, Button, 0x8000 x360 y7 w70 h20, &Scan [F2]
; checkbox for networkdrives
IfEqual, UseNetworkDrives, 1
   Gui, Add, Checkbox, checked 0x8000 x560 y12 vCheckNetworkDrives gCheckNetworkDrives, Network Drives
Else
   Gui, Add, Checkbox, 0x8000 x600 y12 vCheckNetworkDrives gCheckNetworkDrives, Network Drives
Gui, Add, Text, x6 y%StatusY% w120 h20 vResults,
;Gui, Add, Text, x345 y%StatusY% w200 h20, Directories: %DirCounter%
; display number of directories
Gui, Add, Text, x345 y%StatusY% w150 h20 vDirCounter,
GuiControl,, DirCounter, Dirs: %DirCounter%
; display method (treeinfo.wc or filelist)
If (UseTreeinfo <> 1)
   Gui, Add, Text, x205 y%StatusY% w100 h20, Method: Filelist
Else
   Gui, Add, Text, x205 y%StatusY% w100 h20, Method: Totcmd
Gui, Font, S10 CDefault Bold, Verdana
Gui, Add, Text, x450 y%StatusY% w150 h20 Right, %MainWnd%

LV_ModifyCol(1, 200)
LV_ModifyCol(2, 250)
;LV_ModifyCol(3, 250)


Gui, Show, h%GuiH% w%GuiW%, %MainWnd%

LastText = fadsfSDFDFasdFdfsadfsadFDSFDf
Gosub, GetText
Control, Choose, 1, SysListView321, %MainWnd%
Return

; Pressing F2 starts scanning process
F2::
Gosub, ButtonScan
Return


!F10::
Gui, Destroy
WinActivate ahk_class TTOTAL_CMD
WinWaitActive ahk_class TTOTAL_CMD
PostMessage 1075, 500,,,ahk_class TTOTAL_CMD ; cm_CDtree=500 Popup directory tree
ExitApp
Return

Up::
   IfWinNotActive, %MainWnd%,
   {
      Send, {Up}
      Return
   }
   ControlGetFocus, CurrCtrl, %MainWnd%
   IfEqual, CurrCtrl, Edit1
      ControlSend, SysListView321, {Up}, %MainWnd%
Return

Down::
   IfWinNotActive, %MainWnd%,
   {
      Send, {Down}
      Return
   }
   ControlGetFocus, CurrCtrl, %MainWnd%
   IfEqual, CurrCtrl, Edit1
      ControlSend, SysListView321, {Down}, %MainWnd%
Return

^Del::
   IfWinNotActive, %MainWnd%,, Return
   ControlGetText, CurrText, Edit1, %MainWnd%
   IfNotEqual, CurrText,, Return
   SelItem := LV_GetNext()
   LV_GetText(FName, SelItem, 1)
    LV_GetText(FDir, SelItem, 2)

; LV_GetText(FExt, SelItem, 2)
;   LV_GetText(FDir, SelItem, 3)
;   IfEqual, FExt,
;      Pth = %FDir%\%FName%
;   IfNotEqual, FExt,
;      Pth = %FDir%\%FName%.%FExt%
;   StringReplace, UsedList, UsedList, |%pth%,, A

   StringReplace, UsedList, UsedList, |%FDir%,, A

   IniWrite, %UsedList%, %IniFile%, Settings, UsedList
   LastText = x
   Goto, GetText
Return

GetText:
   ControlGetText, CurrText, Edit1, %MainWnd%
   IfEqual, CurrText, %LastText%, Return
   StringLen, Check, CurrText
   IfGreater, Check, 0
   IfLess, Check, %MinLen%
      Return
   LastText = %CurrText%

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

         ; Create an ImageList so that the ListView can display some icons:
         ImageListID1 := IL_Create(5, 10)

         ; 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 querry
         ControlGetText, CurrText, Edit1, %MainWnd%
         IfNotEqual, CurrText, %LastText%, Goto, GetText
         ;SplitPath, A_LoopField, FName, FDir, FExt, FNameNoExt
         SplitPath, A_LoopField, FName, FDir
         FDir=%FDir%\%FName%
         Count ++
         IfGreater, Count, %MaxLastUsed%, Break
         IfEqual, ShowIcons, 1
         {
            ;hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, A_LoopField, UShortP, iIndex)
            ;DllCall("ImageList_ReplaceIcon", UInt, ImageListID1, Int, -1, UInt, hIcon)
            ;DllCall("DestroyIcon", Uint, hIcon)
            IL_Add(ImageListID1, "shell32.dll" , 4) ; assign folder icon
            }

;         LV_Add("Icon" Count, FNameNoExt, FExt, FDir )
         LV_Add("Icon" Count, FName, FDir )

         ;select first item
         IfEqual, A_Index, 1
            ControlSend, SysListView321, {Down}, %MainWnd%
      }
   }

   ;from all items_____________________________
   IfNotEqual, CurrText,
   {
      IfInString, ItemList, %CurrText%
         IfEqual, ShowIcons, 1
         {
            IL_Destroy(ImageListID1)
            ; Create an ImageList so that the ListView can display some icons:
            ImageListID1 := IL_Create(20, 50)
            ; 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 =

      ;earliest in search results are recently used items
      SearchList = %UsedList%%ItemList%
      Loop, Parse, SearchList, |
      {
         ;check for change in search querry
         ControlGetText, CurrText, Edit1, %MainWnd%
         IfNotEqual, CurrText, %LastText%, Goto, GetText
         CurrItem = %A_LoopField%

         ;remove duplicate entry that exists both in usedlist and itemlist
         CheckList = %MatchPList1%%MatchPList2%%MatchPList3%|
         IfInString, CheckList, |%CurrItem%|, Continue
         ;SplitPath, CurrItem, FName, FDir, FExt, FNameNoExt, FDrive
         SplitPath, CurrItem, FName, FDir
         FDir=%FDir%\%FName%
         StringLen, Len, CurrText
         StringLeft, LText, FName, %Len%

         ;Matching leftmost text
         IfEqual, LText, %CurrText%
         {
            MatchPList1 = %MatchPList1%|%CurrItem%
            Continue
         }
      
         ;Matching file name only
         ;fuzzy search
         MatchFound = Y
         Loop, Parse, CurrText, %A_Space%
            IfNotInString, FName, %A_LoopField%
               MatchFound = N

         IfEqual, MatchFound, Y
         {
            MatchPList2 = %MatchPList2%|%CurrItem%
            Continue
         }
/*   
         ;search everywhere
         ;fuzzy search
         MatchFound = Y
         Loop, Parse, CurrText, %A_Space%
            IfNotInString, CurrItem, %A_LoopField%
               MatchFound = N
         IfEqual, MatchFound, Y
         {
            MatchPList3 = %MatchPList3%|%CurrItem%
            Continue
         }
*/

      }

      MatchPList = %MatchPList1%%MatchPList2%%MatchPList3%
      StringTrimLeft, MatchPList, MatchPList, 1

      Loop, Parse, MatchPList, |
      {
         ;check for change in search querry
         ControlGetText, CurrText, Edit1, %MainWnd%
         IfNotEqual, CurrText, %LastText%, Goto, GetText
         Count ++
         ;SplitPath, A_LoopField, FName, FDir, FExt, FNameNoExt, FDrive
         SplitPath, A_LoopField, FName, FDir
         FDir=%FDir%\%FName%
         IfEqual, ShowIcons, 1
         {
;            hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, A_LoopField, UShortP, iIndex)
;            DllCall("ImageList_ReplaceIcon", UInt, ImageListID1, Int, -1, UInt, hIcon)
;            DllCall("DestroyIcon", Uint, hIcon)
            IL_Add(ImageListID1, "shell32.dll" , 4) ; assign folder icon
         }
;         LV_Add("Icon" Count, FNameNoExt, FExt, FDir )
         LV_Add("Icon" Count, FName, FDir )
         ;select first item
         IfEqual, A_Index, 1
            ControlSend, SysListView321, {Down}, %MainWnd%
      }

      IfEqual, Count,
         LV_Delete()
   }

   ;post results
   Results := LV_GetCount()
   GuiControl,, Results, Results = %Results%
   LV_ModifyCol()
Return

; rewrote this routine as it now applies to folders only and you can rescan one or more drives
ButtonScan:
; get drives from control
GuiControlGet, WhichDrivesToScan, , Edit2

; if control is empty return
If (WhichDrivesToScan = "")
   {
       MsgBox No drives to scan
       ControlFocus, Edit1, %MainWnd%
       Return
  }


; close search gui, disable hotkeys and create new gui
Gui, Destroy
Hotkey, F2, Off
Hotkey, Up, Off
Hotkey, Down, Off
Hotkey, ^Del, Off
Gui, Add, Text, x50 y20 w150 h20 vScanning,
Gui, Show, h60 w200, Scanning...
 
StringLen, NumberOfDrives, WhichDrivesToScan
StringSplit, ScanDrive, WhichDrivesToScan
DirCount=0

If (UseTreeinfo=1) ; use treeinfo.wc
{
   Loop, %NumberOfDrives%
   {
   xDrive:=ScanDrive%A_Index%
   search:="im)^" . xDrive . "\:\\(.*)$"
   replace=[$1]
   xTemp=
   DirCount=0
   Loop,%xDrive%:\*.*, 2,1
         {
            ; Read entire directory tree in memory
            xTemp=%xTemp%%A_LoopFileFullPath%`r`n
            DirCount ++
            If DirCount > 99
               {
                 ;SplashImage,, W190 H26 B1,, Scanning... %xDrive%:\ --- %A_Index%,
            GuiControl,, Scanning, Scanning %xDrive%:\ --- %A_Index%

            DirCount=0
               }
         }
   ; now remove drive and add [] to make treeinfo.wc
   OutputVar2:=RegExReplace(xTemp, search, replace)
   Sort, OutputVar2, CLP2
   IfExist, %xDrive%:\treeinfo.wc
      FileDelete, %xDrive%:\treeinfo.wc
   FileAppend, %OutputVar2%, %xDrive%:\treeinfo.wc
   FileSetAttrib, +H, %xDrive%:\treeinfo.wc ; set file's "hidden" attribute
   xTemp=
   DirCount=0
   }
   OutputVar=
   OutputVar2=
  ItemList =
  WhichDrivesToScan=%RParam%
Gosub, ReadTree
}
Else
Loop, %NumberOfDrives% ; create listfile (e.g. we do not use treeinfo.wc)
{
  xDrive:=ScanDrive%A_Index%
   xTemp=
   ; Read entire directory tree in memory
   IfExist, %xDrive%:\
      {
         FileRead, OutputVar, %A_ScriptDir%\%ListFile%
         removedrive:="im)^" . xDrive . ".*`r`n"
         ; before we add the drive to the list, we remove all directories from that drive from the list
         OutputVar2:=RegExReplace(OutputVar, removedrive, "")
         FileDelete, %A_ScriptDir%\%ListFile%
         FileAppend, %OutputVar2%, %A_ScriptDir%\%ListFile%
         ;SplashImage,, W190 H26 B1,, Scanning... %xDrive%:\
         
         Loop,%xDrive%:\*.*, 2,1
         {
            xTemp=%xTemp%%A_LoopFileFullPath%`r`n
            DirCount ++
            If DirCount > 99
               {
           ;SplashImage,, W190 H26 B1,, Scanning... %xDrive%:\ --- %A_Index%,
         GuiControl,, Scanning, Scanning %xDrive%:\ --- %A_Index%
               DirCount=0
               }
         }
         FileAppend, %XTemp%, %A_ScriptDir%\%ListFile%
         xTemp=
        DirCount=0
      }
      Else
         {
;         SplashImage, Off
         MsgBox Drive %xDrive%:\ does not Exist
         }
OutputVar=
OutputVar2=
ItemList =
Gosub, ReadTree
}
;SplashImage, Off

ItemList = %RecentList%%ItemList%
LastText =
;ControlFocus, Edit1, %MainWnd%
Gui,Destroy ; close Scanning.... Gui
Reload
Return

ButtonOpen:
   Gui, Submit, NoHide
   GetKeyState, ShKey, Shift
   GetKeyState, CtKey, Control
   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
   Loop
   {
      LV_GetText(FName, SelItem, 1)
;      LV_GetText(FExt, SelItem, 2)
      LV_GetText(FDir, SelItem, 2)
;      LV_GetText(FDir, SelItem, 3)
      IfEqual, FExt,
         RunItem = %FDir%
      IfNotEqual, FExt,
         RunItem = %FDir%

      IfExist, %RunItem%
      {
         FileExist = 1
         Break
      }
   }

   ;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%\

   Add2History = %RunItem%
   ;get real file path from shortcut

/*
   StringRight, check, RunItem, 4
   IfEqual, check, .lnk
   {
      FileGetShortcut, %RunItem%, LnkTarget
      IfNotInString, LnkTarget, {
      IfNotInString, LnkTarget, }
         RunItem = %LnkTarget%
   }
*/

  ;SplitPath, RunItem, FName, FDir, FExt, FNameNoExt, FDrive
  ;SplitPath, RunItem, FName, FDir
  ;FDir=%FDir%\%FName%

/*
   ;shift key down opens host folder
   IfEqual, ShKey, D
   {
      Run, Explorer %FDir%,, UseErrorLevel
      ExitApp
   }
*/

   AddToList:
   ;simple run
   ;IfEqual, RParam,
   ;Run, %RunItem%, %FDir%, UseErrorLevel
      Gui, Destroy
      WinActivate ahk_class TTOTAL_CMD
      WinWaitActive ahk_class TTOTAL_CMD
      IfEqual, CtKey, D, PostMessage 1075, 3001,,,ahk_class TTOTAL_CMD ; cm_opentab - ctrl key down opens directory in new tab
      IfEqual, ShKey, D ; - shift key down opens directory in new tab in opposite panel
         {
         Send {TAB} ; switch panel
         PostMessage 1075, 3001,,,ahk_class TTOTAL_CMD ; cm_opentab
         }
      PostMessage 1075, 2912,,,ahk_class TTOTAL_CMD ; cm_editpath
      SendPlay %RunItem%{ENTER} ; sendinput sometimes failed sending ; instead of :
/*
   ;runtime param
   IfNotEqual, RParam,
      Run, %RunItem% "%RParam%", %FDir%, UseErrorLevel
*/

   IfEqual, FileExist, 1
      StringReplace, UsedList, UsedList, |%Add2History%,, A

   ;leave only max items in list
   StringSplit, UsedItem, UsedList, |
   UsedList =
   Loop, %MaxLastUsed%
   {
      CurrItem := UsedItem%A_Index%
      IfEqual, CurrItem,, Continue
      UsedList = %UsedList%|%CurrItem%
   }

   IniWrite, |%Add2History%%UsedList%, %IniFile%, Settings, UsedList
   IniWrite, %LastUsedList%, %IniFile%, Settings, LastUsedList
ExitApp

Selection:
  SelItem := LV_GetNext()
   LV_GetText(0FName, SelItem, 1)
;   LV_GetText(0FExt, SelItem, 2)
   LV_GetText(0FDir, SelItem, 2)
;   LV_GetText(0FDir, SelItem, 3)
   Pth = %0FDir%\%0FName%

;   IfEqual, FExt, lnk
;   {
;      WinGetPos, wX, wY, wW, wH, %MainWnd%
;      FileGetShortcut, %Pth%, FTarget
;      ToShow = %FTarget%
;      ToolTip, %ToShow%, 0, %wH%
;   }
;   Else
;      ToolTip

 IfEqual, A_GuiControlEvent, DoubleClick
    GoTo, ButtonOpen
Return

GuiEscape:
GuiClose:
   ExitApp

; checkbox routine for network drives
CheckNetworkDrives:
GuiControlGet, Status, , Button3
xTemp=
If (NetworkDrives = "")
   {
      MsgBox No network drives detected...
      Return
   }
Else   
If (Status = 0)
{
   StringLen, NumberOfDrives, NetworkDrives
   StringSplit, ScanDrive, NetworkDrives
   Loop, %NumberOfDrives%
      {
      xDrive:=ScanDrive%A_Index%
      search:="i)" . xDrive
      replace=
      xTemp:=RegExReplace(WhichDrivesToScan, search, replace)
      WhichDrivesToScan=%xTemp%
      }
}
Else
   WhichDrivesToScan=%WhichDrivesToScan%%NetworkDrives%
xTemp=
IniWrite, %Status%, %IniFile%, Settings, UseNetworkDrives
UseNetworkDrives=%Status%
Gosub, ReadTree
ControlFocus, Edit1, %MainWnd%
Return

; new routine
ReadTree:
If (UseTreeinfo = 1)
  {
   AllPaths=
;   WhichDrivesToScan=%RParam%
   StringLen, NumberOfDrives, WhichDrivesToScan
   StringSplit, ScanDrive, WhichDrivesToScan
   ; read entire directory tree in memory, use regexp to add drives and remove []
   Loop, %NumberOfDrives%
    {
      xDrive:=ScanDrive%A_Index%
       IfExist, %xDrive%:\treeinfo.wc
         {
             FileRead, OutputVar, %xDrive%:\treeinfo.wc
             search:="im)\[(.*)\]"
             adddrive:=xDrive . ":\$1"
             OutputVar2:=RegExReplace(OutputVar, search, adddrive)
             Sort, OutputVar2, Z
             AllPaths=%AllPaths%%OutputVar2%
         }
      }
       ItemList =
      DirCounter=0
         Loop, Parse, AllPaths, `r`n
      {
         IfEqual, A_LoopField,, Continue
         ItemList = %ItemList%|%A_LoopField%
         DirCounter++
      }
   }
   Else { ; eg UseTreeinfo = 0
      IfExist, %A_ScriptDir%\%ListFile%
      {
         ItemList =
         DirCounter=
         xTemp=
         Loop, Read, %A_ScriptDir%\%ListFile%
         {
            IfEqual, A_LoopReadLine,, Continue
            If (UseNetworkDrives = 0)
            {
             StringLeft, xTemp, A_LoopReadLine, 1
            IfNotInString, NetworkDrives, %xTemp%
               {
               ItemList = %ItemList%|%A_LoopReadLine%
               DirCounter++   
               }
            xTemp=
            }
            Else
            {
            ItemList = %ItemList%|%A_LoopReadLine%
            DirCounter++   
            }
         }
         GuiControl,, DirCounter, Dirs: %DirCounter%
      }
      Else {
        InputBox, WhichDrivesToScan, Scan Drives, Which drives to scan (CDEF...), , 200, 120
        if ErrorLevel
          ExitApp
        else
          Gosub, ButtonScan
      }
   }
GuiControl,, DirCounter, Dirs: %DirCounter%
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
      }
   ; Otherwise, A_LoopField is a variable reference:
      StringTrimLeft, ref_contents, %A_LoopField%, 0
      StringReplace, var_new, var_new, `%%A_LoopField%`%, %ref_contents%, all
      in_reference = n
   }
   Return, var_new
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2007, 8:34 pm 
Offline

Joined: February 17th, 2005, 10:06 am
Posts: 280
Location: Hungary, Budapest
HugoV, thanks for the script! I mentioned it in the very thread you credited in the code, and I found some problems in the early version, no time now to try the new one. I will come back to it later.
Do you have anything against publishing the script here:
http://www.ghisler.ch/wiki/index.php/AutoHotkey

_________________
Is there another word for synonym?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2007, 8:02 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
@SanskritFritz:
Not really, but 90% of the code is Rajat's work so if he doesn't mind I don't.

The code has become a bit of a mess as noted in the comments at the beginning of the script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2007, 11:58 pm 
Offline

Joined: March 9th, 2007, 2:47 am
Posts: 509
Location: Unknown
how do you remove the shell integration because i wont go away. also where in the code is the shell integration so i can use it for some of my programs. thx :P


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 3rd, 2007, 10:07 am 
Offline

Joined: February 17th, 2005, 10:06 am
Posts: 280
Location: Hungary, Budapest
System Monitor wrote:
how do you remove the shell integration because i wont go away. also where in the code is the shell integration so i can use it for some of my programs. thx :P
http://www.autohotkey.com/forum/viewtopic.php?p=71785#71785
Code:
IfEqual, ShellIntegration, 1
{
   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,
}

_________________
Is there another word for synonym?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2007, 6:19 pm 
Offline

Joined: December 8th, 2006, 3:56 pm
Posts: 6
Great script, I use it all the time!

How do I make this scan my web favorites (internet explorer) so I can use it to launch web pages as well?

Also, how do I make it scan for specific folders so I can just open that folder?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 356 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15 ... 24  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], kiropes, lblb and 36 guests


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