Script to switch to details view + flat view on?

Discuss and share scripts and script files...
Post Reply
ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Script to switch to details view + flat view on?

Post 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.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Script to switch to details view + flat view on?

Post 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)".

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script to switch to details view + flat view on?

Post by serendipity »

How nice it would be to have toggle command.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to switch to details view + flat view on?

Post by ghost zero »

thanks

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Script to switch to details view + flat view on?

Post by TheQwerty »

serendipity wrote:How nice it would be to have toggle command.
:? Pardon?

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script to switch to details view + flat view on?

Post 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.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Script to switch to details view + flat view on?

Post 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! :mrgreen:

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Script to switch to details view + flat view on?

Post 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! :mrgreen:
Thanks! Nice little workaround there. But not very fond of toggles without true pressed state.

Post Reply