$exec via temporary filelists?

General discussion related to "Everything".
Post Reply
meteorquake
Posts: 627
Joined: Thu Dec 15, 2016 9:44 pm

$exec via temporary filelists?

Post by meteorquake »

I'm not sure if everything currently covers this, but a lot of programs accept filelists, and what would be ideal for some things I do would be that with a single invocation (which a shortcut key can be assigned to) Everything would take the current results and/or selection, save it/them as filelist(s) with a temporary name after the pattern of your choice, then launch the desired program with them as parameters.
So something like -
$filelistfromresults("r:\filelistres-<ts>.txt") $filelistfromselection("r:\filelistsel-<ts>.txt") $exec("theprogram.exe" -somesetting=2222 -filelist="%r" -selected="%s") $deletefile("%r") $deletefile("%s")
in the above the filelists would be eg r:\filelist-2025-05-29-08-11-56.txt
when created they are noted for the next usage of %r (results) or %s (selection) and so the program is able to be launched with $exec with the results filelist and also the currently selected items
finally the example gives the case where the temporary filelists are then cleaned up but not strictly necessary
(there are other ways it could be arranged but with the basic gist the same, for example it could be that %r creates a temporary list automatically, however I'm thinking $filelistfromresults would have various independent uses).

David
therube
Posts: 5711
Joined: Thu Sep 03, 2009 6:48 pm

Re: $exec via temporary filelists?

Post by therube »

I'll do similar, but most often starting from command-line, & with ES.exe.
I write outputs to a temporary file, then run separate batch files on said outputs.

(You've got to watch my goto:'s below, as they may jump over seemingly incoherent code parts ;-).)


SSS.bat to gather results & output it to a temporary file:

Code: Select all

@echo off
SET XES=%*
es.ex2  -instance 15  -name  -highlight  distinct:  audio:  %*  -p   !I: !H:   -no-result-error
:: pause
:: echo %*
:: pause
:: es.ex2  -instance 15                     distinct:  audio:  %*  -p   -double-quote -n 1 > c:\out\sssGO.TXT


:: if no results found, no need to do anything more, duh!
@if NOT %errorlevel% EQU 0 goto end:


@es.ex2 -instance 15                                        %*  -p   -export-efu  c:\out\sssGO.efu  !\Windows\Recent  file:
@es.ex2 -instance 15                                        %*  -p   -export-m3u8 c:\out\sssGO.m3u8 !\Windows\Recent  file: distinct:name video:   !I: !H:

:: WRONG
:: in order for "unicode chars" to be recognized (correctly, i.e., played)
:: in mplayer/mpv.net, you have to include a "BOM" mark(er) in the file !!
:: WRONG
:: @es.ex2 -instance 15                                        %*  -p   -export-m3u8 c:\out\sssGO.m3u8 !\Windows\Recent  file: distinct:name video:  -utf8-bom
pause

:: cat c:/out/sssGO.TXT
pause

goto end:


for /f "tokens=*" %%i in (c:\out\sssgo.txt) do cmd /c start C:\WLIB\PLAYERS\MPlayer\MPUI.exe %%i
pause

:end
And various ways, programs I may open said data.

In this case, the "file list" is opened by my default (OS) media player (mplayer):

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...)


goto audio:
@echo off
START ""           "C:\DEV\Locate\15.filelist\Everything.exe"   -instance FILELIST                          C:\out\sssGO.m3u8
PAUSE


:audio
START ""           C:\out\sssGO.m3u8
pause
And here, I call an alternative player (mpv.net):

Code: Select all

:: m3uM SjB 05-13-2024   Open an ES File List (aka .m3u, in this case) && open in mpv.net (rather then default player, MPlayer)

:: SSS, but an entire File List rather then a singular file (as with sssgo.TXT)



START ""           C:\WLIB\PLAYERS\mpv.net-71\mpvnet.exe C:\out\sssGO.m3u8
PAUSE

And some stuff I've mess with in the past.

SSSLX.BAT:

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...)

:: use start "", rather then start /B cmd /C - which only worked when existing Everything Window was already open AND %XES% contained "", XES=cat "yellow stripe"
:: 02-03-2023 thank you, notnull


@echo off
START ""           "C:\DEV\Locate\15.filelist\Everything.exe"   -instance FILELIST  -new-window        -s*  %XES%
PAUSE


goto END:



                   "C:\DEV\Locate\15.filelist\Everything.exe"   -instance FILELIST  -new-window        -s*  %XES% - 01-15-2023
start /B  cmd /C   "C:\DEV\Locate\15.filelist\Everything.exe"   -instance FILELIST  -new-window        -s*  %XES% - 12-18-2022



WITH e, alone
	
	everything.exe -s* ...

	E does not work on INITIAL open - period, regardless of quotes, regardless of %XES%
	E on initial open, does not return to prompt UNIL E is close - PERIOD.
	E, alone does not work - PERIOD.

	- when i use SSSLX (X typically means a 2nd or later window),
	  i had always SSSL, FIRST. SSSL /does/ use start /b cmd /c,
	- if done that way, with SSSLX then opening as a 2nd or later window,
	  /if done that way/, SSLX can work "nakedly" - without the need for a start or anything like that, so simply; everything.exe..., is fine

	the only reason for SSSL vs SSSLX is whether the search opens in existing, or in a new window

	so... E alone simply does not work in SSSLX (as initial open)
	      quoting of E or %XES% (aka, the /search string/) is immaterial


WITH start /b cmd /c everything.exe ...

	no quotes
	not E, not XES - OK
	
	quotes
	E quote,   xes noquote - OK
	E quote,   xes   quote - FAIL <-------
	E noquote, xes noquote - OK
	E noquote, xes   quote - OK

WITH start "" everything.exe ...

	no quotes
	not E, not XES - OK
	
	quotes
	E quote,   xes noquote - OK
	E quote,   xes   quote - OK <---------
	E noquote, xes noquote - OK
	E noquote, xes   quote - OK




:END
SSSG.bat

Code: Select all

@echo off
for /f "tokens=*" %%i in (c:\out\sssgo.txt) do cmd /c start C:\WLIB\PLAYERS\MPlayer\MPUI.exe %%i
efu.bat:

Code: Select all

:: efu.BAT SjB 07-18-2024
:: open an Everything .efu (an essentially STATIC representation of a set of files)

C:\out\sssGO.efu
efuL.bat:

Code: Select all

:: efuL.BAT SjB 07-18-2024
:: open an Everything .efu[LIVE] (a LIVE [rather then STATIC representation] list of filenames, gathered from a list of names in a file, of which a .efu fits the bill ;-)

C:\DEV\Locate\15.1383\Everything.exe -instance 15 -new-tab  -search-file-list  C:\out\sssGO.efu
efuLL.bat:

Code: Select all

:: efuLL.BAT SjB 07-18-2024
:: open an Everything (GUI) /search/ using the last set search string (already generated, as it is, as the variable, %XES%, from withing ES.bat & SSS.bat)

C:\DEV\Locate\15.1383\Everything.exe -instance 15 -new-tab  %*  -search* %XES%

SET XES=%*
:
At some point I was writing outputs to a (Windows) environment variable, which I could then reference, & while that worked, it was rather limited (in output lengths & such), so I switch over to outputting to temporary files.
meteorquake
Posts: 627
Joined: Thu Dec 15, 2016 9:44 pm

Re: $exec via temporary filelists?

Post by meteorquake »

It sounds like you are working with audio there.
I would use it to launch the Everything results as a filelist in a graphics viewer, ideally just by hitting a shortcut key in Everything.
Looking more extensively it could be that $filelistfromresults by being a flat filelist is a simplified version of a hypothetical $exportresults which could be a bit more sophisticated by indicating columns and format etc, useful for programs that want a more specialised format. But something simpler done quickly and easily is a good starter, with a more complex function then coming later.
David
Post Reply