Here is a persistent variant which you can compile.
Right windows key toggles it.
Code:
#SingleInstance ignore
#NoEnv
#Persistent
SetBatchLines, -1
Process, Priority, , High
Menu, Tray, Icon, shell32.dll, 25
OnMessage(0x06, "WM_ACTIVATE")
RegRead, Favorites, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Favorites
If Not Favorites
RegRead, Favorites, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, Favorites
RegRead, Recent, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, Recent
If Not Recent
RegRead, Recent, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, Recent
COMMANDER_PATH = E:\Total Commander
;AltType = jpg,bmp,gif,tiff,png
Gui, Color, EEAA99
Gui, +LastFound +ToolWindow
WinSet, TransColor, EEAA99
Gui, Font, s12 w700 cWhite
Gui, Add, ListView, w400 h320 Background000000 AltSubmit vSearched gListGo, Icon|Name|Link|Path
Gui, Font, s14 w500 cBlack
Gui, Add, Edit, w400 h32 vEdit gSearch
Gui, Add, Button, x+ h32 Default vGo, &Go
Menu, Info, Add, &Open, ButtonGo
Menu, Info, Add, &Edit, Edit
Menu, Info, Add, &Properties, Properties
Search:
i=0
IL_Destroy(ImageListID)
LV_Delete()
ImageListID := IL_Create("",1,1)
;Searchtext := LastText
LV_SetImageList(ImageListID)
ControlGetText, SearchText, Edit1
If Searchtext<>
{
Loop, %Favorites%\%SearchText%*, 0
{
GoSub, Shortcut
}
Loop, %Recent%\%SearchText%*, 0
{
GoSub, Shortcut
}
Loop, %A_AppData%\Microsoft\Internet Explorer\Quick Launch\%SearchText%*, 0, 1
{
GoSub, Shortcut
}
Loop, %A_AppData%\Microsoft\Windows\Recent\%SearchText%*, 0
{
GoSub, Shortcut
}
Loop, %A_StartMenu%\%SearchText%*, 0, 1
{
GoSub, Shortcut
}
Loop, %A_StartMenuCommon%\%SearchText%*, 0, 1
{
GoSub, Shortcut
}
Loop, 26
{
k := A_Index - 1
IniRead, Path, %COMMANDER_PATH%\wincmd.ini, RightHistory, %k%
IfInString, Path, %SearchText%, GoSub, Dir
IniRead, Path, %COMMANDER_PATH%\wincmd.ini, LeftHistory, %k%
IfInString, Path, %SearchText%, GoSub, Dir
}
Loop, HKEY_CURRENT_USER, Software\Quizo\QTTabBar\RecentlyClosed
{
RegRead, Path
IfInString, Path, %SearchText%, GoSub, File
}
Loop, HKEY_CURRENT_USER, Software\Quizo\QTTabBar\RecentFiles
{
RegRead, Path
IfInString, Path, %SearchText%, GoSub, File
}
GuiControl, +Tile, Searched
LV_ModifyCol()
LV_GetText(Link, 1, 2)
If Link<>
GuiControl, Show, Searched
else
GuiControl, Hide, Searched
}
else
{
IL_Destroy(ImageListID)
LV_Delete()
GuiControl, Hide, Searched
}
Gui, +Owner -Caption -SysMenu
Gui, Show, AutoSize Center, Launcher
WinGetPos, xX, yY, wW, hH, Launcher ahk_class AutoHotkeyGUI
ControlGetText, SearchText, Edit1
if not SearchText
{
IL_Destroy(ImageListID)
LV_Delete()
GuiControl, Hide, Searched
}
If !WinActive("Launcher ahk_class AutoHotkeyGUI")
{
Goto, Close
}
return
Dir:
IfExist, %Path%
{
hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, Path, UShortP, iIndex)
i += 1
DllCall("ImageList_ReplaceIcon", UInt, ImageListID, Int, -1, UInt, hIcon)
DllCall("DestroyIcon", Uint, hIcon)
StringGetPos, pos, Path, `\, R2
StringTrimLeft, Name, Path, %pos%
StringReplace, Name, Name, `\,, 1
StringGetPos, pos, Name, %SearchText%
If pos = 0
LV_Add("Icon" . i, Name, Path, Path)
pos =
}
return
File:
IfExist, %Path%
{
hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, Path, UShortP, iIndex)
i += 1
DllCall("ImageList_ReplaceIcon", UInt, ImageListID, Int, -1, UInt, hIcon)
SplitPath, Path, Name
LV_Add("Icon" . i, Name, Path, Path)
}
return
Shortcut:
FileGetShortcut, %A_LoopFileLongPath%, Path
IfExist, %Path%
{
hIcon := DllCall("Shell32\ExtractAssociatedIconA", UInt, 0, Str, A_LoopFileLongPath, UShortP, iIndex)
i += 1
DllCall("ImageList_ReplaceIcon", UInt, ImageListID, Int, -1, UInt, hIcon)
DllCall("DestroyIcon", Uint, hIcon)
StringReplace, Name, A_LoopFileName, .lnk
LV_Add("Icon" . i, Name, A_LoopFileLongPath, Path)
}
return
Edit:
Focused := LV_GetNext(0, "F")
if not Focused
return
LV_GetText(Path, Focused, 3)
Run, Edit %Path%,, UseErrorLevel
Goto, Close
return
Properties:
Focused := LV_GetNext(0, "F")
if not Focused
return
LV_GetText(Link, Focused, 2)
Run, Properties %Link%,, UseErrorLevel
Goto, Close
return
ButtonGo:
Focused := LV_GetNext(0, "F")
if not Focused
Focused = 1
LV_GetText(Link, Focused, 2)
If Link<>
Run, %Link%,, UseErrorLevel
else
Run, %SearchText%,, UseErrorLevel
Goto, Close
return
ListGo:
if A_GuiEvent = Normal
{
LV_GetText(Path, A_EventInfo, 3)
ToolTip, %Path%, 14, -28
}
else if A_GuiEvent = I
{
LV_GetText(Path, A_EventInfo, 3)
ToolTip, %Path%, 14, -28
}
else if A_GuiEvent = DoubleClick
{
LV_GetText(Link, A_EventInfo, 2)
Goto, ButtonGo
}
else
Tooltip
return
GuiContextMenu:
if A_GuiControl <> Searched
return
else If A_EventInfo = 0
Goto, Close
else
Menu, Info, Show
return
GuiEscape:
GuiClose:
Exit:
Close:
SearchText =
IL_Destroy(ImageListID)
LV_Delete()
GuiControl, Hide, Searched
GuiControl, Hide, Edit
GuiControl, Hide, Go
MouseGetPos, , , id
WinActivate, ahk_id %id%
return
WM_ACTIVATE(wParam, lParam)
{
if wParam = 1
{
ControlSetText, Edit1,, Launcher ahk_class AutoHotkeyGUI
GuiControl, Show, Edit
GuiControl, Show, Go
ControlFocus, Edit1, Launcher ahk_class AutoHotkeyGUI
}
else if wParam = 0
{
SearchText =
IL_Destroy(ImageListID)
LV_Delete()
GuiControl, Hide, Searched
GuiControl, Hide, Edit
GuiControl, Hide, Go
}
}
*RWin::
If WinActive("Launcher ahk_class AutoHotkeyGUI")
{
Goto, Close
}
else
{
ControlSetText, Edit1,, Launcher ahk_class AutoHotkeyGUI
GuiControl, Show, Edit
GuiControl, Show, Go
WinActivate, Launcher ahk_class AutoHotkeyGUI
ControlFocus, Edit1, Launcher ahk_class AutoHotkeyGUI
}
return
Also added total commander from wincmd.ini (you'll need to edit the path) and qttabbar history from regedit.
Also added WM_ACTIVATE to toggle states (click anywhere outside the gui to deactivate the window).
Doesn't write to the registry / any ini file.
You may use the following in your main scripts to toggle the launcher:
Code:
IfWinNotExist, Launcher ahk_class AutoHotkeyGUI
Run, %A_ScriptDir%\Launcher.AHK
else IfWinNotActive, Launcher ahk_class AutoHotkeyGUI
{
WinActivate, Launcher ahk_class AutoHotkeyGUI
ControlFocus, Edit1, Launcher ahk_class AutoHotkeyGUI
}
@netfun, use shift-tab/tab to focus the listview and then you can use arrow keys