About menu display, etc

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
kuiwu_zh
Posts: 59
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_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");
To see the attached files, you need to log into the forum.

admin
Site Admin
Posts: 66631
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @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: 59
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: 14993
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: 59
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: 14993
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: 59
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
To see the attached files, you need to log into the forum.

highend
Posts: 14993
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