Anyway...
Which is why you dragged me back from the dead as usual to show you how it's done.nikos wrote:I saw that other FMs are embedding this Everything tool, I might consider it but wouldn't know how to go about it.
![Wink :wink:](./images/smilies/icon_wink.gif)
Well, to be fair, while this is a fully functional proof-of-concept for one small (but useful) aspect of integration, I'm not actually that much in favour of embedding Everything into x2 full-scale simply because it's not necessary. I will expound on that later on.
So, what is this and why would I want it?
The x2 option to "Calculate subfolders size automatically" seems like a good idea on the surface, but in practice has a few drawbacks... as the tooltip itself notes, it's "a major resource hog if enabled", slowing things down quite a bit when browsing around. Not to mention, in Nikos' "infinite wisdom" he disabled it on drive root folders, so it's not very practical - you have to hit <Ctrl+D> twice to force it, and then wait forever for it to tell you that your C:\Windows folder is 27GB in size. Yippee.
It's also not persistent - if you restart your computer (or even x2 sometimes) the foldersizes that it computed ten minutes earlier all have to be calculated again... and again... when you get up in the morning and crawl out of bed... again... and again...
"But what's to be done?", you cry, wringing your hands with the false modesty that only mock-desperation and first-world problems can provide, "And what's that Everything Search tool got to do with it? And isn't there already a 'Foldersize Shell Extension' which does the same thing?"
The Foldersize Shell Extension has a couple of faults - it is not persistent, its accuracy is questionable in situations where contents change rapidly, and there's just no user control about it. Sometimes it stubbornly shows what you know to be incorrect information, and just ignores refreshes. It's also been out of development for 20 years.
However, all is not lost. One of the useful things Everything Search can do when it's idling away its days in the background is to index foldersizes for quick reference later on. This index is both remarkably light-weight and quickly accurate for being updated in real-time, and, best of all, it's completely persistent so closing x2 or restarting your system won't cause any delays, it'll all reappear instantly..
For example, x2 tells me that my music-folder is 407.8 GB with 4980 subfolders and 37958 files. Yeah, that's 5,000 subfolders. x2 is a little grumpy about that when it comes to size-calculation - never mind that's already on a drive where other folders (in root) are commonly 1.4 to 2 terabytes in size. "Calculate this!" is what x2 says when confronted thusly - and it would no doubt accompany it with a rude hand gesture if x2 had hands. Or fingers. You get the idea.
Would you want your file-manager to flip you the bird? Probably not. So, I offer this small solution. The plugin itself is quite robust and has a few options (for those more curious souls) to play with.
Installation:
All you need is the x2 Plugin Manager (no installation required), and, of course, the plugin itself: SizeES v2.0.0.1
Please note that xplorer2 version 6.0.0.1 or above is required. If installed on older versions it will still load, but it won't actually do anything.
Due to significant changes, the older version of SizeES v0.0.0.3 is now officially legacy, but is still available to download here for anyone interested (it will still work properly for older x2 versions).
Instructions:
Extract the archive, run the plugin manager, then drag-&-drop either the 64-bit (WDX64) or 32-bit (WDX) plugin into the window and click "Apply".
Now this is where it's a little different from other plugins, you only need to use the normal Size [S] column from x2, though initially you'll want to activate the Status.ES [X] column as well which will essentially tell you whether or not it's all working correctly. Once you're sure it's working properly, you can just turn off Status.ES, it's only there to provide extra information in case of trouble.
There's a couple of extra steps to setup, but it's worth it, believe me.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Everything Search must be running in the background, recommended version 1.5.0.1380a or later. While the plugin will actually work with the older v1.4 version, there's no reason not to use 1.5 - don't let the "alpha" tag scare you away, it's quite stable and has been in development for a few years with frequent updates. The plugin will work whether Everything is "installed" or portable - it doesn't matter.
If running as a standard user account, the Everything Service must be installed, though this is not necessary if you are an Admin user.
If using the alpha-version, a preliminary step is necessary: Open Everything Search, and in the main search bar, type:
/alpha_instance=0 <Press Enter>
/restart <Press Enter>
Then, in the (Everything) menu-bar go to:
Tools -> Options -> Indexes -> Check both "Index Files" and "Index Folders", then click "Force Rebuild"
That's it. Just give x2 a quick refresh.
Troubleshooting:
Possible messages (displayed in the Status.ES plugin column):
Code: Select all
<Ok> - All is good, the ES index bridge is working and the foldersizes are incorporated by x2 into the native Size [S] column
<No IPC:n> - One of the installation steps was done incorrectly (most likely Everything isn't running)
<No Index> - If all folders display empty, "Index Folders" is probably unchecked in ES
<No Result> - ES was successfully called but didn't find an associated folder-index matching the search
<Disabled> - The INI option 'EnableIntegration' has been set to 0 instead of 1 so the plugin is effectively disabled
<x2 v6.0.0.1+ Required> - Self explanatory, it only works in v6.0.0.1 or above
<Illegal Plugin Name> - Most other plugins may be renamed (to change the column-suffix), but here ES.WDX[64] is mandatory
<Memory Fault> - If this were to ever actually occur, I would spontaneously combust into toasted marshmallows
When you start x2 there will be a temporary message displayed on the statusbar saying which version of Everything you're using, and/or if it's communicating with x2 correctly.
Keep in mind that obviously this isn't going to be as instantly fast to display as a normal x2 column, but it's quite fast nevertheless (the arithmetic mean averages out to around 6 milliseconds per folder reference). It's persistent (nothing needs to be recalculated if you restart x2 or your PC), and won't suffer long delays like x2's column used to do when computing in the background.
You said there were options? What are they?
Just open the SizeES.ini file (automatically created wherever you placed the plugin itself). You can also right-click the plugin in the plugin manager and select "Edit Plugin Settings". A restart of x2 will be required for changes to take effect.
Code: Select all
[SizeES]
EnableIntegration=1
OnErrorDeferRootFolders=0
OnErrorDeferNonRootFolders=1
StartupNotification=1
Random thoughts about integrating Everything Search and x2:
As I said originally, I don't see complete integration as being useful - for one thing, sticking a toolbar button on x2 to open Everything Search works just fine, and Nikos could (and should) never re-create the custom-built interface that already exists in ES. It would be nice to "automatically" transfer search results into a scrap-container for use in x2, but frankly, copy and paste (into a scrap) does the job - if not being very elegant.
Curiously, ES and file-managers share a common observation amongst their users: Most people only use about 1% of what the programme can actually do. Certainly, when it comes to Everything, people are always impressed with the speed - and it's true - at least when it comes to searching by name. But if you look behind that simple superficial stuff, ES is an amazingly well thought-out and powerful tool which is essentially hidden behind a command-line interface.
Much like Regular-Expressions... if you know how to use them, they are tremendously powerful - but if you don't, it's all just noise to the common user. Everything Search is a command-line paradigm's wet-dream of concision, accuracy, and elegance. But only to the user who takes the time to read the voluminous documentation of how to use it. For everyone else it's just a flashy and superficial "Wow, look at that" sort of experience, absent a true understanding of what's really possible.
Except for this folder size thingy. This bit was an obvious candidate to integration.
Technical Stuff:
As this now uses the native x2 size column, I obviously don't have any control over that display, so incorporating status messages (in case of misconfiguration or error) has to be done separately using the Status.ES [X] column. You only need to use this column if you are having troubles or suspect SizeES isn't working correctly - when finished, just turn it off.
To make things easier for the end-user, if the plugin cannot access the ES index for whatever reason, the column will just fall back to using its old slower routines for computation. This is both a good and a bad thing (you get the size either way), but it may not be immediately clear if it's working or not, unless you notice the column becoming very slow (which won't happen when SizeES is configured correctly).
To help with this, the INI includes the option 'OnErrorDeferNonRootFolders' which by default is set to '1' (enabled) which means x2 will kick-in and do it's thing. A good reason to disable this setting is that if anything were to go wrong with how ES is configured, it will become immediately obvious to the user as all foldersizes will be instantly shown as zero bytes, and you can then turn on Status.ES to see what may be wrong.
Note that x2 only calls the plugin for folder sizes, not file sizes - those are actually faster when handled natively, so the Status.ES column is blank for files.
Ordinarily, with a project like this, any integration with Everything's SDK would go through the distributed DLL the author provides as part of the kit, as the IPC (Inter-Process Communication) code depends on it. However, alternatively (with a little bit of editing) it can all just be monolithically compiled into your own program. That's what I did, so this plugin is stand-alone (as far as not needing the DLL). It does, however, require ES to be always resident in the background, but that's a normal part of ES's installation process to just sit in the tray anyway and is completely harmless. You don't even have to use it if you prefer other search programmes for whatever reason. Even though this plugin is constantly spamming ES as you browse, it won't interfere with anything you're concurrently doing in ES itself.
Please note that the plugin adds three columns into x2, Status.ES [X] (explained above), Reserved.ES [X] (for now it's the same as Status.ES), and the more curiously named uint64_t.ES [X]. This last one is just the bridge used so x2 can pick up the information from the plugin. You do NOT need to activate, select, use or view this column in any way, x2 does that automatically in the background.
The source-code is included, and it's easy enough to play with yourself if desired. Coincidentally, ES is written in C too, so take that you Bjarne Stroustrup fan-boy commies!
![Wink :wink:](./images/smilies/icon_wink.gif)