Fast search with Everything (old version)

What does it do?

If you use David Carpenter's excellent Everything search utility then you are already familiar with the speed and flexibility of finding things anywhere on your fixed drives. It features a rich set of search terms and results are returned almost instantaneously. It also supports regex searches.

This script acts as a front end to Everything using its command line interface module <es.exe> to pass supplied search criteria. Results are imported to a Directory Opus collection and displayed in a new lister by default.

Installation

  1. If you don't already have Everything and es.exe installed download and install Everything 1.4 (see links below) and unzip es.exe to the same folder. (e.g. C:\Program Files (x86)\Everything\Everything.exe)
  2. Download the attached $es.js.txt and drag it to Preferences / Toolbars / Scripts then configure preferences under Settings / Preferences /Scripts along the lines shown in the screen grab.

$es.js.v1.7.txt (18.9 KB)


History

v1.0 February 29th, 2016
v1.1 March 1st, 2016 - Fix switchesonly routine loop to start from 0, not 1.
v1.2 March 2nd, 2016 - Fix resolution of tmp_cmd and tmp_out.
v1.2 March 2nd, 2016 - Replace switchesonly with generic allinset routine.
v1.3 March 8th, 2016 - Use /appdata instead of /homeroot for tmp_cmd and tmp_out.
v1.3 March 8th, 2016 - Add __promptuser and __viewnewest switches and associated code.
v1.4 March 10th, 2016 - Add __update switch.
v1.4 March 10th, 2016 - Allow layout of collection columns via script configuration.
v1.4 March 10th, 2016 - Make temp file location configurable. Default to /temp if not configured.
v1.4 March 10th, 2016 - Extend placement default to disable all panels - e.g. tree, viewer, etc.
v1.4 March 10th, 2016 - Add default post DOpusRT delay and ability to adjust via script configuration.
v1.5 March 11th, 2016 - Fix missing comma before "norm" in def_placement.
v1.6 March 14th, 2016 - Use codepage 1252 to handle non-ASCII characters in file names.
v1.7 February 15th, 2017 - Repair invalid d.func.command.results.newtabs(0).tabs(0) statement
v1.7 February 15th, 2017 - Add Code Page configuration option

Notes

I am aware that in many ways this script duplicates @apocalypse's SearchEverything command. (see SearchEverything: Getting Opus to work with Everything) However a large part of my motivation for writing it was as a learning exercise and in that context it has succeeded for me at least.

Sample button commands:

  1. $es
  2. $es "/profile\dropbox" file: dm:thismonth
  3. $es "/mydocuments" file: dm:thisweek <*.jpg|*.png>
  4. $es file: dm:thisyear monthly ext:xls;doc
  5. $es file: dm:thisyear monthly ext:xls;doc -p
  6. $es file: dm:thisyear monthly ext:xls;doc -w
  7. $es -r v[23].[0-9].+xls __promptuser
  8. $es "/appdata" ext:log __viewnewest

(1) Will prompt the user to modify a default set of search arguments. Default search arguments are set in Preferences.
(2) For normal (non-regex) searches, aliases are resolved. This example will list all dropbox files modified this month.
(3) Search keys can be grouped using <> brackets. This will list all JPG and PNG files in My Documents modified this week.
(4) This will list all files modified this year which include the string "monthly" and an extension of XLS or DOC in the name.
(5) This will list all files modified this year which include the string "monthly" and an extension of XLS or DOC anywhere in the filepath.
(6) This will list all files modified this year which include the word "monthly" and an extension of XLS or DOC in the name.
(7) Use the -r keyword to enable regex. This example will list files like C:\Projects\Myproj v2.3.xls. The __promptuser switch will prompt the user to modify the supplied regex.
(8) This will list all LOG files in %APPDATA% and show the most recent log file in the viewer pane.

  • When fired from a button, use the shift modifier to force a prompt.
  • By default every successful search ovewrites an existing collection. Use the ctrl modifier to force append.


Demo $es command menu

$es Demo Menu.dcf (1.47 KB)

In Customize mode drag this dcf file to a toolbar to add several sample $es buttons.

Links

Regards, AB

2 Likes

Updated to v1.1 to fix a coding bug in the switchesonly function.

Regards, AB

Updated to v1.2 to fix a coding bug that would cause the script to fail on first use. :blush:

Regards, AB

Your original post mentions "C:\Program Files (x86)\Everything\Everything.exe" as a path. Does this mean I need to download the x86 version of Everything or can I be a 64-bit snob and download the 64-bit version. I realize there's probably little performance difference between the two.

Either version of Everything should be fine. The script just needs to know where to find its command line interface module es.exe which you download separately from the installer package. You can put es.exe anywhere you like and then point to it via the script configuration def_espath. My preference is to keep it together with Everything.

Regards, AB

Downloaded and installed main Everything program, es.exe, and es.js file...

But I don't know how to add it to my main interface. Is it supposed to show up as just $es in the name of the button if I drag it from Customize's "scripts" list onto a toolbar?

I can do that. I just want to make sure I'm doing it right. (I've never installed a script.)

$es is the name of the command the script adds to Opus; you can add a button to run that command the same way as any other command.

Now that $es.js is installed you can create buttons to invoke the script and you can also run the script via an immediate command. To do the latter as a quick test, just type >$es and you should see a command window pop up. Press ENTER to execute the command.


To create a sample button, save the attached DCF (button command definition) then Settings --> Customize Toolbars and drag the saved file to a toolbar. Once you exit customise mode just click the button on the toolbar. The test command it executes is shown below. It should create a collection of all files modified in "My Documents" within the last two weeks.


Regards, AB

$es _mydocs_recent.dcf (278 Bytes)

Thanks, Jon and aussieboykie. I'll play with it.

March 8th, 2016. Updated to v1.3.

Now uses /appdata for temp files instead of /homeroot which can cause access denied problems on some systems.
Added __promptuser and __viewnewest switches. Sample usage:

[ol]
[li]$es "/mydocuments" file: dm:thisweek <.jpg|.png> __promptuser[/li]
[li]$es "/appdata" ext:log __viewnewest[/li][/ol]
[ol]
[li]Will prompt the user to edit the supplied string.[/li]
[li]Will list all LOG files in %APPDATA% and show the most recent one in the viewer.[/li][/ol]
The root post now includes a menu with several $es demo buttons. This can be dragged to a toolbar in Customize mode.

Regards, AB

Just curious, why the leading underscores in your new switches?

Same reason as the $ signs before the command names? :slight_smile:

I had quite a few user commands written before the advent of VB/JS scripting support so the $ prefix was initially a visual means of identifying scripts which then became a habit. $es is the first time I have really explored the flexibility of using a /m (multi) variable. I initially wanted to eschew /s switches altogether so I could just pass any stream of arguments without any danger of crossing paths with a named switch. When I later decided that some switches might be handy I thought I would use an unlikely prefix to minimise the risk.


Regards, AB

March 10th, 2016. Updated to v1.4.

[ol]
[li]Added __update switch.[/li]
[li]Allow layout of collection columns via script configuration.[/li]
[li]Make temp file location configurable. Default to /temp if not configured.[/li]
[li]Extend placement default to disable all panels - e.g. tree, viewer, etc.[/li]
[li]Add default post DOpusRT delay and ability to adjust via script configuration.[/li][/ol]
[ol]
[li]Example: $es ext:ocb dm:today __update will append the results to an existing Everything collection.[/li]
[li]You can now configure your preferred columns and column order. e.g. modified,sizeauto,name,path. If you leave the field blank your normal default Collection format will apply.[/li]
[li]The location of temp files is now configurable.[/li]
[li]The placement default (see root post) disables tree, viewer, utility panel, etc.[/li]
[li]The Everything collection is created or updated using DOpusRT. In some situations a short delay is required to make sure that subsequent internal commands complete successfully. The default of 250ms works well for me.[/li][/ol]
Regards, AB

March 15th, 2016. Updated to v1.6.

[ol]
[li]v1.5 fixed a missing comma before "norm" in the def_placement definition.[/li]
[li]v1.6 Uses codepage 1252 to handle non-ASCII characters in file names.[/li][/ol]
Regards, AB

I'm using DOpus 11.18 and it didn't like $es.js.v1.6.txt as a filename for dropping onto the Preferences -> Scripts pane.

Also, note, since '$' is a reserved character in URI spec, this gets downloaded as %24es.js.v1.6.txt. I first renamed it to $es.js.v1.6.txt only to find it doesn't work. Then I renamed it to $es.js.txt and it worked. Since the '$' bugs me and makes no sense at all, I'm going to remove it anyway. :smiley:

Thank you for this great script.

Glad you like the script. Maybe when (if) there is another update it will be a good time for me to move on from the $ prefix thing. :smiley:

Regards, AB

Thanks you very much, this is a very useful script, and it is exactly what I need. :slight_smile:

The script seems to work fine except several cases:

1) When I use NEWTAB in def_placement it returns this:

 14.02.2017 9:39 $es:  info(1): Original command line = $es test
 14.02.2017 9:39 $es:  info(1): es.exe located in C:\Program Files\everything\es.exe
 14.02.2017 9:39 $es:  info(1): promptuser = false
 14.02.2017 9:39 $es:  info(1): updatecoll = false
 14.02.2017 9:39 $es:  info(1): updatecoll = false
 14.02.2017 9:39 $es:  info(1): Search Criteria = test
 14.02.2017 9:39 $es:  info(1): Transformed search criteria = test
 14.02.2017 9:39 $es:  info(2): tmp_path = C:\Users\User\AppData\Local\Temp
 14.02.2017 9:39 $es:  info(2): (runshell): tmp_cmd = C:\Users\User\AppData\Local\Temp\$es.cmd
 14.02.2017 9:39 $es:  info(3): DOpusRT import command = /home\dopusrt.exe /col import /clear /create everything "C:\Users\User\AppData\Local\Temp\$es.out"
 14.02.2017 9:39 $es:  info(3): cmdstring = Go Coll://Everything NEWTAB USEQUALKEYS
 14.02.2017 9:39 $es:  Error at line 215, position 51
 14.02.2017 9:39 $es:  Object doesn't support this property or method (0x800a01b6)

  1. When symbols from Western European charset are used for search query nothing happens:
 14.02.2017 9:48 $es:  info(1): Original command line = $es prüfung
 14.02.2017 9:48 $es:  info(1): es.exe located in C:\Program Files\everything\es.exe
 14.02.2017 9:48 $es:  info(1): promptuser = false
 14.02.2017 9:48 $es:  info(1): updatecoll = false
 14.02.2017 9:48 $es:  info(1): updatecoll = false
 14.02.2017 9:48 $es:  info(1): Search Criteria = prüfung
 14.02.2017 9:48 $es:  info(1): Transformed search criteria = prüfung
 14.02.2017 9:48 $es:  info(2): tmp_path = C:\Users\User\AppData\Local\Temp
 14.02.2017 9:48 $es:  info(2): (runshell): tmp_cmd = C:\Users\User\AppData\Local\Temp\$es.cmd

or from Cyrillic charset

 14.02.2017 9:55 $es:  info(1): Original command line = $es проверка
 14.02.2017 9:55 $es:  info(1): es.exe located in C:\Program Files\everything\es.exe
 14.02.2017 9:55 $es:  info(1): promptuser = false
 14.02.2017 9:55 $es:  info(1): updatecoll = false
 14.02.2017 9:55 $es:  info(1): updatecoll = false
 14.02.2017 9:55 $es:  info(1): Search Criteria = проверка
 14.02.2017 9:55 $es:  info(1): Transformed search criteria = проверка
 14.02.2017 9:55 $es:  info(2): tmp_path = C:\Users\User\AppData\Local\Temp
 14.02.2017 9:55 $es:  info(2): (runshell): tmp_cmd = C:\Users\User\AppData\Local\Temp\$es.cmd

3) When symbols from Japanese charset are used for search query the script returns this error:

 14.02.2017 10:00 $es:  info(1): Original command line = $es 試験
 14.02.2017 10:00 $es:  info(1): es.exe located in C:\Program Files\everything\es.exe
 14.02.2017 10:00 $es:  info(1): promptuser = false
 14.02.2017 10:00 $es:  info(1): updatecoll = false
 14.02.2017 10:00 $es:  info(1): updatecoll = false
 14.02.2017 10:00 $es:  info(1): Search Criteria = 試験
 14.02.2017 10:00 $es:  info(1): Transformed search criteria = 試験
 14.02.2017 10:00 $es:  info(2): tmp_path = C:\Users\User\AppData\Local\Temp
 14.02.2017 10:00 $es:  info(2): (runshell): tmp_cmd = C:\Users\User\AppData\Local\Temp\$es.cmd
 14.02.2017 10:00 $es:  Error at line 380, position 33
 14.02.2017 10:00 $es:  Invalid procedure call or argument (0x800a0005)

For some reason the head post is not showing up as editable so I can't post an updated version with a fix for NEWTAB. If you are OK to do this yourself, edit line 215 and remove .tabs(0) from the end of the statement. The revised statement should be:

else if (0<d.func.command.results.newtabs.count) d.func.command.SetSourceTab(d.func.command.results.newtabs(0));

With that fix in place, >$es prüfung worked for me.

Regards, AB

Editing of old posts isn't enabled yet on the new forum, but will be once we get to organising the downloads area. Hopefully this week.