Page 1 of 1
Script to switch to details view + flat view on?
Posted: 01 Dec 2011 15:32
by ghost zero
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.
Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 17:00
by TheQwerty
Try this:
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 View
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)".
Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 17:28
by serendipity
How nice it would be to have toggle command.
Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 17:32
by ghost zero
thanks
Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 17:48
by TheQwerty
serendipity wrote:How nice it would be to have toggle command.

Pardon?
Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 18:15
by serendipity
TheQwerty wrote:serendipity wrote:How nice it would be to have toggle command.

Pardon?
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.
Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 18:53
by TheQwerty
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.
If you have enough CTBs you can use more than one to get different icons by having your script update the toolbar.
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");
and ctb32 with icon "<xypath>\XYcopy.exe":
Code: Select all
"Off"
Echo("Bye");
$tb = Toolbar();
$tb = Replace(",$tb,", ",ctb32,", ",ctb31,");
$tb = SubStr("$tb", 1, -1);
Toolbar("$tb");
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!

Re: Script to switch to details view + flat view on?
Posted: 01 Dec 2011 19:44
by serendipity
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!

Thanks! Nice little workaround there. But not very fond of toggles without true pressed state.