Author Topic: Filter + Custom commands broken?  (Read 14199 times)

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Filter + Custom commands broken?
« on: May 13, 2016, 12:43:24 »
Using MC 6.2 b2147 on W7x64

So far I found that neither of these would work, when I added them to buttons: -

MC.Explorer.Selection.Select FILTER=*.zip;*.rar
MC.Filesystem.Delete FILTER="*.zip;*.rar"


I tried with " " & without.

...or is it me?  :-\

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 510
  • Old Skull
    • View Profile
Re: Filter + Custom commands broken?
« Reply #1 on: May 13, 2016, 12:47:33 »
Try space instead of semicolon
Code: [Select]
FILTER="*.zip *.rar"

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Re: Filter + Custom commands broken?
« Reply #2 on: May 13, 2016, 12:50:48 »
Thanks Jungle
I had seen ; on the dialog help txt so used it, having forgotten the <space> option.   :)
Unfortunately with space it also fails - it only selects the first term  ???

I wanted to delete the archives where found so tried
Code: [Select]
MC.Filesystem.Delete FILTER="*.zip *.rar"
but no selection is made;  so added
Code: [Select]
MC.Explorer.Selection.Select FILTER=*.zip;*.rar
MC.Filesystem.Delete FILTER="*.zip;*.rar"

but MC then makes a single string (bad?)
Code: [Select]
MC.Explorer.Selection.Select FILTER="*.zip *.rar"MC.Filesystem.Delete FILTER="*.zip *.rar"
& that fails selecting only the zips.
« Last Edit: May 13, 2016, 13:03:32 by Ulfhednar »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Filter + Custom commands broken?
« Reply #3 on: May 13, 2016, 12:55:44 »
Thanks Jungle
I had seen ; in the manual so used it, having forgotten the <space> option.   :)
Unfortunately with space it also fails - it only selects the first term  ???

Some places uses ; for filter,  But Im moving away from that since ";" is actually a valid character in the file system

DELETE do not support "Filter" (anymore)
If you look in the UI Delete dialog you see that the filter section is disabled.It is disabled becuse of wierd issues.

but selection works
Code: [Select]
MC.Explorer.Selection.Select FILTER="*.txt *.zip"
« Last Edit: May 13, 2016, 12:57:40 by Mathias (Author) »

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Re: Filter + Custom commands broken?
« Reply #4 on: May 13, 2016, 13:06:31 »
Ahh OK thanks Mathias.
That explains it! :)
Hadn't been connecting the dialog state to the custom command creation.  I will go & stand at the back of the class....

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Re: Filter + Custom commands broken?
« Reply #5 on: May 13, 2016, 13:15:25 »
so should
Code: [Select]
MC.Explorer.Selection.Select FILTER="*.zip;*.rar"
MC.Filesystem.Delete
or
Code: [Select]
MC.Explorer.Selection.Select FILTER="*.zip;*.rar"MC.Filesystem.Deletework?

Sorry I'm double checking as I'm wondering about syntax now.

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 510
  • Old Skull
    • View Profile
Re: Filter + Custom commands broken?
« Reply #6 on: May 13, 2016, 13:40:24 »
AFAIK, custom commands support only one command. So to perform multiple action you probably should use MultiScript

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Filter + Custom commands broken?
« Reply #7 on: May 13, 2016, 13:51:34 »
so should
Code: [Select]
MC.Explorer.Selection.Select FILTER="*.zip;*.rar"
MC.Filesystem.Delete
or
Code: [Select]
MC.Explorer.Selection.Select FILTER="*.zip;*.rar"MC.Filesystem.Deletework?

Sorry I'm double checking as I'm wondering about syntax now.

Wrong..
Don't use ";" use space..

Code: [Select]
MC.Explorer.Selection.Select FILTER="*.zip *.rar"
MC.Filesystem.Delete

And if you want to do multiple commands, the command type must be MultiScript as Jungle said.

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Re: Filter + Custom commands broken?
« Reply #8 on: May 14, 2016, 11:00:57 »
Thanks guys.
I had tried with & without ;
As there have been a lot of additions to MultiScript in the last few months, I wanted to be sure that I wasn't missing something related to the script & custom commands.

I intend to try & put together a script at some point. 
To what degree must MultiScript, Custom Commands & calling external programs, all be 100% discrete.  (for making a button)
IIRC there is some leeway. 
I will experiment & create a few headaches...  :P


Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Filter + Custom commands broken?
« Reply #9 on: May 14, 2016, 11:39:41 »
To what degree must MultiScript, Custom Commands & calling external programs, all be 100% discrete.  (for making a button)
IIRC there is some leeway. 
I will experiment & create a few headaches...  :P
Notes ure what yo mean..

But all script type are different, for different uses.
External is just for launching an external program easy. You can do that with CC too, But it require more

CC command connect to command you see in the UI or that you can invoke from the UI as the user.  but you can often provide different default options and such.
CC command acts like it is the user.  They are made to be simple, and only one line per command is supported. (Because depending on command you don't know if you can run another command directly after it.. since the command is sent via the UI )

MultiScript are the more advanced, where you can have variables, define functions and such, loops and such. You can create whole new functions with MScript,
It have no idea of the UI. it connects the core function below the UI. It can be run in the background,
But it can call CC commands.  but the CC commands are run isolated.  Normal MScript function can return data and they know about variables and such..  CC commands don't.
When a CC command is found in the MScript it will just translate the entire row. and then send it to the CC engine, and then move on.


Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 510
  • Old Skull
    • View Profile
Re: Filter + Custom commands broken?
« Reply #10 on: May 14, 2016, 19:42:03 »
Ulfhednar
Just one addition. You may also create filter (Configuration > Filters...) and use

Code: [Select]
MC.Explorer.Selection.Select FILTERID=your_filter_id

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Re: Filter + Custom commands broken?
« Reply #11 on: May 15, 2016, 13:02:56 »
Thanks Mathias.
I was wondering about interconnectivity & your explanation makes it much clearer to me - the consideration of depth/layer at which these operate is something I am aware of. But I wasn't absolutely clear.  Maybe now fewer headaches for me. :D

Theoretically I could write a MS script that
selects zips (MS)
calls 7zip to extract & overwrite all older items (ext cmd)
selects zips (MS)
deletes the zips (CC)

I do not need to use a CC or external command but in that instance it should be possible.
I assume that that set of instructions could be improved by using MS alone & I can also try adding custom filters to the script via FilterLoadById.


Thanks Jungle ,I had been thinking of custom filters.  In the example above that could easily allow me select zips from a certain date or size perhaps. 


MC has become a hobby now, a toolbox to play with.  As usual I am trying to see ways of using these new features a) that are immediately useful to me & b) that are something I can play around with.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Filter + Custom commands broken?
« Reply #12 on: May 15, 2016, 16:08:04 »
Thanks Mathias.
I was wondering about interconnectivity & your explanation makes it much clearer to me - the consideration of depth/layer at which these operate is something I am aware of. But I wasn't absolutely clear.  Maybe now fewer headaches for me. :D

Theoretically I could write a MS script that
selects zips (MS)
calls 7zip to extract & overwrite all older items (ext cmd)
selects zips (MS)
deletes the zips (CC)

I do not need to use a CC or external command but in that instance it should be possible.
I assume that that set of instructions could be improved by using MS alone & I can also try adding custom filters to the script via FilterLoadById.


Thanks Jungle ,I had been thinking of custom filters.  In the example above that could easily allow me select zips from a certain date or size perhaps. 


MC has become a hobby now, a toolbox to play with.  As usual I am trying to see ways of using these new features a) that are immediately useful to me & b) that are something I can play around with.
No The only other type of command MultiScript can run is CC commands. But you can execute external program from CC or MScript

As I said it can be a problem is you start processes that are run in the background becuse the script can continue before the background job is finished.

So depending on how you do it.. the call to 7zip to extract will probably start a background operation and then continue. so you might delete files before the extraction is finished.
But it depends.

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 503
    • View Profile
Re: Filter + Custom commands broken?
« Reply #13 on: May 16, 2016, 11:53:00 »
Thanks, that was pretty much what I concluded Mathias. 
I could see in that example, that the script would need some way of pausing & waiting for the external program to complete before stepping forward.  I had not searched to see if that kind of function was available.
So I decided it might work, it might not, but ultimately in this case better to stick to MS so I have things all synchronized.

I still have the idea that I need to be able to write great scripts like Jungle ;)

Sorry for dragging you away from Eurovision Mathias  ;D