Method - XYscriptsGrouping

Discuss and share scripts and script files...
Post Reply
SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Method - XYscriptsGrouping

Post by SkyFrontier »

This have relation with Using "Load" to bring up a sub menu and Help with a Back Button.
It's my honest attempt to solve the quest for the holy back button grail.

This thing will automatically group any number of scripts into submenus if their number exceeds the height of your screen monitor (prediction not fully tested as I couldn't run this into other machines - and I'm not in condition to mess with this one's, sorry!). With minimum effort, this number can be tweaked.

All you have to do is feed the "$a" variable with a valid list of scripts like:

Code: Select all

"script 1"
 commands;
"script 2" commands;
"script 3"
 commands
...
"script 90"
 commands;
- Captions are a must, as usual syntax demands when it comes to multi-scripts. Tip: use the support_consolidateScripts_by_SF.xys support script which does the job of creating a consolidation of selected scripts, auto-adding caption for those ones missing it.

It'll also display the count of each submenu's scripts. :P

The script does the tricky part of building a list of script reference labels, allowing a fully functional "BACK" button, providing a smooth back-and-forth navigation thru the groups.

Hard as hell, but I finally made it. :beer:

Congrats to totmad1, who gave me the initial insight towards this solution. I still think this should be easier to produce, but I'm glad I could do it. The hardest way, but I'm finally finished.

Enjoy. :ball:
____________
P.S.: feedbacks are very welcome on this, specially concerning bugs or any sort of malfunction as it relies severely on strict common (to me!) script constructions.
done, v2: split on predefined markers instead of dumb auto-groups.

____________
P.P.S.:

Tips on How to Add Group Delimiters

General guidance:
-set a simple caption, no script attached to it, immediately _below_ the group of scripts it will hold. This caption will name the respective group on the main menu.
-logically, the last group will need a caption - it'll be the last entry at the "$a" variable. If the last caption missing, the last entry on the main menu will still work, ie: will have an accelerator, have an empty name field plus respective items count.
The following code has grouping marks, ready to be used along "XYscriptGroups_v2_uSERsETgROUPS_by_SF.xys".

Code: Select all

"exitnosave|:exitnosave"
   copytext ":exitnosave"
"rfo|:rfo"
   copytext ":rfo"
 echo hi;
"mru|:mru"
   copytext ":mru"
"myco|:myco"
   copytext ":myco"
"***group 1***"
"flatview|:flatview"
   copytext ":flatview"
"views|:views"
   copytext ":views"
"minitree|:minitree"
   copytext ":minitree"
"dp12|:dp12"
   copytext ":dp12"
"_____most used______"
"newtab|:newtab"
   copytext ":newtab"
"closetab|:closetab"
   copytext ":closetab"
"locktab|:locktab"
   copytext ":locktab"
"((( MIGHT HAVE USE )))"
"{drives_avl}|:{drives_avl}"
   copytext ":{drives_avl}"
"{drives_fix}|:{drives_fix}"
   copytext ":{drives_fix}"
"@@@ excluded @@@"
"ctb64|:ctb64"
   copytext ":ctb64"
 echo hi;
"%%% LAST SET %%%"
Open the script with a text editor (or rename its extension from .xys to .txt and open it using your default text editor) and paste the above set as a value for "$a". As you can see when you run the script, you'll have 5 categories:

Code: Select all

"***group 1***"
"_____most used______"
"((( MIGHT HAVE USE )))"
"@@@ excluded @@@"
"%%% LAST SET %%%"
holding a number of scripts.
Each category is set by putting all desired scripts immediately above it. Like this:
"scr 1"
commands
"scr 2"
commands
"group 1"

Group 1 will have "scr 1" and "scr 2" in a submenu. Continuing,
"scr 1"
commands
"scr 2"
commands
"group 1"
"scr 3"
commands
"scr 4"
commands
"group 2"

Now you told my script to group "scr 3 & 4" in a "group 2", so the final menu will appear like
"1 - group 1 - 1 item(s)"
"2 - group 2 - 2 item(s)"
-standard: "accelerator - user input group name - item count".

The "$a" variable can be found near the top of the script and looks like

Code: Select all

   $a = <<<#
"exitnosave|:exitnosave"
   copytext ":exitnosave"
...
"ctb64|:ctb64"
   copytext ":ctb64"
 echo hi;
"%%% LAST SET %%%"
#;
Your only work is to replace the default set of scripts with your own one. The file generated by support_consolidateScripts_by_SF.xys will do.
First, remove everything inside of it, leaving it like

Code: Select all

   $a = <<<#
#;
-observe that the "#;" characters MUST stay, otherwise everything will be flushed!

Then, position your caret in front of the '#;' and paste your set of scripts (or the entire content of support_consolidateScripts_by_SF.xys). Make sure that '#;' remain immediately below the pasted content, set the captions as described and execute the script.
Attachments
support_consolidateScripts_by_SF.xys
(835 Bytes) Downloaded 113 times
XYscriptGroups_v2_uSERsETgROUPS_by_SF.xys
(9.29 KiB) Downloaded 206 times
XYscriptsGrouping_v1_5_by_SF.xys
(8.37 KiB) Downloaded 115 times
Last edited by SkyFrontier on 25 Jul 2015 07:31, edited 3 times in total.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Method - XYscriptsGrouping

Post by SkyFrontier »

v2 - user defined grouping/captions (split on predefined markers instead of dumb auto-groups.)
:ninja:

Code: Select all

                                 *** How to Attribute Groups ***
-set a simple caption, no script attached to it, immediately _below_ the group of scripts
 it will hold. This caption will name the respective group on the main menu.
-logically, the last group will need a caption - it'll be the last entry at the "$a" variable.
--if the last caption missing, the last entry on the main menu will still work, ie: will have
--an accelerator, have an empty name field plus respective items count.
Direct download: http://www.xyplorer.com/xyfc/download/file.php?id=7570
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Method - XYscriptsGrouping

Post by SkyFrontier »

Updated the first post with a support script that gets your collection of scripts ready to feed the "$a" variable.
New tips are added, either.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply