Everything Menu via AHK

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Everything Menu via AHK

Post by Xavierarmand »

hey y'all!

just wanted to share a bit of random fun I've been having building a Autohotkey menu for Everything 1.5a

Image

the menu items I practically like are the ones where you can copy paths\names of selected items in the everything window when its in the back ground Without bringing it forward. these menu items also only show themselves when a EV window is open.

I created theses myself when I noticed that the top line of hidden text on a selected item is the files full path.
I thinks there's a way of using SDK to get this path..???? I haven't figured that out yet.

if your poking around back here you know how much you're able to do with everything.... Furthermore between everythings SDK and autohotkey there's more than one way to do it!

I'm a NOOB to programing & autohotkey, I know EVs SDK exists but not sure how to utilize it ... Yet. So go easy on my code. :lol:

anyway check it out. Save this code as EV Menu.ahk run it with https://autohotkey.com

the Hotkey to open the menu is Alt + 2

Code: Select all


#warn useenv, off
#Persistent
#SingleInstance, Force

sourceurl = https://www.voidtools.com/forum/viewtopic.php?t=15972
githuburl = https://github.com/indigofairyx
;-------------------------

; if EV is installed in a custom location the path needs to be defined here...

Everything15a = C:\Program Files\Everything 1.5a\Everything64.exe

Global Everything15a

If !FileExist(everything15a)
	{
	MsgBox, 4129, , Everything 1.5a was not found at its defualt install location.`n`n Click OK to edit this script where you can update the installed location., 15
	IfMsgBox Ok
		Edit
	IfMsgBox Cancel
		return
	}

return

!2::  ;; alt + 2 to show the everything menu
Showevmenu:
gosub evmenu
menu, ev, show
return

evmenu:
menu, ev, add
menu, ev, deleteall
Menu, ev, add, <--- Everything Menu --->, Showevmenu
; menu, ev, icon, <--- Everything Menu --->, %A_ScriptDir%\Icons\voidtools-14-Everything-White.ico,,28
menu, ev, icon, <--- Everything Menu --->, %everything15a%,,28
menu, ev, default, <--- Everything Menu --->
menu, ev, add, ; line -------------------------

menu, ev, add, Run Everything, runeverything
menu, ev, icon, Run Everything, %everything15a%
; menu, ev, icon, Run Everything, %A_ScriptDir%\Icons\voidtools-15-Everything-1.5.ico

menu, ev, add, Input Directory Search, EVDirSearch
; menu, ev, icon, Input Directory Search, %A_ScriptDir%\Icons\folder search find browse_256x256.ico

menu, ev, add, System Index Search [ Input ], EVSISearch
; menu, ev, icon, System Index Search [ Input ],%A_ScriptDir%\Icons\voidtools-07-Everything-SkyBlue.ico 

menu, ev, add, ; line -------------------------
menu, ev, add, Go EV AppData Folder, openevdata
; menu, ev, icon, Go EV AppData Folder, %A_ScriptDir%\Icons\settings checked Windows 11 Icon 26_256x256.ico

if WinExist("ahk_exe everything64.exe")
	{
		menu, ev, add, ; line -------------------------
		menu, ev, Add, <-- An Everything Window is Open -->, Showevmenu
		menu, ev, add, ; line -------------------------
		menu, ev, add, Full Path - Copy, evgetselected
		; menu, ev, icon, Full Path - Copy, %A_ScriptDir%\Icons\clipboard path 8bit xfav small RXResEnu_24_16x16.ico

		menu, ev, add, Dir Path - Copy, evgetselected
		; menu, ev, icon, Dir Path - Copy, %A_ScriptDir%\Icons\document copy p path FLUENT_colored_386_64x64.ico
		menu, ev, add, Name - Copy, evgetselected
		menu, ev, add, Copy Full Path of ALL Selected Items, evcopyallpaths
		menu, ev, add, Open Dir Path, evgetselected
		if FileExist("C:\Program Files\GPSoftware\Directory Opus\dopus.exe")
			menu, ev, icon, Open Dir Path, C:\Program Files\GPSoftware\Directory Opus\dopus.exe
		else
			menu, ev, icon, Open Dir Path, explorer.exe
	}
else
	{
	; show nothing... How will this refresh?? Hmmm
	}
menu, ev, add, ; line -------------------------
menu, ev, add, Close This Menu, CloseMenu
menu, ev, add, Quit\Exit App, exit
; menu, ev, icon, Close This Menu, %A_ScriptDir%\Icons\aero Close_24x24-32b.ico

; menu, ev, show
return

evgetselected:
DetectHiddenText, on ; the file path of selected item is hidden
WinGetText, selected, ahk_exe everything64.exe
if errorlevel
	{
		tooltip, Everything doesn't seem to be running.
		sleep 2000
		tooltip
		return
	}
RegExMatch(selected, "m)^(.*)$", selected) ;; match first line of captured string, if multiple items are selected ev still only reports the most recently clicked

if !RegExMatch(selected, ".*\\([^\\]+)\\?$", "$1") ; match a file path in captured hidden text, 
	{
		tooltip Everything is running thou nothing is selected.
		sleep 1500
		tooltip
		return
	}
; msgbox, %selected%

sleep 50
SplitPath, selected, filename, dir, ext, filestem, drive
; msgbox, selected: %selected%`n`n`nfilename: %filename%`ndir: %dir%`nfilestem: %filestem%`next: %ext%`n`nthismenuitem: %A_thismenuitem%`nthishotkey: %A_thishotkey%`nclip: %clipboard%
clipboard := ""
sleep 30
if (A_ThisMenuItem = "Full Path - Copy")
	{
		clipboard := selected
		return
	}
if (A_ThisMenuItem = "Dir Path - Copy")
	{
		clipboard := dir
		return
	}
if (A_ThisMenuItem = "Name - Copy")
	{
		Clipboard := filename
		return
	}
if (A_thismenuitem = "Open Dir Path")
	{
		run, %dir%
		return
	}
if (A_ThisHotkey = "$pause")
	{
		clipboard := selected
		return
	}
return

evcopyallpaths:
; testing, this label sends a hot to EV even if it's the background. I've set my own hot key for Copy Full Path. so this works thou you may need to change the hotkey sent below
ControlSend, SysListView321, ^+{p}, Everything 1.5
return

runeverything:
SetTitleMatchMode, 2
IfWinExist, Everything 1.5
{
	WinActivate, Everything 1.5
	;; // optional actions can be carried out when activating an existing window
	; WinWait, ahk_exe Everything64.exe,,7
	; if errorlevel
		; tooltip, Err. Couldn't launch everything.
		; {
		; sleep 1500
		; tooltip
		; return
		; }
	; soundbeep, 800,
	; Sleep 100
	; ControlSend, , ^{L} ;this activates the search bar if its not already selected
	; ControlFocus, Edit1, ahk_class EVERYTHING
	; Send, ^a

}
 else {
	Run, %Everything15a%
}
return

openevdata:
run, %appdata%\everything
return

EVSISearch:
InputBox, Search , Everyting SI Content Search via AHK, Search for the System Index for what..., , , , , , , ,
if (Search = ""){
	tooltip, Canceled`nA search string is required.
	sleep 1000
	tooltip
	return
}
sleep 200
run %everything15a% -newtab -s* si*: "%Search%"
Return

EVDirSearch:
InputBox, Search , Everyting Location Search via AHK, Search for what...`nEVs Syntax is sent from here.`nYou can pick a folder to search in the next popup.`nIf Left blank the whole folder will be displayed., , , , , , , ,
sleep 200
fileselectFolder, Location, , 2, Select a Location to find  " %Search% "  in.
if (Location = ""){
	tooltip Canceled - You did not select a valid Location
	sleep 1000
	tooltip
	return
	}
sleep 200
run %everything15a% -newtab -s* "%Location%" %Search%
Return

CloseMenu:
send, {esc}
return

exit:
exitapp
Return



NOTE! On the copy all menu items... This works for me. It mostly likely will not work for you. This item sends a hotkey to the everything window to "Copy Full Path" I set my hotkey for this action to Ctrl+ Shift + P.

It's been that for long I don't remember what or even if EV has a default key set to that.
To make that menu item work you can match that hotkey in everything's settings. Or change the hotkey sent to the window inside the script.
Post Reply