About menu display, etc

Things you’d like to miss in the future...
Post Reply
kuiwu_zh
Posts: 42
Joined: 24 May 2018 15:38

About menu display, etc

Post 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_1.png (12.22 KiB) Viewed 992 times

Q1_2.png
Q1_2.png (13.4 KiB) Viewed 992 times





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_1.png (34.49 KiB) Viewed 992 times

Q2_2.png
Q2_2.png (46.5 KiB) Viewed 992 times

Q2_3.png
Q2_3.png (21.7 KiB) Viewed 992 times

Q2_5.png
Q2_5.png (24.1 KiB) Viewed 992 times

Q2_6.png
Q2_6.png (13.89 KiB) Viewed 992 times

Q2_7.png
Q2_7.png (12.17 KiB) Viewed 992 times

Q2_8.png
Q2_8.png (20.05 KiB) Viewed 992 times

Q2_9.png
Q2_9.png (15.93 KiB) Viewed 992 times





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_1.png (7.8 KiB) Viewed 992 times

Q3_2.png
Q3_2.png (13.95 KiB) Viewed 992 times

Q3_3.png
Q3_3.png (20.55 KiB) Viewed 992 times





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_1.png (8.93 KiB) Viewed 992 times

Q4_2.png
Q4_2.png (41.18 KiB) Viewed 992 times

Q4_3.png
Q4_3.png (10.89 KiB) Viewed 992 times





Question 5:

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

text get ("sort");

admin
Site Admin
Posts: 60774
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: About menu display, etc

Post 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.

kuiwu_zh
Posts: 42
Joined: 24 May 2018 15:38

Re: About menu display, etc

Post 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?

highend
Posts: 13364
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: About menu display, etc

Post 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
One of my scripts helped you out? Please donate via Paypal

kuiwu_zh
Posts: 42
Joined: 24 May 2018 15:38

Re: About menu display, etc

Post 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.

highend
Posts: 13364
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: About menu display, etc

Post 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--;
    }
}
One of my scripts helped you out? Please donate via Paypal

kuiwu_zh
Posts: 42
Joined: 24 May 2018 15:38

Re: About menu display, etc

Post 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
snap_screen_20220307200744.png (22.15 KiB) Viewed 919 times

highend
Posts: 13364
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: About menu display, etc

Post by highend »

These are binary files, property doesn't process them natively
One of my scripts helped you out? Please donate via Paypal

Post Reply