Search results to clipboard or a variable

Have a suggestion for "Everything"? Please post it here.
Post Reply
wetware05
Posts: 13
Joined: Wed Dec 21, 2022 5:09 pm

Search results to clipboard or a variable

Post by wetware05 »

Hi.

In the use of the command line utility (es.exe) the output can be to the screen or to a file. Can't output to the clipboard or a variable? (that the results remain resident in memory so that they can be used by other languages ​​such as AutoHotkey) If you don't have this possibility, it would be nice to implement it in future versions. The current option that can be used on output to a file, and from AutoHotkey to read the file. Two processes, when it could only be one.
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: Search results to clipboard or a variable

Post by NotNull »

Everything can't set environment variables.


What you *can* do is starting cmd from AHK with a command like
es.exe searchtext | clip

This way CMD will put the output on the clipboard.

Another alternative is to use the RunCMD AHK function to capture stdout to a variable.
therube
Posts: 4646
Joined: Thu Sep 03, 2009 6:48 pm

Re: Search results to clipboard or a variable

Post by therube »

Is this a different request from, Can variables be used from the command line function?


(And while we're here, Is there a benefit to be able to save ES results to an Environment Variable?)


Meanwhile, what I have done are things like:

@es.exe -instance 15 %* -export-efu c:\out\sssGO.efu !\Windows\Recent file:

Code: Select all

:: SSSL SjB 12-18-2022   Open an ES File List

:: SSS, but an entire File List rather then a singular file (as with sssgo.TXT)
:: this opens in a "static" version of Everything (rather then in the current...)


@echo off
start /B  cmd /C   "C:\DEV\Locate\15.filelist\Everything.exe"   -instance FILELIST  -read-only -no-db  -filelist C:\OUT\sssGO.efu

Code: Select all

:: SSSE SjB 12-18-2022

:: SSS, but an ES search
:: with the intent that it is a PROGRAM
:: so the START should EXECUTE the program...

@echo off
echo About to EXECUTE:
cat c:/out/sssgo.txt
pause

for /f "tokens=*" %%i in (c:\out\sssgo.txt) do   start /B CMD /C   %%i
wetware05
Posts: 13
Joined: Wed Dec 21, 2022 5:09 pm

Re: Search results to clipboard or a variable

Post by wetware05 »

Hi, NotNull.

From the command line
es.exe namefile | clip
works and therefore in a bat file. But in an autohotkey script the line
RunWait, es.exe namefile | clip
, does not produce any output (I have a clipboard manager and it warns me when a change has occurred, I think it "ignores" the parameter
| clip
)

I don't understand the terminology to use in RunCMD(), I don't know much about programming and the explanation given in the forum seems too cryptic to me.

Any suggestions?
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: Search results to clipboard or a variable

Post by NotNull »

Try it with

Code: Select all

runwait, %comspec% /c chcp 65001 & es.exe nemafile | clip
(this launches cmd and cmd executes es.exe nemafile | clip
When es.exe is finished, cmd will close (the /C parm takes care of that)

chcp 65001 takes care of special characters in filenames
wetware05
Posts: 13
Joined: Wed Dec 21, 2022 5:09 pm

Re: Search results to clipboard or a variable

Post by wetware05 »

Great NotNull, it works! :o

Thank you very much

(What does the symbol
&
?)
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: Search results to clipboard or a variable

Post by NotNull »

That is to specify multiple commands on one line: command 1 & command 2
(It is specific to CMD)
wetware05
Posts: 13
Joined: Wed Dec 21, 2022 5:09 pm

Re: Search results to clipboard or a variable

Post by wetware05 »

Thanks again NotNull. You have been a great help to me. Likewise your clear explanations. In the autohotkey help, although they use the /c parameter, they don't explain what it means, nor when to use it.
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: Search results to clipboard or a variable

Post by NotNull »

You're welcome! :thumbsup:



@therube:
therube wrote: Fri Dec 23, 2022 3:50 pm

Code: Select all

cat c:/out/sssgo.txt
What 'cat' do you use?
therube
Posts: 4646
Joined: Thu Sep 03, 2009 6:48 pm

Re: Search results to clipboard or a variable

Post by therube »

.bin.zip from, https://sourceforge.net/projects/gnuwin ... ils/5.3.0/.
(You'd also need, coreutils-5.3.0-dep.zip, for the two .dll's in there.)
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: Search results to clipboard or a variable

Post by NotNull »

Thanks!
(those DLLs were already included in the zip I downloaded, btw)

Turns out to be basically the same as the cygwin cat I have installed (only difference: cygwin is 64-bit).
wetware05
Posts: 13
Joined: Wed Dec 21, 2022 5:09 pm

Re: Search results to clipboard or a variable

Post by wetware05 »

NotNull wrote: Fri Dec 23, 2022 7:01 pm You're welcome! :thumbsup:



@therube:
therube wrote: Fri Dec 23, 2022 3:50 pm

Code: Select all

cat c:/out/sssgo.txt
What 'cat' do you use?
I don't understand "What 'cat' do you use?" what is cat in this context?
NotNull
Posts: 5298
Joined: Wed May 24, 2017 9:22 pm

Re: Search results to clipboard or a variable

Post by NotNull »

wetware05 wrote: Sat Dec 24, 2022 3:50 pm I don't understand "What 'cat' do you use?" what is cat in this context?
No worries, this was off-topic and meant for @therube as he often uses nifty little utilities that I was not aware of.

'cat' is a little program to "type" one or more textfiles to the screen with some extra formatting options.
therube
Posts: 4646
Joined: Thu Sep 03, 2009 6:48 pm

Re: Search results to clipboard or a variable

Post by therube »

cat (Unix)
Basic Cat Command Examples in Linux

In a basic sense, cat is like the Windows (command-line) TYPE command.

Code: Select all

Displays the contents of a text file or files.

TYPE [drive:][path]filename
Post Reply