branch view: toggle states
-
Gabrielle
- Posts: 57
- Joined: 28 Apr 2012 00:57
branch view: toggle states
is there a way I can toggle branch view states, folders only, files, folders+files by just pressing a button?
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: branch view: toggle states
Sure...
Use this script for a button.
Use this script for a button.
Code: Select all
perm $P_CURRENT_BRANCH_VIEW_STATE;
$state1 = "<curpath> ? /:flat"; // files & folders
$state2 = "<curpath> ? /:flatfiles"; // files only
$state3 = "<curpath> ? /:flatdirs"; // folders only
if ($P_CURRENT_BRANCH_VIEW_STATE == "" || $P_CURRENT_BRANCH_VIEW_STATE == 3) {
goto $state1;
$P_CURRENT_BRANCH_VIEW_STATE = 1;
} else {
$P_CURRENT_BRANCH_VIEW_STATE++;
$newState = eval("$state" . $P_CURRENT_BRANCH_VIEW_STATE);
goto $newState;
}One of my scripts helped you out? Please donate via Paypal
-
Gabrielle
- Posts: 57
- Joined: 28 Apr 2012 00:57
Re: branch view: toggle states
thanks, thanks, thanks!
=))
=))
-
Gabrielle
- Posts: 57
- Joined: 28 Apr 2012 00:57
Re: branch view: toggle states
is there a way to have a 4th state, toggling it off...???
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: branch view: toggle states
and a fifth state to toggle it on?^^
Code: Select all
// Toggle branch view states per button
perm $P_CURRENT_BRANCH_VIEW_STATE;
$state1 = "<curpath> ? /:flat"; // files & folders
$state2 = "<curpath> ? /:flatfiles"; // files only
$state3 = "<curpath> ? /:flatdirs"; // folders only
if ($P_CURRENT_BRANCH_VIEW_STATE == 3) {
#311;
$P_CURRENT_BRANCH_VIEW_STATE = 0;
} elseif ($P_CURRENT_BRANCH_VIEW_STATE == "") {
goto $state1;
$P_CURRENT_BRANCH_VIEW_STATE = 1;
} else {
$P_CURRENT_BRANCH_VIEW_STATE++;
$newState = eval("$state" . $P_CURRENT_BRANCH_VIEW_STATE);
goto $newState;
}
Last edited by highend on 07 Apr 2013 09:38, edited 1 time in total.
One of my scripts helped you out? Please donate via Paypal
-
FluxTorpedoe
- Posts: 906
- Joined: 05 Oct 2011 13:15
Re: branch view: toggle states
Hi'
This is quickly extracted and adjusted from one of my buttons, but it should do what you want (with on/off):Another approach too. Lots of way to get to the same result in XY...
That's why we love it!
This is quickly extracted and adjusted from one of my buttons, but it should do what you want (with on/off):
Code: Select all
if (tab("get", "term") UnLike "*:flat*") { // If not branch > branch
goto tab(get, "term")."? /:flat";
} else {
if (tab(get, "term") Like "*/:flat") { // If default branch > flatfiles
goto tab(get, "term")."files";
} elseif (tab(get, "term") Like "*/:flatfiles") { // If flatfiles > flatdirs
goto replace(tab(get, "term"), "/:flatfiles", "/:flatdirs");
} else { // If flatdirs > unbranch
goto replace(tab(get, "term"), "? /:flatdirs", "");
}
}That's why we love it!
• Scripts: Session Manager
| SlideShow | Collection Manager | Power Launcher | Akelpad syntax highlighting | ...
-
Gabrielle
- Posts: 57
- Joined: 28 Apr 2012 00:57
Re: branch view: toggle states
thanks a bunch, guys! exactly what I needed for a much needed feature like branch view is!
XYplorer Beta Club