CEA - Drives

Features wanted...
sl23
Posts: 295
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: CEA - Drives

Post by sl23 »

Thanks for explaining. It'll take a little while to understand that explanation, I'm still trying to get to grips with the terminology use, this is causing a lot of the confusion I think! :roll:

Right, so when you run "QuickCustomMenuBuilder" it saves an actual file that is then loaded and used by XY to hide menu entries you've not checked?

In case you were unsure how it works:
1. Run Script
2. Check list of items for menu entries to keep, of which there are 652...ish?
3. Save

It works ok, as far as I can tell. So saving this saves the .xys file? Delete this to remove the effect of that script?

Ok simple enough.

Thanks highend for your continual help, very much appreciated :tup: :tup: :tup:

sl23
Posts: 295
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: CEA - Drives

Post by sl23 »

Going back to my original request:
eil wrote: 29 Dec 2020 17:49 why not make scripted buttons for needed drives or one button with dropdown list = with scripting you can make it open new tab before opening drive.
This seems a good way to do it. But you'd have to have a button showing for each drive. Is there a way to hide a button if a drive is disconnected?

Maybe a menu would be easier, but I prefer less clicking, so a button for each drive, similar to the current Drives Group is much more preferable for me.

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

Re: CEA - Drives

Post by highend »

One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 295
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: CEA - Drives

Post by sl23 »

So you've basically made what I'm after but without open in new tab when clicked?

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

Re: CEA - Drives

Post by highend »

That's a part of the script that is fired when such a button is clicked...

Code: Select all

            // No root drive tab exists
            if ($tabIndex == 0) {
                tab("new", $drvLetter);

            // Root drive exists as tab
            } else {
                seltab $tabIndex;
            }
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 295
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: CEA - Drives

Post by sl23 »

I can see how it works. Great stuff! :tup:

It's really simple stuff when you see it laid out in front you! Getting there is another bloody story! :lol: :lol:

sl23
Posts: 295
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: CEA - Drives

Post by sl23 »

Well, I've been trying to get this to work since you posted it, but I have absolutely no idea how to use it or the Help file!

I came back to the start:

Code: Select all

// No root drive tab exists
 if ($tabIndex == 0) {
    tab("new", C:);

// Root drive exists as tab
 } else {
   seltab $tabIndex;
 }
Which opened a new C: tab but didn't switch to it. Then I started fiddling with the code to try and get it to switch to the new tab if already open. But I just can't make sense of that help file! It has no real structure unless you already know what you're doing. Sorry, but it doesn't explain very well how to get from one point to the next and with zero other references that leaves this forum the only other method of help!

Again, I can see certain things like caption, which I tried to catch to detect the open tab. So if a tab named C: existed, then select it instead of opening a new tab. Nothing I tried worked and just frustrated me more due to the lack of help in the help file, that I am back here!

For a start, different symbols: $a "" % $ : ; <> {} () , do different things, where is all this explained the help file?
From what I can tell:
<> = internal variable
%% = system variable
, = separator
: = indicates button icon?
# = indicates toolbar icon?
No idea what the others do!

And for some reason, the code above which opened a new C: tab on first run, now no longer does so?

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

Re: CEA - Drives

Post by highend »

Open the help file, expand "Advanced Topics"
Read:
Scripting
Scripting Commands Reference
Variables


Then you have the necessary building blocks to (at least) understand scripts (structures, elements, variables, basic building blocks).
I came back to the start:
I've said that this is a part of the button script^^

The script of this button (all user buttons defined for drives use the same^^) is:

Code: Select all

    // Use this for the script when a drive button is clicked
    $tbPos  = controlatpos();
    $btnID  = replace(gettoken(toolbar(), gettoken($tbPos, 2, "|"), ","), "ctb");
    $iniKey = trim(getkey($btnID, "CustomButtons"), chr(34), "L");
    if ($iniKey) {
        $drvLetter = trim(gettoken($iniKey, 1, "|", "t"), "\", "R");
        if (exists($drvLetter) == 2) {
            // Goto drive in active pane (if it exists), otherwise open new tab with drive
            $activeTabs = <get Tabs <crlf>>;
            $tabIndex   = gettokenindex($drvLetter, $activeTabs, <crlf>, "i");
            // No root drive tab exists
            if ($tabIndex == 0) {
                tab("new", $drvLetter);

            // Root drive exists as tab
            } else {
                seltab $tabIndex;
            }
        }
    }
What does it do? It finds out (on click) what name (ctb<x>) this button has and takes the Name: part of it's definition (which is "<driveletter>:\") and then checks if a tab with that exact path does already exist and either creates a new one or selects the existing one.

Is that the solution to which drive buttons are shown and which not? Of course not. There is a management script needed that takes care of these things
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 295
Joined: 03 Feb 2015 23:34
Location: XYplorer 64 Latest beta, Win11x64 25H2, 1920x1080 @100%

Re: CEA - Drives

Post by sl23 »

I see, thanks for the tips. I've started to read those sections from start to finish.

Post Reply