Help with button scripting

Discuss and share scripts and script files...
Post Reply
evangelina
Posts: 13
Joined: 16 Dec 2021 10:52

Help with button scripting

Post by evangelina »

Dear all, I want to add this script to a button.
2023-02-20-13-46-30.png
I don't know how to script the check tab part. The best I can do is this:

Code: Select all

if (Get('#800')){focus "P2";if (<curpath> == "[pathX]"){focus "P1";#800;} else {tab ("new", "[pathX]");}} else {#800;focus "P2";if (<curpath> == "[pathX]"){#1001;} else {tab ("new", "[pathX]")}};
Could you please give me some help regarding how it should be written? Thank you very much!
To see the attached files, you need to log into the forum.

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

Re: Help with button scripting

Post by highend »

Code: Select all

    $pathX = "<some path>";

    if !(get("#800")) {
        #800;
    }
    focus "P2";

    $tabs = get("Tabs");
    $index = gettokenindex($pathX, $tabs, , "i");
    if ($index == 0) {
        tab("new", $pathX);
    } else {
        if (<curpath> == $pathX) {
            focus "P1";
            #800;
        } else {
            seltab $index;
        }
    }
One of my scripts helped you out? Please donate via Paypal

evangelina
Posts: 13
Joined: 16 Dec 2021 10:52

Re: Help with button scripting

Post by evangelina »

This works perfectly. Thank you so much!

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

Re: Help with button scripting

Post by sl23 »

Thanks, this adapted well to what I needed to open Drive Root in new tab without duplicating! :tup:

Code: Select all

$pathX = "D:";

    $tabs = get("Tabs");
    $index = gettokenindex($pathX, $tabs, , "i");
    if ($index == 0) {
        tab("new", $pathX);
    } else {
        seltab $index;
    }
Took a little tinkering, but exactly what I've been looking for :D

Post Reply