Page 2 of 2

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 01 Nov 2020 12:06
by highend
But I accept the challenge
:)

You don't need to delete the ini file first, savesettings will overwrite it if it already exists

As long as you don't use button names for commands and no ids your script looks fine as well

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 01 Nov 2020 12:16
by MBaas
You don't need to delete the ini file first, savesettings will overwrite it if it already exists
Oh right - and it's even mentioned in the doc (which I read) :oops:
As long as you don't use button names for commands and no ids your script looks fine as well.
I'm not using button-names, but "#1070;;:go" would qualify as an ID, right? But even w/o special treatment that option works fine.

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 01 Nov 2020 12:21
by highend
It would. Interestingly in a similar context the menu tends to execute the id twice. So, if it works fine here, you don't need that check

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 01 Nov 2020 12:51
by MBaas
Or maybe I'm just lucky - because :go can be executed repeatedly without damage :wink:

I will adopt your code - because otherwise I will have long forgotten this discussion when my enhanced Hamburger produces garbage in a year or so :whistle:

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 02 Nov 2020 13:27
by MBaas
Things just got easier:

Code: Select all

$inifile = "%temp%\xysettings.tmp";
  savesettings 1,$inifile;
  $hamburgerMenu = getkey("CrumbHamburger","Settings", $inifile);
  delete 0,0,$inifile;
    if ($hamburgerMenu) {
        $command = popupnested($hamburgerMenu);
        if ($command) {
            // Don't execute XY ids twice
            if (!regexmatches($command, "^#\d+")) {
                // We need to translate items like ":newfolder" to the button id that needs to be used for it
                if (regexmatches($command, "^:[^:]")) {
                    button $command;

                // Normal script execution
                } else {
                    load $command, , "s";
                }
            }
        }
    }

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 03 Nov 2020 16:31
by klownboy
For some reason I was thinking that SC getkey did not require a save of settings before use (i.e., that it got the latest in memory even if not saved to disk yet). That may be an old age thing. Anyway, I had made a SC getkey change to your script highend. $hamburgerMenu = getkey("CrumbHamburger","Settings"); in place of your line which was required at the time because of the duel "CrumbHamburger" lines. When I made a change to the Hamburger menu itself, the change was carried out (no save necessary). No change was seen in the save settings toolbar icon indicating a save was necessary. When I used the script however, with the above SC getkey change, the change was not carried out.

I haven't tested further, but I assume that means a savesettings should be accomplished first always to get the latest SC getkey from XYplorer.ini. If that's the case should the help file explicitly state that point?

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 03 Nov 2020 16:39
by klownboy
Hi MBaas, you do have to savesettings prior to using SC getkey here, but you do not have to save settings to a temp file to read. See my previous post.

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 03 Nov 2020 16:39
by highend
I don't know if it's necessary to point that out. getkey() reads from a file, not something that may have changed in the current session but wasn't saved so far.

But I see this as a kind of bug that after changing the hamburger menu, "Settings Special" doesn't show the * for "Save Settings". Maybe you file a bug report for this?

Re: Is there a kbd-shortcut to open the hamburger-menu?

Posted: 03 Nov 2020 16:51
by klownboy
highend wrote: ↑03 Nov 2020 16:39 I don't know if it's necessary to point that out. getkey() reads from a file, not something that may have changed in the current session but wasn't saved so far.
Well maybe but Don does make a point of saving settings in the help for SC setkey, so they should probably be consistent.
Note: Only the key on disk is changed, not the current setting in memory! To realize any changes made via setkey you should use "Restart without Saving" in menu File!
highend wrote: ↑03 Nov 2020 16:39 But I see this as a kind of bug that after changing the hamburger menu, "Settings Special" doesn't show the * for "Save Settings". Maybe you file a bug report for this?
Yeah, I thought that a bit odd and I think that's what got me on the wrong trail concerning savesettings and getkey. I can submit a bug.