Script to switch to details view + flat view on?
-
ghost zero
- Posts: 842
- Joined: 26 Apr 2010 17:48
Script to switch to details view + flat view on?
Anyone know how to make a script to switch to details view + flat view on? And if I'm already in flat view, I want it to switch back to list view + flatview off. Thanks.
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Script to switch to details view + flat view on?
Try this:It's more complicated than you'd expect since the various change View commands are all toggles, so blindly calling #302 when already in Details view would select the previous view instead.
Also, if you use this to switch to flat view while already using "Details w/ Thumbnails" then it will not change to just "Details" view. If you really want to ALWAYS enter "Details" view then change "elseif ($view > 1)" to "elseif ($view > 0)" or "elseif ($view != 0)".
Code: Select all
"Flat Details Toggle"
$view = Get('View' , 'a'); // Retrieve current view.
$flat = Tab('Get', 'Term'); // Retrieve tab's term.
$flat = RegexReplace($flat, '^.*\?.*?:flat.*?$','FLAT VIEW');
if ($flat == 'FLAT VIEW') {
// If not already in List view...
if ($view != 2) {
#304; //View | Tab | Views | List
}
// Else if not already in Details or Details w/ Thumbnails view.
} elseif ($view > 1) {
#302; //View | Tab | Views | Details
}
#311; //View | Tab | Views | Flat ViewAlso, if you use this to switch to flat view while already using "Details w/ Thumbnails" then it will not change to just "Details" view. If you really want to ALWAYS enter "Details" view then change "elseif ($view > 1)" to "elseif ($view > 0)" or "elseif ($view != 0)".
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: Script to switch to details view + flat view on?
How nice it would be to have toggle command.
-
ghost zero
- Posts: 842
- Joined: 26 Apr 2010 17:48
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Script to switch to details view + flat view on?
serendipity wrote:How nice it would be to have toggle command.
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: Script to switch to details view + flat view on?
Sorry, I did not mean to say anything about your script. I was posting a wish that it would be nice to have a toggle script command for the buttons.TheQwerty wrote:serendipity wrote:How nice it would be to have toggle command.Pardon?
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Script to switch to details view + flat view on?
If you have enough CTBs you can use more than one to get different icons by having your script update the toolbar.serendipity wrote:Sorry, I did not mean to say anything about your script. I was posting a wish that it would be nice to have a toggle script command for the buttons.
For instance using ctb31 with icon "<xypath>\<xyexe>":
Code: Select all
"On"
Echo("Hi");
$tb = Toolbar();
$tb = Replace(",$tb,", ",ctb31,", ",ctb32,");
$tb = SubStr("$tb", 1, -1);
Toolbar("$tb");Code: Select all
"Off"
Echo("Bye");
$tb = Toolbar();
$tb = Replace(",$tb,", ",ctb32,", ",ctb31,");
$tb = SubStr("$tb", 1, -1);
Toolbar("$tb");-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Re: Script to switch to details view + flat view on?
Thanks! Nice little workaround there. But not very fond of toggles without true pressed state.TheQwerty wrote:Unfortunately, you don't get the true pressed state but it's better than nothing and gives you the ability to have a single button with up to 32 different states!
XYplorer Beta Club