Page 1 of 1

About menu display, etc

Posted: 07 Mar 2022 09:33
by kuiwu_zh
Hello, I have five questions. Please help me have a look. Thank you.



Question 1:

Code: Select all

popupnested ("C&aption A;Data1;:cofi|-|Ca&ption B;Data2;:favs|Cap&tionC;Data3;:find");
If there is a space in the title, there will be a prompt in the status bar.
If there is no space in the title, there is no prompt in the status bar. Why not prompt?
Actually, I don't need a prompt. Can I turn off this function?
In addition, the icon when prompted in the status bar is not the icon I defined. I think the icon I defined is more beautiful.


Q1_1.png

Q1_2.png





Question 2:

Code: Select all

popupnested ("C&aption A;Data1;:cofi|-|Ca&ption B;Data2;:favs|Cap&tionC;Data3;:find");
Scripts can be triggered in three ways.

(1) Triggered by pressing the key, the letters in the menu will be underlined.
(2) Triggered by double clicking the mouse, the letters in the menu will not be underlined.
(3) Triggered by the toolbar button, the letters in the menu will not be underlined.


Q2_1.png

Q2_2.png

Q2_3.png

Q2_5.png

Q2_6.png

Q2_7.png

Q2_8.png

Q2_9.png





Question 3:

Step 1: set environment variable.

Code: Select all

setx prj_mcu_dir "E:\prj_mcu_2022"
Step 2: create a shortcut. The path of the shortcut is: %prj_mcu_dir%\mcu8051
Step 3: close XYplorer and restart XYplorer. The shortcut can access the folder, and the script can get the correct path.

Code: Select all

text property ("#ShortcutTarget","D:\mcu8051.lnk");
Step 4: I change to another computer and set the environment variable. (The location of this folder is different on different computers.)

Code: Select all

setx prj_mcu_dir "F:\prj_usb_3_0_PCB\prj_mcu_2022"
Step 5: I copy the shortcut to this computer through BeyondCompare software. The shortcut cannot access the folder, and the script cannot get the correct path. (Path "F:\prj_usb_3_0_PCB\prj_mcu_2022\mcu8051" is exist.)
Step 6: in Explorer, shortcut can access folder.
Step 7: at this time, in XYplorer, the shortcut can access the folder.

I hope that in step 5, the shortcut can access the folder and the script can get the correct path.
(Even on the same computer, this shortcut will fail when the value of the environment variable changes. I hope this shortcut will not fail in XYplorer, because it will not fail in Explorer.)


Q3_1.png

Q3_2.png

Q3_3.png





Question 4:

I set icon A.ico in XYplorer and icon B.ico in shortcut properties.
XYplorer display icon A.ico. I think the setting in the shortcut property has higher priority. At this time, icon B.ico should be displayed


Q4_1.png

Q4_2.png

Q4_3.png





Question 5:

The following command cannot get the status of the secondary sort.

text get ("sort");

Re: About menu display, etc

Posted: 07 Mar 2022 11:49
by admin
1: Fixed.

2: Have no influence.

3: Values are cached for performance. No change intended.

4: Custom Icons should top everything IMO.

5: Added.

Re: About menu display, etc

Posted: 07 Mar 2022 12:15
by kuiwu_zh
Thank you very much.



Question 3:

Can the following command return "%prj_mcu_dir%\mcu8051" instead of "F:\prj_usb_3_0_PCB\prj_mcu_2022"?

Code: Select all

text property ("#ShortcutTarget","D:\mcu8051.lnk");

I just need this return with environment variable. This is important to me. Please help add this function. Thank you.




Question 2:

I can quickly execute this title by pressing underlined letters. If there is no underline, I don't know which letter to press.

The three trigger menus should be the same. Why are there differences?

Re: About menu display, etc

Posted: 07 Mar 2022 12:21
by highend
Question 3:
Properties are resolved variable values. You can do this on your own by returning all set variables (cmd > set) and do a search / replace to get the variable name, not the value

Re: About menu display, etc

Posted: 07 Mar 2022 12:36
by kuiwu_zh
Thank you.

If there is only one environment variable, I can implement it through your method.

Now there is more than one environment variable. I don't know which environment variable is used in the shortcut.

Re: About menu display, etc

Posted: 07 Mar 2022 12:47
by highend
Something like this...

Code: Select all

    $lnk  = "E:\mcu8051.lnk";
    $env  = GetUnresolvedEnvVar($lnk);
    text $env;


function GetUnresolvedEnvVar($lnkFile) {
    $prop = property("#ShortcutTarget", $lnkFile);
    if (!$prop) { return ""; }

    $envs = runret("""cmd.exe"" /c chcp 65001 >NUL & set", "%TEMP%", 65001);

    // Decrement path parts of $prop to find the longest matching one
    $path   = gpc($prop, "path");
    $cntSep = gettoken($path, "count", "\");

    while (true) {
        // Do not continue if we only have the drive left
        if ($cntSep <= 1) { break; }

        $part  = gettoken($path, $cntSep, "\", , 1);
        $esc   = regexreplace($part, "([\\.+(){\[^$])", "\$1");
        $match = regexmatches($envs, "^.+?=$esc");
        if ($match) {
            // Variable name (not value)
            $env = "%" . gettoken($match, 1, "=") . "%";
            // Replace this inside $prop
            $prop = replace($prop, $part, $env);
            return $prop;
        }
        $cntSep--;
    }
}

Re: About menu display, etc

Posted: 07 Mar 2022 13:27
by kuiwu_zh
You're great.

I can't understand your regular expression for the moment. I'll take some time to study it. Thank you.


I used to use the command readfile() to read the shortcut and extract the environment variable name from it.

I think since the environment variable name has been saved in the shortcut, it should be available through the command property().


snap_screen_20220307200744.png

Re: About menu display, etc

Posted: 07 Mar 2022 13:35
by highend
These are binary files, property doesn't process them natively