Command line search and open

General discussion related to "Everything".
Post Reply
jon_obvious
Posts: 2
Joined: Thu Oct 10, 2019 7:54 am

Command line search and open

Post by jon_obvious » Thu Oct 10, 2019 8:00 am

Hi

I can't figure out how to open a pdf once I search for it on the command line. Example:

Code: Select all

 -Command prompt-
R:\>es.exe z: *.pdf -highlight searched-file-name

Z:\searched-file-name-and-some-numbers.pdf
So now I want to open this .pdf file from the command line, how would I do that? Any suggestions would be appreciated.

Edit: To explain what I'm going for here.
I'm highlighting a string in a different program, then using autohotkey to trim the string, search it in everything, and opening the result. This involves a lot of "sleep" timers and doesn't always work out perfectly. I'm trying to do this without opening and focusing everything to avoid the sleeps so I want to try the Everything command line. Perhaps there is an easier way to approach this?

jon_obvious
Posts: 2
Joined: Thu Oct 10, 2019 7:54 am

Re: Command line search and open

Post by jon_obvious » Thu Oct 10, 2019 11:12 am

I noticed that everything has an "open file, close everything" hotkey so I used that instead. Saves a the step of installing es.exe and if the file isn't there, everything stays open to show that the file wasn't there. Autohotkey script:

Code: Select all

F8::				;open number as pdf
Clipboard :=""			;empty clipboard
Send, ^c 			;copy
ClipWait
StringTrimLeft, Clipboard, Clipboard, 3 ;trim first three
Send, {F3}			;open Everything hotkey, defined in Everything options
WinWaitActive, Everything, , 1
Send, ^v z: *.pdf 		;paste, filter Z drive and .pdf files
Send {Enter}
Send ^+{Enter} 			;open file and close Everything hotkey, defined in Everything options as crtl-shift-enter
Return

Post Reply