MiniTrees

Discuss and share scripts and script files...
jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

MiniTrees

Post by jacky »

So at first I wasn't too excited or even sure I'd use this MiniTree feature, but it turns out to be a really awesome little thing! :D

---------------------------------------------------------------------------------------------------

UPDATE: Latest info on February 9, 2009 :

:arrow: The latest version of the script is 0.01.0013 and can be downloaded from here. Requires XY 7.90.0075 and common-jacky 0.01.0006

:arrow: Adding a new MT when there was already one (or more) saved could mess up the first ones' names, fixed.

:arrow: expanding nodes: when a location wasn't available, and if you continue script execution of course, others weren't expanded, fixed.

:arrow: Opening "submenu" "Load A Mini Tree" then going back, and showing all mini trees would have, afterwards, the last mini trees in list to be loaded, fixed.

:arrow: Like for loading MTs, you can load SaveMiniTree to save the current MT. You can preset some options through global variables: $MT_name for the name of the MT, $MT_expand_active to 1 or 0 whether or not expand active location, and $MT_lock_state to the new lock state (0, 1, or "r")
You can also set $MT_overwrite to 1 to overwrite an existing MT without confirmation. (Example below)

:arrow: added Configuration screen: now you can very easily add/remove MT, add/remove nodes, rename MT, change lock state, and set which nodes to be expanded just by clicking a checkbox!

---------------------------------------------------------------------------------------------------

UPDATE: Latest info on January 20, 2009 :

:arrow: The latest version of the script is 0.01.0010 and can be downloaded from here. Requires XY 7.90.0021 and common-jacky 0.01.0004

:arrow: "Edit Configuration File" now done directly inside XY

:arrow: When saving a MT for the first time, it wasn't added to the list of saved minitrees (!), fixed.

---------------------------------------------------------------------------------------------------

UPDATE: Latest info on January 18, 2009 :

:arrow: The latest version of the script is 0.01.0009 and can be downloaded from here. Requires XY 7.90.0021 and common-jacky 0.01.0004

:arrow: Mostly internal changes. Note that to load MiniTrees from a script of yours, the global variable ($tmp_gbl) is now called $MT_name !

---------------------------------------------------------------------------------------------------

UPDATE: Latest info on January 9, 2009 :

:arrow: The latest version of the script is 0.01.0007 and can be downloaded from here. Requires XY 7.90.0021 and CJ 0.01.0002

:arrow: Reorganized the menu (moved items, hide some as well)

:arrow: Added option to "Show All Mini Trees" -- will use HTML by default, it's cool ;) and I liked it better to see which nodes were to be expanded. To be honest though, I added that by the end of last year I think (just failed to share yet :oops:) and it was text then, so the HTML can be turned off by adding under [Settings] inside the INI file: NoHTML=1

---------------------------------------------------------------------------------------------------

UPDATE: Latest info on December 26, 2008 :

:arrow: The latest version of the script is 0.01.0006 and can be downloaded from here. Requires XY 7.80.0032

:arrow: There's a new dependency, in form of an additional script file (common-jacky.xys) that you can download from here. This new script will allow different scripts to use the same "features" without having to pack all the same codes, etc It's a "library", can't be loaded on its own (I mean it can be, but it won't do nothing ;)).

:arrow: Now updates are done through XYplorer Automatic Updater -- meaning it is required to have it to check for updates, but you can have it check for updates automatically (and download the new version) when it checks for updates of XY! :)

:arrow: Added "Remove Nodes For Subfolders Of Current Location"

:arrow: Added an option so you define whether the Tree should be locked or not when loading a MT

:arrow: Also, if you manually edit the INI file, prefixing a path with a plus sign ( + ) will mean that it will be fully expanded on the loaded MiniTree ! Additionally, you can set the option to whether or not Lock the Tree to "r" so it remains unaffected (It's used directly to command setting, so "r" means "restore user value" - i.e. does nothing).

:arrow: Added "hidden" items, so you need to click on "Show Full Menu" to see them. In there have been put the changelog and items relating to updates, as well as a new one "Edit Configuration File..." (opens the INI file)

---------------------------------------------------------------------------------------------------

UPDATE: Latest info on December 5, 2008 :

:arrow: New version of the script, available from here. Requires XY 7.80.0032

:arrow: Removing node now done using command loadtree

:arrow: Expand folders (on loading MT) didn't work if folders were hidden on List, fixed.

:arrow: And a few internal changes...

Original post below:
---------------------------------------------------------------------------------------------------


I've been using it about all the time now, and here's a little script I came up with that maybe some might find useful as well. It allows to
- Add a node for current location
- Remove the node of current location (will need to rebuild MiniTree)
- Save current minitree
- Load a saved minitree

When saving, you can also define whether or not the active location will be (fully) expanded or not.

Examples: Save/Load your mini trees in one click/KS
Here's a little example of how to write a quick script to load a previously saved MiniTree directly -- a script you can put on your Catalog, UDC with KS to it, etc

Code: Select all

"Load &Test MiniTree"
	// Set the name of the MT in global var $MT_name
	global $MT_name;
	$MT_name = "Test";
	// and just load the right script, obvious if you didn't call the file above "MiniTrees.xys" you'll need to adjust it:
	load "MiniTrees", "LoadMiniTree";
And the same, but to save a mini tree this time :

Code: Select all

"&Save Current MiniTree"
  global $MT_name, $MT_expand_active, $MT_lock_state, $MT_overwrite;
  // You can set the name of the mini tree -- otherwise you will be prompted to enter a name
  $MT_name = "Test";
  // You can define whether or not to expand the active/first node -- otherwise a popup asking will be shown
  $MT_expand_active = 0;
  // You can define the lock state (0=unlocked, 1=locked, r=unchanged) -- otherwise a popup asking will be shown
  $MT_lock_state = 'r';
  // You can force overwriting an existing mini tree without confirmation
  $MT_overwrite = 1;
  // and now we save it!
  load "MiniTrees", "SaveMiniTree";
Last edited by jacky on 09 Feb 2009 15:30, edited 10 times in total.
Proud XYplorer Fanatic

RalphM
Posts: 2089
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: MiniTrees

Post by RalphM »

Jacky, thanks for that script.
It seems your coding scripts faster, than Don is able to implement these functions in XY natively, he he.
Ralph :)
(OS: W11 25H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: MiniTrees

Post by j_c_hallgren »

jacky wrote:When saving, you can also define whether or not the active location will be (fully) expanded or not.

Code: Select all

	setkey confirm("When loading this MiniTree, should the active location be expended ?"), $name, "Expand", "MiniTrees.ini";
Notice a typo in this caption? "e" vs "a"...
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

Glad you guys like it :)
Thanks jc, fixed.

EDIT: And a quick little change to Fully Collapse (#1010;) when removing node, otherwise it wouldn't actually work when the current node had subfolders!
Proud XYplorer Fanatic

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: MiniTrees

Post by j_c_hallgren »

I'll be the first to admit that I'm quite a bit behind when it comes to scripting (which may be a good thing as I can thus more experience things as a typical newbie user), so tried this script and having a few issues that I'd like some pointers with, ok, jacky?

1) How did you have this script setup to run? Via User>Load Script? That's how I have it as of now...

2) When I run it, and the first choice I make is one that is somewhat illogical but still possible, like "Load Mini Tree" or "Delete Mini tree", I get a popup with two choices "|-" and "<<Back"...I don't get this...sorry!

3) If I choose "<<Back", I get to prior menu...ok...but it's now at a different location on screen each time...I realize this isn't fault of your script, but chasing menu all over screen isn't ideal either.

4) If I choose "|-", I get "scripting error : |- is not a valid cmd"..??

5) If I select "Load test mini tree" (what exactly is this intended for, is first part of question), I get "scripting error - the curr script appears to be recusive - stack depth is 4"...huh?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

j_c_hallgren wrote:I'll be the first to admit that I'm quite a bit behind when it comes to scripting (which may be a good thing as I can thus more experience things as a typical newbie user), so tried this script and having a few issues that I'd like some pointers with, ok, jacky?
No.
Proud XYplorer Fanatic

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

:mrgreen: j/k of course!
j_c_hallgren wrote:1) How did you have this script setup to run? Via User>Load Script? That's how I have it as of now...
Well, truth is right now I load it from another script file, but I'm thinking of adding another more direct ways to call it, haven't decided what was best yet though. But anyways, really it doesn't matter, UDC, Catalog, AB, it's all the same. Pick what suits you best!
j_c_hallgren wrote:2) When I run it, and the first choice I make is one that is somewhat illogical but still possible, like "Load Mini Tree" or "Delete Mini tree", I get a popup with two choices "|-" and "<<Back"...I don't get this...sorry!
No I'm sorry, that was a bug :oops: I didn't fully tested it from scratch, just from me using it, and that part (when no minitrees had been saved) wasn't working properly, fixed now -- thanks.
j_c_hallgren wrote:3) If I choose "<<Back", I get to prior menu...ok...but it's now at a different location on screen each time...I realize this isn't fault of your script, but chasing menu all over screen isn't ideal either.
Yep, it's been talked about before, but that's the way XY works, nothing me or you can do about it. Actually, you could use keyboard and not move the mouse to have it stay at the same position, but that's not really the point.
j_c_hallgren wrote:4) If I choose "|-", I get "scripting error : |- is not a valid cmd"..??
Yep, that's the bug from 2) -- won't happen again.
j_c_hallgren wrote:5) If I select "Load test mini tree" (what exactly is this intended for, is first part of question), I get "scripting error - the curr script appears to be recusive - stack depth is 4"...huh?
Alright, two things here :
- The point of this thing. Right, I put that in there and forgot to talk about it :roll: That was just an example (for whomever may be interested) of how one can use this to load a previously saved minitree from one script, that can be put on Catalog or assign a KS to, etc So you don't always have to click "Load MiniTree..." and click the one you're looking for.

So to use this, you need to actually first save a minitree and call it "Test", then this will load said MT right away. I've taken that part out anyways, makes more sense like this (plus my own MiniTrees.xys don't have this, so it's easier (for me) anyways)

- About the recursion warning, I'm not really sure... I tried with a fresh XY and I get an error, but on command loadtree with an empty list of nodes. It might be because you had clicked a few times on the menus (using "Load", "Back", "Delete", Back", and so on) and so the recursion checked kicked in, I guess.
And now when trying to load a non-existing MT you should get an error message from the script.
Proud XYplorer Fanatic

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: MiniTrees

Post by j_c_hallgren »

Thanks jacky for the updated vers! Works better now...BTW, could there be some sort of a change log/comment at the beginning of your scripts like this so it's easier to tell if there has been a revision?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

:arrow: New version of the script, available from here. Requires XY 7.80.0032

:arrow: Removing node now done using command loadtree

:arrow: Expand folders (on loading MT) didn't work if folders were hidden on List, fixed.

:arrow: And a few internal changes... (including a changelog ;))
Proud XYplorer Fanatic

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

:arrow: The latest version of the script is 0.01.0006 and can be downloaded from here. Requires XY 7.80.0032

:arrow: There's a new dependency, in form of an additional script file (common-jacky.xys) that you can download from here. This new script will allow different scripts to use the same "features" without having to pack all the same codes, etc It's a "library", can't be loaded on its own (I mean it can be, but it won't do nothing ;)).

:arrow: Now updates are done through XYplorer Automatic Updater -- meaning it is required to have it to check for updates, but you can have it check for updates automatically (and download the new version) when it checks for updates of XY! :)

:arrow: Added "Remove Nodes For Subfolders Of Current Location"

:arrow: Added an option so you define whether the Tree should be locked or not when loading a MT

:arrow: Also, if you manually edit the INI file, prefixing a path with a plus sign ( + ) will mean that it will be fully expanded on the loaded MiniTree ! Additionally, you can set the option to whether or not Lock the Tree to "r" so it remains unaffected (It's used directly to command setting, so "r" means "restore user value" - i.e. does nothing).

:arrow: Added "hidden" items, so you need to click on "Show Full Menu" to see them. In there have been put the changelog and items relating to updates, as well as a new one "Edit Configuration File..." (opens the INI file)
Proud XYplorer Fanatic

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

:arrow: The latest version of the script is 0.01.0007 and can be downloaded from here. Requires XY 7.90.0021 and CJ 0.01.0002

:arrow: Reorganized the menu (moved items, hide some as well)

:arrow: Added option to "Show All Mini Trees" -- will use HTML by default, it's cool ;) and I liked it better to see which nodes were to be expanded. To be honest though, I added that by the end of last year I think (just failed to share yet :oops:) and it was text then, so the HTML can be turned off by adding under [Settings] inside the INI file: NoHTML=1
Proud XYplorer Fanatic

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

:arrow: The latest version of the script is 0.01.0009 and can be downloaded from here. Requires XY 7.90.0021 and common-jacky 0.01.0004

:arrow: Mostly internal changes. Note that to load MiniTrees from a script of yours, the global variable ($tmp_gbl) is now called $MT_name !
Proud XYplorer Fanatic

RalphM
Posts: 2089
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: MiniTrees

Post by RalphM »

Could it be, that MiniTrees is broken?

I just started using it today (with the current releases of MiniTrees and CJ), thus had a MT active and saved it via MiniTrees under a name.
This created a MiniTrees.ini with the following content:

Code: Select all

[List]
[Nodes]
Favoriten=C:\Daten\Privat\|C:\Daten\Privat\Andere Personen\xxx|C:\Daten\Privat\Andere Personen\yyy\|C:\Daten\Setups\XYplorer\|C:\Dokumente und Einstellungen\All Users\C:\Programme\XYplorer\NewItems\|C:\TEMP\E-Mail_Anlagen neu\|C:\TEMP\Scans\
[Expand]
Favoriten=0
[Lock]
Favoriten=0
But when I try to load this MT with the corresponding function from MiniTrees, I get a menu with the only item being "no saved Mini Trees".
Shouldn't there be some entry for it in the
  • section as well?
Ralph :)
(OS: W11 25H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

RalphM wrote:Could it be, that MiniTrees is broken?
Oh God! :oops: Yes, you're right it's not working right on first use (EDIT: since v0.01.0008, 2009.01.12), and "forgets" to add an entry under
  • ! Sorry about that, fixed -- new version is up.

    And you can edit your INI and simply add this under
    • :

      Code: Select all

      MiniTrees=Favoriten
      Then your saved MT will be recognized/listed as expected.
Last edited by jacky on 20 Jan 2009 00:56, edited 1 time in total.
Proud XYplorer Fanatic

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: MiniTrees

Post by jacky »

:arrow: The latest version of the script is 0.01.0010 and can be downloaded from here. Requires XY 7.90.0021 and common-jacky 0.01.0004

:arrow: "Edit Configuration File" now done directly inside XY

:arrow: When saving a MT for the first time, it wasn't added to the list of saved minitrees (!), fixed.
Proud XYplorer Fanatic

Post Reply