MiniTreeSwitcher

Discuss and share scripts and script files...
highend
Posts: 14723
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: MiniTreeSwitcher

Post by highend »

Try v0.5.6...

To add an icon:
01. Load the minitree from its menu item
02. Use "Save current mini tree..."

The notes in that window tell you how to do it

The drawback is: There is no favorite icon for the last loaded mini tree anymore but that item has a bold font instead

These icons are implemented for all functions, even for importing from other .cfg files

A side note: The current x64 beta already supports icon indexes, the x32 isn't out yet
MiniTreeSwitcher_v0.5.6.xys
(9.24 KiB) Downloaded 53 times
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

Thanks highend for mini tree icon update. It's looking good. I noticed though that the drop down in the icon input dialog the script is adding a separator "|".
additional separator added.jpg
additional separator added.jpg (51.75 KiB) Viewed 2515 times
On a side note. We discussed earlier removing the "Save" menu item when in full or maxi tree which you did already here:
$menu = regexreplace($menu, "^Save.+?(\r?\n|$)");
It might be nice to actually do a replacement for "Save" when in maxi to have the "Mini tree from here" (from View | Mini tree | "Mini tree from here") which is simply CID #518. So when in Maxi tree a user could click on "Mini tree from here" to make a new mini tree without having to go through the normal menu to do it. When you use that menu item it will automatically sense your in mini tree and the "Save" menu item automatically comes up. It does for me.

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

Re: MiniTreeSwitcher

Post by highend »

It might be nice to actually do a replacement for "Save" when in maxi to have the "Mini tree from here" (from View | Mini tree | "Mini tree from here") which is simply CID #518
I'll add that.

Attach your MiniTreeSwitcher.cfg file (or send it via pm if your trees are too private)
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

I sent my cfg file via email. There's no carry over of double or triple "|' in the cfg file. Even though "Mini tree from here" is in the context menu which you have already, it'll probably be good to have direct access to that particular menu item. Thanks.

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

Re: MiniTreeSwitcher

Post by highend »

Try the new version:
MiniTreeSwitcher_v0.5.7.xys
(9.67 KiB) Downloaded 59 times
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

Side question nothing to do with anything else we've discussed. Why on SC getkey through out the script do you have 5 fields? I only see 4 in the help file. SC setkey has 5 fields.
getkey(key, section, [INIfile], [flags])
$icon = getkey("Icon", $section, $cfgFile, , "");

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

I hadn't tried the delete mini tree menu item until now. This is what I get when I select it. It looks like the proper SC inputselet dialog, but the title looks like the sort title. Odd since I see this in the script:

Code: Select all

function del_trees($cfgFile, $w, $h) {
    $listData = get_section_listdata($cfgFile);
    $sections = inputselect("Select mini tree(s)...", $listData, <crlf>, 1+2+32+1024+8192, , $w, $h, 11:="|");
It appears that it's using the variable $header from the sort funcition.
Delete menu item displays is inputselect but it looks like a sort title.jpg
Delete menu item displays is inputselect but it looks like a sort title.jpg (26.87 KiB) Viewed 2487 times

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

Re: MiniTreeSwitcher

Post by highend »

Why on SC getkey through out the script do you have 5 fields?
Just an oversight
It looks like the proper SC inputselet dialog, but the title looks like the sort title
Not here?

Latest version adds the default icon "*.<DIR>" to all places, even when no icon is given for e.g. a mini tree to save / import.
Otherwise you'll get ugly question mark icons in delete / reorder / import dialogs...
MiniTreeSwitcher_v0.5.8.xys
(9.74 KiB) Downloaded 51 times
One of my scripts helped you out? Please donate via Paypal

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

Re: MiniTreeSwitcher

Post by highend »

And here the latest version...

It checks icons for existence before displaying them and replaces non-existing ones with "*.<DIR>"...
MiniTreeSwitcher_v0.5.9.xys
(9.94 KiB) Downloaded 62 times
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

All seems to be working fine now. The delete mini tree dialog issue I brought up has resolved itself as well. Thanks highend.

Edit: The problem with the carry over header wasn't actually resolved until beta v28.10.0508 was issued.

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

Hi highend, I didn't want to mention it, but the bolding of the current mini tree really wasn't cutting it for me. It just didn't stand out enough especially in dark mode. So I came up with a solution that seems to work fine at least in my testing which included changing mini trees, toggling mini and maxi, along with using the other menu items. It brings back the star icon (:favs) for the current minitree. The normally assigned icon for the current mini tree returns as it should when that mini is no longer current. It maintains the bolding since it doesn't hurt having it along with the star. Not a big change, but it took me some time to figure out where to do it (and we've been without power and internet for the last couple of days).

Code: Select all

function get_cfg_menu_items($cfgFile) {
    $sections = getsectionlist(, $cfgFile);
    if (!$sections) { return ""; }
    $result = "";
    foreach($section, $sections, <crlf>, "e") {
        $icon    = getkey("Icon",   $section, $cfgFile);
        $icon    = set_default_icon($icon);
        $active  = getkey("Active", $section, $cfgFile);
        if($active) {$icon = ":favs"; $result .= "$section||$icon|$active<crlf>";}
        else {$result .= "$section||$icon|$active<crlf>";}
    }
    return trim($result, <crlf>);
}

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

Re: MiniTreeSwitcher

Post by highend »

Thats unnecessarily complicated:

Code: Select all

        if($active) {$icon = ":favs"; $result .= "$section||$icon|$active<crlf>";}
        else {$result .= "$section||$icon|$active<crlf>";}
Apart from that I've uploaded v0.6.0 which adds the option to configure this behavior...
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

Thanks unnecessarily complicated:
Complicated, no I only changed the 2 lines. I put the entire function in the post only for anyone other than you or I making it easier to make a change. But I see you put the option to use it as well. Thanks again highend. :tup:

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

Re: MiniTreeSwitcher

Post by highend »

What I meant is this:

Code: Select all

        if ($active) { $icon = ":favs"; }
No if / else necessary...
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4451
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7462 at 100% 2560x1440

Re: MiniTreeSwitcher

Post by klownboy »

OK gotcha, I repeated the $result with if/else and didn't need to. Thanks again. :party: It's good to have power and internet back :blackstorm: bad ice storm.

Post Reply