{sourcepath$} when a {dlgstring} is used in the same button

Hello,

I'm tinkering away with my Everything bridge for Dopus (GitHub - TheZoc/EverythingDopusCLI: A command line interface to display Everything results inside Directory Opus) and I found an issue that seems to be a bug.

I'm trying to create this button:

@nofilenamequoting
@set xsrc={sourcepath$}
@set search={dlgstring|Enter Everything Search Query\nYou can do a /regex search \d\d\d/ using slashes\n\nNOTE: Searching current folder only!}
Go NEWTAB
EverythingDopus {$xsrc} {$search}

But apparently {sourcepath$} is empty (so the button doesn't run), but that only occurs if I have a {dlgstring} in it. If I remove that line, it works.

Am I doing something wrong, or did I hit a bug?

Thank you in advance :slight_smile:

I think it's because of the Go NEWTAB opening a blank folder tab.

Change it to Go "C:\" NEWTAB or similar, so the new tab has a path.

You'll probably also need to put quotes around {$xsrc} or you won't know where the path ends and the query string begins. (Since automatic quoting has been turned off at the start of the command.)

Oh, I forgot to mention that, if I remove Go NEWTAB it still doesn't work. I narrowed it down to {dlgstring} causing {sourcepath$} to fail.

For completeness:

If I try to run this, it fails:

@set xsrc={sourcepath$}
@set search={dlgstring}
EverythingDopus {$xsrc} {$search}

Log output:

20/02/2023 00:00 EverythingDopus:  OnEverythingDopusSearch - command line:D:\GitHub\EverythingDopusCLI\x64\Release\ed.exe

But if I run this, it works:

@set xsrc={sourcepath$}
EverythingDopus {$xsrc}

Log output:

20/02/2023 00:01 EverythingDopus:  OnEverythingDopusSearch - command line:D:\GitHub\EverythingDopusCLI\x64\Release\ed.exe C:\Users\Felipe\AppData\Roaming\GPSoftware\Directory Opus\Script AddIns\

I tested it earlier, and again just now. This is working fine here:

@nofilenamequoting
@set xsrc={sourcepath$}
@set search={dlgstring|Enter Everything Search Query\nYou can do a /regex search \d\d\d/ using slashes\n\nNOTE: Searching current folder only!}
Go "C:\" NEWTAB
"/home/dopusrt.exe" /ArgsMsgBox "{$xsrc}" {$search}

If I type Test into the requester, it results in:

image

Which also reveals that you probably want {sourcepath$|noterm} to avoid the \" causing problems with some command-line parsing code:

@nofilenamequoting
@set xsrc={sourcepath$|noterm}
@set search={dlgstring|Enter Everything Search Query\nYou can do a /regex search \d\d\d/ using slashes\n\nNOTE: Searching current folder only!}
Go "C:\" NEWTAB
"/home/dopusrt.exe" /ArgsMsgBox "{$xsrc}" {$search}

image

1 Like

I (think) I found the problem :slight_smile:

I'm using this script: EverythingDopusCLI/EverythingDopus.js at master · TheZoc/EverythingDopusCLI · GitHub

and I defined the argument template as:

cmd.template = "SearchString/R";

So, to make the button work, I need to set the quotes like this:

EverythingDopus "{$xsrc} {$search}"

And I can call the script function :slight_smile:

If there's any obvious caveat I missed, could you please let me know? :slight_smile:


About the NEWTAB part, I'll just move that away from the button and into the CLI app itself :slight_smile:
It indeed has a weird behavior with {sourcepath$} (Though {sourcepath} seem to work fine), even if button is setting the variable before running the Go NEWTAB part

Thank you <3