Auto-select certain file when entering folder

Discuss and share scripts and script files...
Post Reply
greentea
Posts: 4
Joined: 19 Jun 2021 04:13

Auto-select certain file when entering folder

Post by greentea »

Hi All,

I'm new to XYplorer and really like it so far :appl: I came across this script in Directory Opus for automatically selecting a file when navigating to a folder:
https://resource.dopus.com/t/auto-selec ... ders/20413

I'm not experienced with scripting - can anyone describe how this script can be adapted to work in XYplorer?

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

Re: Auto-select certain file when entering folder

Post by highend »

Configuration | General | Custom Event Actions
Even: Changing Locations - After painting the file list
Action: Run script
Script:

Code: Select all

    $list = <<<>>>
*\Directory Opus::dopus.exe
*\Outlook::Outlook.pst
C:\Passwords::File4.txt|File2.txt|another file.txt
    >>>;

    // "[" and "#" need to be surrounded by "[]" for a "LikeI" comparison
    foreach($item, $list, <crlf>, "e") {
        if (<newpath> LikeI regexreplace(gettoken($item, 1, "::", "t"), "([#\[])", "[$1]")) {
            selectitems gettoken($item, 2, "::", "t");
            break;
        }
    }
To select multiple files, just append them on the right side of a line, separated with "|". Like it is done in:
C:\Passwords::File4.txt|File2.txt|another file.txt
One of my scripts helped you out? Please donate via Paypal

greentea
Posts: 4
Joined: 19 Jun 2021 04:13

Re: Auto-select certain file when entering folder

Post by greentea »

Thanks for the code, greatly appreciate it!

Post Reply