Everything w/Autohotkey -- how to create a shortcut?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
the_fire_rises
Posts: 4
Joined: Sat Feb 22, 2025 5:24 pm

Everything w/Autohotkey -- how to create a shortcut?

Post by the_fire_rises »

hi voidtools forum! first time posting here. I absolutely love everything. I have question -- I currently have an autohotkey script that allows me to create a shortcut (via hotkey) to an file or folder I select. I'd like to extend this to everything, where I can be in the search window and create a shortcut of whatever I select. Unfortunately, I'm not that good with AHK. Would anyone here know by any chance how to modify this script to make it also work in everything?

F21::
Explorer_GetSelection(hwnd="")
{
hwnd := hwnd ? hwnd : WinExist("A")
WinGetClass class, ahk_id %hwnd%
if ((class="CabinetWClass") or (class="ExploreWClass") or (class="Progman"))
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
CurrentWindow := window.Document.SelectedItems
for item in CurrentWindow
{
SplitPath, % item.path,,,,OutNameNoExt
FileCreateShortcut, % item.path, % "C:\Users\Warb Null\Documents\Shortcuts\" OutNameNoExt ".lnk"
}
}
Return
Xavierarmand
Posts: 38
Joined: Fri Nov 24, 2023 12:19 am

Re: Everything w/Autohotkey -- how to create a shortcut?

Post by Xavierarmand »

I think I could make that work.

With everything there might be more than one way to get the info of the the selected item.

I made a menu for everything that l can see a single selected item in EV even when the window is in the back ground. Using detect hidden text on. Wingettest. The selected item is the 1st line of text.

Alternatively if everything is active u can assign a hotkey to copy the full path, then have AHK send the hotkey to copy and read\use the path from the clipboard.

I've a snippet of over here. Of the hidden text option. Which I prefer because it doesn't trash ur clipboard.

viewtopic.php?p=73083&hilit=Autohotkey#p73083

I'm away from my computer for a couple days. I'll see if I merger my snippet with ur link making snippet
the_fire_rises
Posts: 4
Joined: Sat Feb 22, 2025 5:24 pm

Re: Everything w/Autohotkey -- how to create a shortcut?

Post by the_fire_rises »

that would be nice -- please keep me updated!
Xavierarmand
Posts: 38
Joined: Fri Nov 24, 2023 12:19 am

Re: Everything w/Autohotkey -- how to create a shortcut?

Post by Xavierarmand »

put this in your script its working for me.

Code: Select all

#IfWinActive ahk_exe everything64.exe
; #IfWinExist ahk_exe everything64.exe ;; if you un-comment this line you can create this link of the selected item even if EV is in the Background
numpad1:: ;; change your hotkey here
EVgetselectedMakeLINK:
DetectHiddenText, on ;; the file path of EVselected is hidden
WinGetText, EVselected, ahk_exe everything64.exe ;; read the text in the EV Window
RegExMatch(EVselected, "m)^(.*)$", EVselected)
 ;; match first line of captured string, if multiple items are EVselected EV still only reports the most recently clicked
if !RegExMatch(EVselected, ".*\\([^\\]+)\\?$", "$1")
;; match a file path in captured hidden text, error check for when a window is open with nothing EVselected
	{
		EVselected := "Nothing is Selected"
		Tooltip %EVselected%
		sleep 1800
		tooltip
		return
	}
splitpath, EVselected, EVfilename,evdir,evext,evfilestem,evdrive
FileCreateShortcut, %EVSelected%, C:\Users\Warb Null\Documents\Shortcuts\%EVFileStem%.lnk
return
the_fire_rises
Posts: 4
Joined: Sat Feb 22, 2025 5:24 pm

Re: Everything w/Autohotkey -- how to create a shortcut?

Post by the_fire_rises »

Whoa! that worked! thanks friend. one question tho -- is it possible to modify the script so that I can highlight multiple items and create shortcuts of them all at once?
Xavierarmand
Posts: 38
Joined: Fri Nov 24, 2023 12:19 am

Re: Everything w/Autohotkey -- how to create a shortcut?

Post by Xavierarmand »

I'm sure it could be done. it would require some extra set up in everything's settings.

off the top of my head it would require copying all selected full paths to the clipboard and then using a Loop, Parse on each line in the clipboard... unfortunately I'm not sure yet how to properly loop and process a file list in AHK yet.
the_fire_rises
Posts: 4
Joined: Sat Feb 22, 2025 5:24 pm

Re: Everything w/Autohotkey -- how to create a shortcut?

Post by the_fire_rises »

No worries! I think this is good enough. I appreciate your help, it's been awesome!
Post Reply