Strange XY-related Voidtools Everything bug in XY?

Things you’d like to miss in the future...
Post Reply
chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Strange XY-related Voidtools Everything bug in XY?

Post by chumbo »

Hi,
There's a strange bug with Voidtools Everything in XY.
I downloaded a video file using ffmpeg and since it runs in a command prompt, I had no idea where that video was being downloaded to so I used Everything to find it but it failed to do so.
I then did a 'standard' XY search using a file size filter and found it!
I also tried using Everything to find another file residing in that same folder and it found it instantly so...why only that file and possibly many others??

Another thing I did was to, instead of using the keyboard shortcut I assigned to open a Everything search window in XY which is where this problem occurs, I also tried right-clicking the Everything icon in the taskbar and clicking 'New Search Window' - which BTW, opens a completely different looking GUI - and there the file is found instantly!?

So it appears to be a problem of how Everything works in XY specifically which is why I'm posting this as an XY bug...make sense?
Thx in advance!

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Strange XY-related Voidtools Everything bug in XY?

Post by highend »

make sense?
Nope

1. The command line call to ffmpeg to download the video?
2. The code on the button to open Everything's search window?
One of my scripts helped you out? Please donate via Paypal

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Strange XY-related Voidtools Everything bug in XY?

Post by chumbo »

1.

Code: Select all

ffmpeg -i "https://163vod-adaptive.akamaized.net/exp=1650977515~acl=%2F13ee2fdc-7ccd-4d9f-b443-d51fc6c66df2%2F%2A~hmac=881a7333ffce2b5c4c91d064d1529867e231a321c8a447dcb0fc598c68e9899c/13ee2fdc-7ccd-4d9f-b443-d51fc6c66df2/sep/video/2f4d99cb,8e25b113,bc95361d,ee19507b,16353b7b/audio/a905f496,ba0a1f25,d36ec139/master.m3u8?query_string_ranges=1" -c copy -map p:1 "Live at Masterlink - Redtenbacher's Funkestra @Pete's Place 22APR22_1.mp4"
2.
#1401 (I hope that's what you asked for? It's what shows up at the bottom-right in the 'Manage User-Defined Commands')

Thx!

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Strange XY-related Voidtools Everything bug in XY?

Post by highend »

So the real code is obviously in a user defined command. Post that^^
One of my scripts helped you out? Please donate via Paypal

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Strange XY-related Voidtools Everything bug in XY?

Post by chumbo »

Sorry...I don't understand? Can you elaborate?

I'll tell you exactly what I did...
As per instructed here (maybe even by you?), for integrating Everything in XY, I assigned a User-Defined command to open Everything with a keyboard shortcut to which I believe I gave the code you were asking for...right? (#1401).

As for the ffmpeg code, I got that from a Chrome extension that allows downloading Vimeo video files. When it's unable to directly download it, it will post an ffmpeg code that you then paste in ffmpeg (via Command Prompt) which will start the download and that's what I pasted exactly in the '1. ' of my previous post so...what is you're asking for then?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Strange XY-related Voidtools Everything bug in XY?

Post by highend »

Menu - Help - List All Commands...

Paste #1401 into the search field

Go to that entry in
Menu - User - Manage Commands...

Post the the full code of the script that is used there^^ (and if it's a script file, post its content)
One of my scripts helped you out? Please donate via Paypal

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Strange XY-related Voidtools Everything bug in XY?

Post by chumbo »

Here you go:

Code: Select all

/*
******************************************************************************
@Author  : IT Services & Consulting Ulf Kohlmorgen
@Created : 2021-07-01 22:24:36
@Modified: 2021-09-30 13:22:05
@Function: Everything
@Tags    : search, find, everything, integration
@Version : v0.9.5
******************************************************************************
*/

/*
Original authorship / copyright
===============================
User  : Marco [https://www.xyplorer.com/xyfc/memberlist.php?mode=viewprofile&u=1779]
Thread: https://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=12054

Additional (example) syntax options of "es.exe":
regex:      = Use a basic POSIX regular expression
case:       = Case-sensitive search
wholeword:  = Whole word search
count:<max> = Limit the amount of results to <max>
*/

    // ========================================================================
    // == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
    // ========================================================================

    // Handle .ini file
    $iniFile = self("path") . "\" . self("base") . ".ini";

    // Write .ini file if missing
    if (exists($iniFile) != 1) {
        $iniContent = <<<'>>>'
[General]
; Where does the "es.exe" file reside
; Default: <xypath>\..\Everything_x64
EverythingPath=<xypath>\..\Everything_x64

; Where does "Everything" store its data files
; E.g. the "Filters*.csv", "Macros*.csv", etc.
; Default: <xypath>\..\Everything_x64
; For non-portable installations this is usually
; %APPDATA%\Everything
EverythingDataPath=<xypath>\..\Everything_x64

; The base paper folder name (without .txt extension)
; Default: Everything
PaperFolderName=Everything

; En- or disable the setting of column layout and sort order
; Default: true (to disable this, use: false)
SetupColumns=true

; The columns that the paper folder will show
; Default: Name,Path,Size,Modified,Created
ColumnLayout=Name,Path,Size,Modified,Created

; Primary and secondary sort order columns
; Default: Name,Path
ColumnSortOder=Name,Path

; Automatically resize the paper folder columns
; Default: true (to disable this, use: false)
AutosizeColumns=true

; Display internal notes (switch explanations)
; Default: true (to disable this, use: false)
DisplayNotes=true

; How many last queries should be stored
; Default: 10
MaxSavedQueries=10

; Get filter and search macro names from Everything
; Your own filter macros must have this schema: "{name}<{identifier}>"
; E.g.: bat<QUERY>, office<SEARCH>, etc.
; Default: false (to enable this, use: true)
ShowMacros=false

; Split overlong macro definitions into shorter <crlf>-separated line(s)
MacroLinesLength=60

; Querying a drive at its root level (no subfolder used) can easily
; crash XYplorer (because of too many items in the search result)
; E.g.: C:\, f:C:\ or d:C:\
; Default: true (to disable this, use: false)
; If set to true, this behavior can be overriden with the " /f" switch
; at the end of the query
; E.g.: C:\ /f, f:C:\ /f or d:C:\ /f
ConfirmRootDrive=true

; The last query you've used
LastQuery=
        >>>;
        writefile($iniFile, $iniContent, , "tu");
    }

    // Get .ini file entries
    $everythingPath     = getkey("EverythingPath",     "General", $iniFile);
    $everythingDataPath = getkey("EverythingDataPath", "General", $iniFile);
    $paperFolderName    = getkey("PaperFolderName",    "General", $iniFile);
    $setupColumns       = getkey("SetupColumns",       "General", $iniFile);
    $columnLayout       = getkey("ColumnLayout",       "General", $iniFile);
    $autosizeColumns    = getkey("AutosizeColumns",    "General", $iniFile);
    $columnSortOder     = getkey("ColumnSortOder",     "General", $iniFile);
    $displayNotes       = getkey("DisplayNotes",       "General", $iniFile);
    $maxSavedQueries    = getkey("MaxSavedQueries",    "General", $iniFile);
    $showMacros         = getkey("ShowMacros",         "General", $iniFile);
    $macroLinesLength   = getkey("MacroLinesLength",   "General", $iniFile);
    $confirmRootDrive   = getkey("ConfirmRootDrive",   "General", $iniFile);
    $lastQuery          = getkey("LastQuery",          "General", $iniFile);

    // Validations
    if ($everythingPath     == "") { $everythingPath = "<xypath>\..\Everything_x64"; }
    if ($everythingDataPath == "") {
        $everythingDataPath = "<xypath>\..\Everything_x64";
        setkey $everythingDataPath, "EverythingDataPath", "General", $iniFile;
    }
    if ($paperFolderName == "") { $paperFolderName = "Everything";                      }
    if ($columnLayout    == "") { $columnLayout    = "Path,Name,Size,Modified,Created"; }
    if ($columnSortOder  == "") { $columnSortOder  = "Path,Name";                       }
    if ($maxSavedQueries == "" || $maxSavedQueries <= 0 || !regexmatches($maxSavedQueries, "\d+")) {
        $maxSavedQueries = 10;
        setkey $maxSavedQueries, "MaxSavedQueries", "General", $iniFile;
    }
    if ($setupColumns    UnLikeI "true" && $setupColumns    UnLikeI "false") { $setupColumns    = "true"; }
    if ($displayNotes    UnLikeI "true" && $displayNotes    UnLikeI "false") { $displayNotes    = "true"; }
    if ($autosizeColumns UnLikeI "true" && $autosizeColumns UnLikeI "false") { $autosizeColumns = "true"; }
    if ($showMacros      UnLikeI "true" && $showMacros      UnLikeI "false") {
        $showMacros = "false";
        setkey $showMacros, "ShowMacros", "General", $iniFile;
    }
    if ($macroLinesLength == "" || $macroLinesLength <= 0 || !regexmatches($macroLinesLength, "\d+")) {
        $macroLinesLength = 60;
        setkey $macroLinesLength, "MacroLinesLength", "General", $iniFile;
    }
    if ($confirmRootDrive UnLikeI "true" && $confirmRootDrive UnLikeI "false") {
        $confirmRootDrive = "true";
        setkey $confirmRootDrive, "ConfirmRootDrive", "General", $iniFile;
    }

    $columnLayout       = trim($columnLayout,   ",");
    $columnSortOder     = trim($columnSortOder, ",");
    $everythingPath     = trim(resolvepath($everythingPath), "\", "R");
    $everythingDataPath = trim(resolvepath($everythingDataPath), "\", "R");
    $es                 = "$everythingPath\es.exe";
    end (exists($everythingPath) != 2), quote($everythingPath) . <crlf 2> . "not found, aborted!";
    end (exists($es) != 1), quote($es) . <crlf 2> . "not found, aborted!";

    if     (exists("$everythingPath\Everything64.exe") == 1) { $inputIcon = "$everythingPath\Everything64.exe"; }
    elseif (exists("$everythingPath\Everything.exe")   == 1) { $inputIcon = "$everythingPath\Everything.exe"; }
    else   { $inputIcon = ":qns"; }

    $verTooOld = (compare(<xyver>, "22.00.0006", "v") == -1) ? true : false; }

    // Display notes (or not)
    $notes = "";
    if ($displayNotes LikeI "true") {
        $notes = <<<'>>>'
            Type your search query as you would in Everything!

            Additional (internal) switches and their expansions:
            d: = Only directories               => folder:
            f: = Only files                     => file:
            c: = Search content                 => content:
            l: = Search only in current path    => path:"<curpath>"
            w: = Search in Windows search index => systemindex:

            You need to prepend your query with one of these switches...
            E.g.: d:<some folder name> and NOT: <some folder name> d:

            <placeholder macros>

            BEWARE: Drives must end with a trailing "\", otherwise it would
                    be unclear if it's an (internal) switch or a drive!
                    E.g. use: C:\ but NOT C:
        >>>;
        if ($verTooOld) { $notes = regexreplace($notes, "^[ \t]+");  }
        else            { $notes = regexreplace($notes, "^[ ]{12}"); }

        // Modify notes if necessary
        $msgPlaceholderMacros = "<placeholder macros>";
        if ($showMacros) {
            $macros = getMacros($everythingDataPath, $msgPlaceholderMacros, $macroLinesLength);
            if ($macros) {
                $notes = replace($notes, $msgPlaceholderMacros, $macros);
            }
        }
        $notes = replace($notes, $msgPlaceholderMacros . <crlf 2>);
    }

    // Show query window as often as necessary
    $editQuery = "<Manage query list>";
    $lastQuery = formatlist(replace($lastQuery, "<::>", <crlf>), "e", <crlf>);

    while (true) {
        $fstLastQuery = gettoken($lastQuery, 1, <crlf>, "t");

        // Add an $editQuery entry on last position
        $lastQuery .= (($lastQuery) ? <crlf> . $editQuery : $editQuery);

        // Display the query window
        $query = showDialog($notes, $fstLastQuery, $lastQuery, $inputIcon);

        // If anything apart from $editQuery was chosen from the drop-down list
        if ($query UnLikeI $editQuery) { break; }

        // Remove $editQuery entry again and edit the list
        $lastQuery = formatlist($lastQuery, "F", <crlf>, "!" . $editQuery);
        $lastQuery = input("Stored queries", , $lastQuery, "m", $lastQuery, 600, 600);
        $lastQuery = formatlist($lastQuery, "e", <crlf>);
    }
    // Make sure that the $editQuery entry doesn't get saved
    $lastQuery = formatlist($lastQuery, "F", <crlf>, "!" . $editQuery);

    // Save query (limited to $maxSavedQueries)
    $escQuery  = regexreplace($query, "([\\.+*|?(){\[^$])", "\$1");
    $lastQuery = regexreplace($lastQuery, "^" . $escQuery . "(\r?\n|$)");
    $lastQuery = trim($query . <crlf> . $lastQuery, <crlf>);
    if (gettoken($lastQuery, "count", <crlf>) > $maxSavedQueries) {
        $lastQuery = gettoken($lastQuery, $maxSavedQueries, <crlf>, , 1);
    }
    $lastQuery = replace($lastQuery, <crlf>, "<::>");
    setkey $lastQuery, "LastQuery", "General", $iniFile;

    // Make sure a query for a drive at its root level is allowed
    if (regexmatches($query, "^(f:|d:)?[ ]*?([a-z]:\\)([ ]+?/f)?$")) {
        if ($confirmRootDrive LikeI "true" && !regexmatches($query, "/f$")) {
            $msg = <<<>>>
                You are trying to query a drive at its root level.
                ConfirmRootDrive is set to true in the .ini file
                and you did not use the override switch " /f".

                Do you really want to execute this query?
            >>>;
            $msg = regexreplace($msg, "^[ \t]+");
            if (!confirm($msg, , 2)) { end true; }
        }
    }

    // Begin execution time
    $start = now("yyyy-mm-dd hh:nn:ss.ffff");

    // Eval switches
    // Expand "d:" -> "folder:"
    if (regexmatches($query, "(^[ ]*?|[ ]+?)d:[^\\]")) { $query = regexreplace($query, "[ ]*?d:", " folder:"); }

    // Expand "f:" -> "file:"
    if (regexmatches($query, "(^[ ]*?|[ ]+?)f:[^\\]")) { $query = regexreplace($query, "[ ]*?f:", " file:"); }

    // Expand "c:" -> "content:"
    // We can't use "utf16(be)content" here, it is not supported by "es.exe"!
    // "es.exe" does support macros (defined via "Search - Organize Filters...")
    if (regexmatches($query, "(^[ ]*?|[ ]+?)c:[^\\]")) { $query = regexreplace($query, "[ ]*?c:", " content:"); }

    // Expand "l:" -> "$query path:""$curPath"""
    // It allows searching even when a paper folder is currently displayed (in this case, it searches everywhere!)
    $curPath = (<curpath> LikeI "*paper:*") ? "*" : property("#ResolveJunctionsAll", <curpath>);
    if (regexmatches($query, "(^[ ]*?|[ ]+?)l:[^\\]?")) { $query = regexreplace($query, "[ ]*?l:", " path:""$curPath"" "); }

    // Expand "w:" -> "systemindex:"
    if (regexmatches($query, "(^[ ]*?|[ ]+?)w:[^\\]?")) {
        $result = regexreplace(runret("sc query wsearch"), "([\s\S]+?)(state[ ]+?:[ ]+?)(\d+)([\s\S]+)", "$3");
        end ($result != 4), "Windows search service not running, aborted!";
        $query = regexreplace($query, "[ ]*?w:", " systemindex:");
    }

    // Smart mode
    //$query = regexreplace($query, '\b-(?!([riwps]|n (?!\d))\b)', '"-"');

    // Escape characters but only if:
    // The "regex:" modifier is not found AND no double quote(s) are found
    if (!regexmatches($query, "\bregex:") && !regexmatches($query, "[""]")) {
        // Original query        | Escaped query          | Result
        //  D:\Temp\archive\d&e  |  D:\Temp\archive\d^&e  | OK
        // "D:\Temp\archive\d&e" | "D:\Temp\archive\d^&e" | NOT OK, no result(s)
        $query = regexreplace($query, "(<|>|&|\||\^)", "^$1");
    }

    // Process query
    $result = runret("""cmd"" /c chcp 65001 >NUL && ""$es"" $query", "%TEMP%", "65001");

    // No match(es)
    if (!$result) {
        if (regexmatches($query, "path:")) {
            msg "No match(es) found...<crlf 2>Maybe location awareness is responsible for this result?";
        } else {
            msg "No match(es) found...";
        }

    // Match(es)
    } else {
        // Open a new paper folder or reuse the existing one
        if (<curpath> UnLikeI "*paper:*") { tab("new"); }
        paperfolder("paper:$paperFolderName", $result, , "nl");

        // Only setup columns if enabled
        if ($setupColumns LikeI "true") {
            // Setup the visible columns and autosize them if configured
            $columns = concatenateEntries($columnLayout, "+");
            $flags   = 0;
            if ($autosizeColumns LikeI "true") { $flags = 16; }
            setcolumns($columns, $flags);

            // Set (primary and secondary) sort order(s)
            $cntSortOrderColumns = gettoken($columnSortOder, "count", ",", "t");
            if ($cntSortOrderColumns > 2) { $columnSortOder = gettoken($columnSortOder, 2, ",", "t", 1); }
            $i = 0;
            while ($j++ < $cntSortOrderColumns) {
                $column = gettoken($columnSortOder, $j, ",", "t");
                sortby $column, "a", $i;
                $i++;
            }
        }

        // End execution time
        $diff = round(datediff($start, now("yyyy-mm-dd hh:nn:ss.ffff"), "us") / 1000);
        if ($diff < 0) { $diff *= -1; }
        status "Query: $query [Time: " . $diff . " ms]";
    }


// FUNCTIONS
// =========
function concatenateEntries($list, $prefix="", $sep=",") {
    $newList = "";
    foreach($entry, $list, $sep, "e") {
        $entry = trim($entry);
        if ($prefix != "") { $entry = $prefix . $entry; }
        $newList .= $entry . $sep;
    }
    return trim($newList, $sep);
}


// Get filter + search macros from Everything
function getMacros($path, $noteStrToReplace, $macroLinesLength) {
    $notes = "";

    $filterFile = gettoken(listfolder($path, "Filters*.csv", 1), 1, "|");
    if ($filterFile) {
        $msgFilterMacros = "Filter macro(s): ";

        // Get either an empty string or a <crlf>-separated list of items
        $genMacros = replace(getMacrosFromFile($filterFile, "Macro"), <crlf>, ", ");
        $ownMacros = replace(getMacrosFromFile($filterFile, "Macro", true), <crlf>, ", ");

        if ($genMacros) {
            $notes .= $msgFilterMacros . splitString($genMacros, $macroLinesLength, , strlen($msgFilterMacros) . <crlf>);
        }
        if ($ownMacros) {
            if ($genMacros) {
                $notes .= <crlf> . strrepeat(" ", strlen($msgFilterMacros)) . splitString($ownMacros, $macroLinesLength, , strlen($msgFilterMacros) . <crlf>);
            } else {
                $notes .= $msgFilterMacros . splitString($ownMacros, $macroLinesLength, , strlen($msgFilterMacros) . <crlf>);
            }
        }
    }

    $macrosFile = gettoken(listfolder($path, "Macros*.csv", 1), 1, "|");
    if ($macrosFile) {
        $msgSearchMacros = "Search macro(s): ";
        $macros          = replace(getMacrosFromFile($macrosFile, "Name"), <crlf>, ", ");

        if ($macros) {
            if ($genMacros || $ownMacros) {
                $notes .= <crlf>;
            }
            $notes .= $msgSearchMacros . splitString($macros, $macroLinesLength, , strlen($msgSearchMacros) . <crlf>);
        }
    }
    return $notes;
}


// Get macros from a specific file
function getMacrosFromFile($file, $colName, $ownMacros=false) {
    // Search macros: https://www.voidtools.com/forum/viewtopic.php?f=12&t=9795&p=35397#macro

    // Filters column: Name,...,16:=Macro,17:=Key
    // Macros column : Name,Search

    $content = trim(readfile($file, , , 65001), <crlf>);
    $idMacro = gettokenindex($colName, gettoken($content, 1, <crlf>), ",", "i");

    $macros = "";
    while ($i++ < gettoken($content, "count", <crlf>)) {
        $line = trim(gettoken($content, $i, <crlf>));

        // Skip column definition
        if ($i == 1) { continue; }

        $macro = trim(gettoken($line, $idMacro, ",", "t"), '"');

        // Our own macros are set up like this: bat<QUERY>
        if ($macro) {
            if ($ownMacros) {
                if (strpos($macro, "<") != -1) {
                    $macros .= gettoken($macro, 1, "<", "t") . <crlf>;
                }
            } else {
                // Don't try to process own macros here!
                if (strpos($macro, "<") == -1) {
                    $macros .= $macro . <crlf>;
                }
            }
        }
    }
    return formatlist($macros, "sed", <crlf>);
}


// Split an already separated string into multiple lines with a maximum length
function splitString($string, $maxLen=20, $sep=", ", $prefixSpaces=0) {
    if ($maxLen >= strlen($string))  { return $string; }
    if (strpos($string, $sep) == -1) { return $string; }

    $newStr = "";
    while ($string) {
        $tmpStr = ""; $nextStr = ""; $i = 0;
        while ($i++ < gettoken($string, "count", $sep)) {
            // Check if string + the next token would exceed our $maxLen...
            if (strlen($nextStr) >= $maxLen) { break; }
            $tmpStr .= gettoken($string, $i, $sep) . $sep;
            $nextStr = $tmpStr . gettoken($string, $i + 1, $sep);
            wait;
        }
        $tmpStr = trim($tmpStr, $sep, "R");
        if (!$newStr) {
            $newStr .= $tmpStr . <crlf>;
        } else {
            $newStr .= strrepeat(" ", $prefixSpaces) . $tmpStr . <crlf>;
        }
        $string = trim(replace($string, $tmpStr, , 1, 1, 1), $sep, "L");
        wait;
    }
    return trim($newStr, <crlf>);
}



// Show query dialog
function showDialog($notes, $fstLastQuery, $lastQuery, $inputIcon) {
    // "e" for the style is accepted without an error even in older instances than "22.00.0006"
    // v22.10.0002 is required for [items] as a drop-down field
    // v22.10.0005 is required for [icon] (all possible internal & external ones lik png, jpg, gif, ico, and exe as well)
    if (compare(<xyver>, "22.10.0005", "v") == -1) {
        $query = trim(input("Everything", $notes, ($fstLastQuery) ? $fstLastQuery : "<query>", "e"));
    } else {
        $query = trim(input("Everything", $notes, ($fstLastQuery) ? $fstLastQuery : "<query>", "e", 7:=$lastQuery, 8:=$inputIcon));
    }
    end ($query == ""), "No query entered, aborted!";

    return $query;
}

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Strange XY-related Voidtools Everything bug in XY?

Post by highend »

opens a completely different looking GUI
You are just kidding, right?

And no, I can't see any bug here
Animation.gif
Animation.gif (1.58 MiB) Viewed 1550 times
One of my scripts helped you out? Please donate via Paypal

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Strange XY-related Voidtools Everything bug in XY?

Post by chumbo »

Strange...now it works for me too. Oh well, just one of those odd ones. But believe me, it didn't work when I posted this.
You are just kidding, right?
No, I'm not (what a strange thing to say...why would I?)
This is what I mean. The top one is how it's displayed when using the shortcut in XY and below that, is how it looks when opening Everything from the taskbar icon:

Image

chumbo
Posts: 243
Joined: 04 Jan 2015 15:20

Re: Strange XY-related Voidtools Everything bug in XY?

Post by chumbo »

Well, that problem that had magically resolved itself is back with another file.
So same problem...I search a file using the XY User Defined Command and it doesn't find the file. When I search using Everything from the taskbar, it finds it!? (if it's not clear what I mean, seem my previous post with the 2 screenshots).
Any idea why that would be and how to solve this?
Thanks,

Post Reply