Multi Commander Support Forum

Multi Commander => Script => Topic started by: matm on November 20, 2011, 21:15:19

Title: Toggle filter function
Post by: matm on November 20, 2011, 21:15:19
Hello

I would like to have a button that toggle display filter on/off. for this to work, I need to know the state of my filter.
Is there some MC.Explorer.GetViewFilter  that can retrieve the current filter, or a way to test if a certain kind of file is displayed ?

I would expect doing something like that :

Code: [Select]
@var $filter = "-*.log"

if ( StrIsEqual({MC.Explorer.GetViewFilter}, $filter))
{
     MC.Explorer.SetViewFilter FILTER={$filter}
}
else
{
    MC.Explorer.SetViewFilter FILTER="*.*"
}

Is there already some stuff to do that ?

Regards

Mathias (yes, you read well)
Title: Re: Toggle function
Post by: matm on November 20, 2011, 21:17:16
Also, the http://multicommander.com/docs/customcommands_list is empty. Is this expected ?
Title: Re: Toggle filter function
Post by: Mathias (Author) on November 20, 2011, 22:33:28
No there is no "MC.Explorer.GetViewFilter" But sounds like a good idea to add.

I will add that to the next release.


(edit)
After thinking about it, It might not be so easy to fix. This "Custom commands" can not return sometime to the script engine.  Yet.
But I will see if i can figure out a solution for it.
Title: Re: Toggle filter function
Post by: Mathias (Author) on November 22, 2011, 20:11:56
In the latest Beta RC (874)

this can work now.

Code: [Select]
@var $filter = "-*.log"
@var $currentFilter;
MC.Explorer.GetViewFilter
$currentFilter = $__CMDRESULT;

if(StrIsEqual($currentFilter, $filter))
{
  MC.Explorer.SetViewFilter FILTER="*.*"
}
else
{
  MC.Explorer.SetViewFilter FILTER={$filter}
}
Title: Re: Toggle filter function
Post by: matm on November 25, 2011, 00:12:39
Nice. That's great !

TY

When do you plan the next stable (even a range) ? :)
Title: Re: Toggle filter function
Post by: Mathias (Author) on November 26, 2011, 10:53:30
Va none beta version of 1.2.1 is planed for this weekend. (today or tomorrow)