SearchEverything: Getting Opus to work with Everything

The following code works


#SingleInstance, force
; SearchEverything Wrapper by Devocalypse
; Uses CMDRet by corrupt (http://www.autohotkey.com/forum/viewtopic.php?t=3687)
if 0 < 1
{
    Run,C:\Program Files\Everything\Everything.exe
    ExitApp
}
everythinges = C:\Program Files\Everything\es.exe
cmdstring = "%everythinges%"

Loop, %0%
{
    param := %A_Index%
    IfInString, param, %A_Space%
  {
   cmdstring = %cmdstring% "%param%"
  }
else
  {
    cmdstring = %cmdstring% %param%
  }
}
results := CMDret(cmdstring)
Loop, parse, results, `n
{
if A_LoopField
   {
    RunWait,"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd Copy TO="coll://Everything" COPYTOCOLL=member FILE="%A_LoopField%",,Hide
    clipboard = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd Copy TO="coll://Everything" COPYTOCOLL=member FILE="%A_LoopField%"
   }
}
CMDret(CMD)
{
  VarSetCapacity(StrOut, 1000000)
  RetVal := DllCall("C:\Program Files\GPSoftware\Directory Opus\Apps\cmdret.dll\RunReturn", "str", CMD, "str", StrOut)
  Return, %StrOut%
}

Now trying to make it independent from actual installation path.

1 Like

I know I should have made the paths absolute but i decided against it for better portability if you export to a USB.

You changed the correct paths. I do not see a reason for it not to work. The only possible explanation could be if you run it as a script instead of a compiled executable. I will test a few scenarios and let you know what i find out.

Edit: It seems the working directory is the problem. I will rewrite the ahk source to use the Script Dir and get dopusrt path from registry. Expect a new version within an hour or two.

Edit2: Updated to version 1.2. It seems there is no proper path in registry under HKLM or HKCU for Dopus and since "Everything" is portable there is no foolproof way to find these paths so you have to manually specify the paths in SearchEverything.ini contained in the version1.2 rar.
Note: Do NOT add a trailing slash \ after the paths

hi apocalypse,
i am trying to get your little tool to work, but something isn't working. i am only getting this output "Everything IPC service not running." how do i run the ipc service? i can't find any info about this problem.

thanks neophite

[quote="neophite"]hi apocalypse,
i am only getting this output "Everything IPC service not running." how do i run the ipc service?[/quote]

I checked and I get the exact same output when Everything.exe is not running in the background. This is just a fronted for it so it needs to be in the taskbar or system tray, besides database updates cannot happen if Everything is not running.

There is a possibility to start it just for the duration of the search but that would be beyond the point of having fast results. If you press the search button and then don't enter anything as a search term and hit ok it will start everything.exe itself.

hi apocalypse
everything was running, but i forgot to start it with admin rights :unamused: after doing that everything works fine...
i hope you / the dopus developers find a solution for the collection import.
btw great addon for 2 great programs :smiley:

I'm not an Opus developer, so I caution you to tread carefully with what I'm about to suggest. (Be sure to back up your Opus configuration before you try anything.)

Opus file collections are just plain text XML files named with a .col extension. So you should be able to you to create them externally from Opus, provided you get the content schema correct. From what little I know of this, there are a couple of issues you need to workaround.[ol][li] Certain meta data is stored for each file as an attribute for that file's element inside the .col file. Many of these attributes are not stored as plain text or decimal values.

The fields I see in my .col files are:[ul]
[li] access[/li]
[li] create[/li]
[li] modify[/li]
[li] attr[/li]
[li] size[/li][/ul]

I do not know if this is the extent of all meta data stored inside of a .col file, or if it is related to my Collections default format.

I believe size is stored as the number of bytes in octal format; thus, the file element for a file that is 26 bytes, would have an attribute of size="32". I do not know how the date/time fields are stored (access=, create=. modify=), nor the attributes (attr=).

For what it is worth, I have tried creating a collection .col file with no meta data for any files. The resulting file collection in Opus will show all the files with 0kb size and the date/time stamps fields will all be blank, et cetera. Opus doesn't seem to hang or anything on such lack of meta data. However, a collection with only file names and paths may be of little or no value.

Like I said , I'm not an Opus developer, so this is all just what I have gleaned from my own observations.
[/li]
[li] As you may already be aware the .col files can be copied to your /dopusdata\Collections folder, after which you must restart Opus before the new collections take effect.

This thread has some relevant discussion.[/li][/ol]

Hopefully this helps you some.

Thank you for the insight Kenneth.
I am aware of the location of the collection files and their xml schema. The problem is mainly that you have to restart dopus after editing any of those files before the changes are read by it so it becomes a problem. AFAIK there is no way to load or reload a collection with a command within opus without having to restart.

Concerning the metadata i think it only appears in special collections such as find duplicates or search results.

I made an experiment with a custom collection and copied some random files' paths to it. Restarted dopus and all the columns were correct. That is version 9.51 though so I am not sure about the older ones. I'm trying now to invoke some way of refreshing the collection from within dopus and will keep you posted with my progress.

Hi apocalypse,

now it works perfectly. Thank You.

Regards
xbprm

apocalypse,

This is the best tool I've found all week!

Thanks again.

Paul

Thank you for this guide apocalypse, however I do have a question about the behaviour of the Z-ExploreFile command.
In Everything v1.2.1.451a, if I use the 'Open Path' command on a folder, it opens the actual folder that has been selected not the directory that contains it.
Is there any way to get it to work such that DOpus will go to the directory containing the folder and select the folder?

Thanks again for this guide, it's been most helpful.

In

Go PATH="&filename&"
Select PATTERN="&filename&"

Idea was that when you pass a filename (not a foldername) dopus opens its parent folder regardless of that it's a file and not a folder path and then the command is issued to select the file.

It's not the case with archives and folders it seems. I'll have to write a script to intercept and split the path and then pass the parent path and the filepath / foldername or understand the cryptic everything.ini more and find a way to pass both arguments from there.

After some testing heres the AHK code:[code]
#SingleInstance, ignore
#NoTrayIcon

if 0 > 1
exitapp
if 0 < 1
exitapp
else
argpath = %1%

dopusdir = YouDopusFolder

SplitPath, argpath , filename, dirname, extension, namenoext
Run, "%dopusdir%\dopusrt.exe" /cmd Z-Everything FILENAME="%filename%" DIRNAME="%dirname%"
exitapp
[/code]
Command Code: [code]

<?xml version="1.0"?> Z-Everything Launch Lister and Focus File dirname,filename,filepath #cli Go PATH="&dirname&" Select PATTERN="&filename&" DESELECTNOMATCH [/code] Everything INI code:[code] open_folder_path_command=$exec("folder_where_you_put_it\ExploreFolder.exe" "%1") [/code]

This works good in general BUT here comes a BIG problem:
dopus SELECT always interprets the pattern as the dreaded Pattern Matching Syntax suggests so that if your filenames have characters like [ ] ( ) # ~ they get intepreted as operators and not as filenames and nothing gets selected.

I tried search and replace within the script but the escape character poses a problem for the commandline which gets passed to opus afterwards, I mean why the hell use ' when you can use backslash or ` as in every common language.

We need a simple /selectfilepath command which works on the entire filename as windows explorer does (explorer.exe /select,) or a way to switch the useless pattern matching syntax off)

Thanks for the guide, unfortunately I use the characters that you pointed out quite a bit so it's probably best for me to stick with the original command.

Have downloaded SearchEverthing portable version and extracted in F:\Everything.

How to make it work with DO ?

thanks

SearchEverything: Getting Opus to work with Everything

[quote="apocalypse"]

Before I start you will need both everything and the Everything Command-line Interface (es.exe) in the same folder (ex. Program Files\Everything). So if you dont have them, get them here.[/quote]

What is the difference of everything and "the Everything Command-line Interface". Sorry for the question apocalypse, cause I am a new user of Directory Opus... I really need to learn and undergo different tutorials to interact with DOpus features.

Thanks in advance,
JMcGrey

One is a GUI and the other is a CLI.

One is a GUI and the other is a CLI.[/quote]

I still don't get it! Can you refer me a thread which start the topic of GUI and CLI in this forum, but i will try to read the post in the link you provided. Thanks

Explaining GUI and CLI is beyond the scope of this article. To get Search Everything to work just follow these steps:
[ul]
[li]Visit: voidtools.com/download.php[/li]
[li]Download Everything-1.2.1.371.exe or Everything-1.2.1.371.zip (portable)[/li]
[li]Download es.exe[/li]
[li]Install Everything or Extract it in some folder if you're using the portable version.[/li]
[li]Put es.exe where everything is installed / extracted.[/li]
[li]Follow the instructions on top of this thread, plain and simple.[/li][/ul]

[quote="neophite"]i am only getting this output "Everything IPC service not running." how do i run the ipc service? i can't find any info about this problem.[/quote] I've encountered the same problem using ES.exe.
Everything.exe is running. But it's really impossible to use ES.exe started with admin rights. Such launch results it output streams that can't be directed into files and so are useless. How one can avoid necessity to start ES.exe with admin rights?