Some questions about ES Command Line Tool

General discussion related to "Everything".
Post Reply
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Some questions about ES Command Line Tool

Post by Stamimail »

I read the tread and have a few questions?

1. What is it good for? Why not to use the GUI? What does it let?
2. Why can't it be part of Everything.exe (using a switch like: everything.exe -es -size -dm -sizecolor 0x0d -dmcolor 0x0b)? Why has it to be a standalone EXE?
3. Since filenames can't include the character |, why must use ^ before | for escaping (es.exe *.jpg ^| *.png)?
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: Some questions about ES Command Line Tool

Post by therube »

What is it good for?
Command-line junkies.
To make it easier to use Everything in a more automated fashion (batch file type of thing, using Everything [es.exe] to find wanted files, that are then manipulated is some other fashion...).
Why can't it be part of Everything.exe
Suppose it could (& not knowing from a technical perspective).
filenames can't include the character |
But to the Windows command shell, |, does have meaning (pipe, generally), so you need to do something to tell cmd that the intended behavior is not to "pipe", but to be treated literally.

how to escape pipe symbol | in bat scripts?
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

Thank you.

I made a bookmark creating a custom Mp3 playlist.
I know there is no bookmarks support yet, so it means I need to write the whole bookmark content in the command to get my files list.
In general, after choosing the bookmark I do:
Ctrl+A > RightClick > Run/Play (Run/Play not Open)
All files sent and played by Windows Media Player.
How the bat will look like? How to Run/Play the results?
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

Why can't it be part of Everything.exe
It's possible, but es was chosen because it reduces bloat in Everything.exe and avoids complications of running Everything.exe as admin and es as non-admin.
ES started off as a Everything SDK/IPC test, adding es commands to Everything.exe would still require IPC, so it might as well stay seperated as two individual programs.
How the bat will look like? How to Run/Play the results?
makem3u8.bat:

Code: Select all

REM search for all aphex twin mp3s and export to a m3u8 file:
es aphex twin *.mp3 -export-txt aphextwin.m3u8
REM open the new m3u8 file:
aphextwin.m3u8
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

Thanks.
The code may be updated:
1. It seems W7 doesn't know m3u8, only m3u.
2. Add del for the temp file.
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

Just be aware that m3u only supports ANSI characters.
Everything exports as UTF-8, files with non-ASCII characters will not play. You will need m3u8 support to play these files.
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: Some questions about ES Command Line Tool

Post by therube »

Double click on the .m3u8, when Windows doesn't know what it to do, it asks, so -> Select a program from a list of installed programs, & choose WMP (or whatever program you're wanting to use).

(I'll assume that WMP should be able to handle that.)
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

void wrote:It's possible, but es was chosen because it reduces bloat in Everything.exe and avoids complications of running Everything.exe as admin and es as non-admin.
ES started off as a Everything SDK/IPC test, adding es commands to Everything.exe would still require IPC, so it might as well stay seperated as two individual programs.
In future, as a Plugin, would be better idea?
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

In future, as a Plugin, would be better idea?
ES.exe is already kind-of a plugin.
A plugin for Everything.exe to behave like ES.exe might work, like you said, Everything.exe -es which would probably end up calling ES.exe anyway.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

I just thought how the content of the portable ZIP will be looked like by default.
Simple users won't understand what is this ES.exe file.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

void wrote:Just be aware that m3u only supports ANSI characters.
Everything exports as UTF-8, files with non-ASCII characters will not play. You will need m3u8 support to play these files.
Yes you right.
Only now I had the time to test what we had discussed above, and I find:
1. ES.exe doesn't make it while Everything.exe is offline (not running)
2. ES.exe doesn't make it with Everything.exe -version-instance
3. ES.exe does make results in m3u file with the default Everything.exe running, but those results can't run in WMP (non-ASCII characters).
4. I opened the m3u file with Notepad, and did: File > Save As > ANSI > Save. Then run the m3u file, and all songs work with no problem.

So I understand I need the output as ANSI to run the m3u file.
How can I get this automatically?
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

1. ES.exe doesn't make it while Everything.exe is offline (not running)
ES uses the Everything IPC to search.
ES requires Everything to be running in the background to communicate with the Everything IPC.
2. ES.exe doesn't make it with Everything.exe -version-instance
Please use the same instance name in ES, for example:
es.exe -instance "1.4.1.817b"
3. ES.exe does make results in m3u file with the default Everything.exe running, but those results can't run in WMP (non-ASCII characters).
Yes, that was explained above.
One way to make it work is to change the current code page to 1252 (ANSI) and redirecting output to a m3u file:

chcp 1252
es *.mp3 > out.m3u
4. I opened the m3u file with Notepad, and did: File > Save As > ANSI > Save. Then run the m3u file, and all songs work with no problem.
Good idea, this will also work.
So I understand I need the output as ANSI to run the m3u file.
How can I get this automatically?
I've added -export-m3u and -export-m3u8 to ES 1.1.0.6.
-export-m3u <out.m3u> will output as ANSI.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

void wrote:Just be aware that m3u only supports ANSI characters.
Everything exports as UTF-8, files with non-ASCII characters will not play. You will need m3u8 support to play these files.
I made a test. I made 2 files:
ANSI.m3u
UTF-8.m3u
and tested in players: Windows Media Player, SMPlayer, VLC Player and Media Player Classic Home Cinema.
It was very interesting to find that:
WMP and SMPlayer can run ANSI.m3u but not UTF-8.m3u
VLC Player and MPC-HC can run UTF-8.m3u but not ANSI.m3u
One way to make it work is to change the current code page to 1252 (ANSI) and redirecting output to a m3u file:

chcp 1252
es *.mp3 > out.m3u
It took me a while to find I need to use chcp 1255 to make it work
https://en.wikipedia.org/wiki/Code_page ... code_pages
ES requires Everything to be running in the background to communicate with the Everything IPC.
I do probably something wrong. The following doesn't work for me. [Service enabled]

Code: Select all

chcp 1255
Start Everything.exe -instance "1.4.1.817b (x64)" -startup
es.exe -instance "1.4.1.817b (x64)"  cap *.mp3 > ANSI.m3u
ANSI.m3u
Everything.exe -instance "1.4.1.817b (x64)" -exit
exit
I get: "Everything IPC window not found, IPC unavailable."
Good idea, this will also work.
I don't know how to do this method it in a batch...
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: Some questions about ES Command Line Tool

Post by therube »

Good golly, this m3u stuff is wracking my brain. ... Ignore.

(
To start, you're not including the ... oh, you're using chcp rather then the built-in -export-m3u, -export-m3u8 switches.

I'm totally confused by all of this?

m3u

Code: Select all

M:\MUSIC\Sigur Ros\Von\03 - Hún jörð.mp3
m3u8

Code: Select all

M:\MUSIC\Sigur Ros\Von\03 - Hû¤n jûÑrû¯.mp3
)
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

I made a test. I made 2 files:
ANSI.m3u
UTF-8.m3u
Did you use -export-m3u for ANSI.m3u and -export-m3u8 for UTF-8.m3u?

The filename will have no effect, also the contents will not effect how the m3u is decoded.
The extension is the important part, and describes how the content is encoded.

m3u is always encoded using the Windows default non-unicode codepage.
m3u8 is always encoded as UTF-8.

Some players might try to be "smart" and detect UTF-8 in a m3u file.
It took me a while to find I need to use chcp 1255 to make it work
https://en.wikipedia.org/wiki/Code_page ... code_pages
m3u uses the system's default non-Unicode encoding.
ES -export-m3u will write the m3u with the system's default non-Unicode encoding.
I get: "Everything IPC window not found, IPC unavailable."
Everything hasn't started or finished loading yet, please set a timeout for ES to wait for Everything to start and load:
es.exe -instance "1.4.1.817b (x64)" -timeout 60000 cap *.mp3 -m3u > ANSI.m3u
I don't know how to do this method it in a batch...
You'll need a third party tool to convert code pages or use -export-m3u/-export-m3u8 with ES.
To start, you're not including the ... oh, you're using chp rather then the built-in -export-m3u, -export-m3u8 switches.
I'm totally confused by all of this?
-export-m3u will ignore the consoles code page and chcp setting, and always export as the system's default non-Unicode encoding.
-export-m3u8 will ignore the consoles code page and chcp setting, and always export as UTF-8.
-m3u AND -m3u8 will set ES to display the output as m3u in the consoles current code page, which can be changed with chcp.

-export-m3u is the preferred method, -m3u exists so you can pipe to other programs.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

As for the previous post I used the Save As... of Notepad to create ANSI.m3u (=ANSI) and UTF-8.m3u (=UTF-8)...

I used now for the following with the -export-m3u and -export-m3u8

It seems SMPlayer is the only Player that make a distinction by the extension (between .m3u and .m3u8) as Void described.
For .m3u it reads only ANSI
For .m3u8 it reads only UTF-8

The other Players read always as ANSI or UTF-8 no matter what the extension is:
WMP reads only ANSI, and can't run m3u8 (in Windows7)
VLC Player and MPC-HC read only UTF-8 (no matter what the extension is).

Another problems:
1. I couldn't use for searching with the grouping characters <> like: <D:\Users\User\Music>
2. I had to to use chcp (chcp 1255) and change the code page to be able to search with non-English characters.
3.
Use ^ to escape special command line characters, eg: escape | with ^|
Is there no trick to do just copy paste the content of the SearchBox? maybe something like ^(content of SearchBox)
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

1. I couldn't use for searching with the grouping characters <> like: <D:\Users\User\Music>
Use double quotes to escape < and >.
"<":\Users\User\Music">"
2. I had to to use chcp (chcp 1255) and change the code page to be able to search with non-English characters.
This is odd, before changing the code page, type chcp on its own:
chcp

What is the Active code page?
Is there no trick to do just copy paste the content of the SearchBox? maybe something like ^(content of SearchBox)
I couldn't find one.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

I've added -export-m3u and -export-m3u8 to ES 1.1.0.6.
I'm saying maybe it would be better to replace -export-m3u and -export-m3u8 with -export-ansi and -export-utf8, so that it will be:
-export-ansi file.m3u
-export-ansi file.m3u8
-export-utf8 file.m3u
-export-utf8 file.m3u8
Use double quotes to escape < and >.
"<":\Users\User\Music">"
Doesn't work for me.
What is the Active code page?
Active code page: 862
I couldn't find one.
:|
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

I'm saying maybe it would be better to replace -export-m3u and -export-m3u8 with -export-ansi and -export-utf8, so that it will be:
-export-ansi file.m3u
-export-ansi file.m3u8
-export-utf8 file.m3u
-export-utf8 file.m3u8
I would be breaking the m3u standard, something I shouldn't do just to make it work with certain players.
m3u is ANSI (local system's default non-Unicode code page), m3u8 is UTF-8.

A thought comes to mind, maybe your player is looking for a UTF-8 header?
Try exporting to m3u8 and opening the file with notepad and re-save it as UTF-8, see if that plays correctly with your player.
Use double quotes to escape < and >.
"<":\Users\User\Music">"
Was thinking of literal < and >

Please try ^<D:\Users\User\Music^>
Note: this doesn't work if you pass it through a bat file. (eg: es.bat: "es.exe" %* )
Active code page: 862
Only the characters in this code page will work:
https://en.wikipedia.org/wiki/Code_page_862

Can you confirm that characters in this code page are not searchable?
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

A thought comes to mind, maybe your player is looking for a UTF-8 header?
Try exporting to m3u8 and opening the file with notepad and re-save it as UTF-8, see if that plays correctly with your player.
In Save As of notepad I can see it's already set to UTF-8. Anyway, saving it again, and trying in the Players, I get the same result as without re-saving:
All Players can run this exported .m3u8 file except WMP (Windows7).
Please try ^<D:\Users\User\Music^>
Yes it works. But after that, I was trying to exclude folders in the same way, and for some reason for some Paths using ^< and ^> made trouble, so I replaced to "", and it worked.
ie: "D:\Users\User\Music" !"D:\Users\User\Music\Folder1toExclude" " !"D:\Users\User\Music\Folder2toExclude" !"D:\Users\User\Music\Folder3toExclude"
Can you confirm that characters in this code page are not searchable?
As been said, Hebrew letters couldn't be searched only by changing the code page:
chcp 1255

I can find that also in your reference:
Code page 862 was replaced by Windows-1255 in Windows 3.x and 9x systems, and later by Unicode in Windows NT onwards. It is now obsolete.
void
Developer
Posts: 16773
Joined: Fri Oct 16, 2009 11:31 pm

Re: Some questions about ES Command Line Tool

Post by void »

In Save As of notepad I can see it's already set to UTF-8. Anyway, saving it again, and trying in the Players, I get the same result as without re-saving:
All Players can run this exported .m3u8 file except WMP (Windows7).
Looks like WMP doesn't support UTF-8 m3us. Even with a BOM UTF-8 header.
Maybe support for Windows Media Player Playlist would help?
As been said, Hebrew letters couldn't be searched only by changing the code page:
chcp 1255
Can confirm it's not working here either, characters in the 128-255 code range are not translated correctly in code page 862. I think it's an issue with the command prompt.
While code page 862 may be obsolete, which may be the reason for the missing character translations, it is the closes code page to 437 for Hebrew, which may be the preferred code page for some old DOS programs.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Some questions about ES Command Line Tool

Post by Stamimail »

Maybe support for Windows Media Player Playlist would help?
I think it wouldn't be necessary, since I can do -export-m3u Playlist.m3u for running the exported songs in WMP.
Can confirm it's ...
BTW, there is other type of problem. For some reason, Microsoft didn't make the default Font in the CMD to be able to display Hebrew letters correctly (even in Hebrew OS...).
Here is the solution.
Post Reply