Method - XYscriptsGrouping
Posted: 20 Jul 2015 11:37
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:
- 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.
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.
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.
____________
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".
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:
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
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
-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.
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;
It'll also display the count of each submenu's scripts.
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.
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.
____________
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 %%%"
Code: Select all
"***group 1***"
"_____most used______"
"((( MIGHT HAVE USE )))"
"@@@ excluded @@@"
"%%% LAST SET %%%"
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 %%%"
#;First, remove everything inside of it, leaving it like
Code: Select all
$a = <<<#
#;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.