Command: SelectEx (extended Select command)

Here it is, thanks again!

SelectEx: CmdLine: SelectEx XLOG=all RANDOM FILES PATH="J:\00000000 Magicompilation\Pool" MAXSIZETOTAL=1000mb ITEMCOUNT=100 ECHO
SelectEx: SelectEx_RNDLINEAR():
SelectEx:     FROMCLIP            : undefined
SelectEx:     FROMFILE            : undefined
SelectEx:     FROMVAR             : undefined
SelectEx:     FROMVARDROP         : undefined
SelectEx:     TOCLIP              : undefined
SelectEx:     TOFILE              : undefined
SelectEx:     TOVAR               : undefined
SelectEx:     ITEM                : undefined
SelectEx:     NTH                 : undefined
SelectEx:     RANDOM              : true
SelectEx:     LINEAR              : undefined
SelectEx:     AUTO                : undefined
SelectEx:     SIMILARMETA         : undefined
SelectEx:     SIMILARMETAJS       : undefined
SelectEx:     FILTERDROP          : undefined
SelectEx:     FILTERLIST          : undefined
SelectEx:     MAKEVISIBLE         : undefined
SelectEx:     SKIPITEMSWITHPATH   : undefined
SelectEx:     SKIPITEMSWITHOUTPATH: undefined
SelectEx:     EXACT               : undefined
SelectEx:     GO                  : undefined
SelectEx:     GOPT                : undefined
SelectEx:     USEPATH             : undefined
SelectEx:     APPEND              : undefined
SelectEx:     INDEST              : undefined
SelectEx:     PATH                : J:\00000000 Magicompilation\Pool
SelectEx:     RECURSE             : undefined
SelectEx:     SETVAR              : undefined
SelectEx:     SETENV              : undefined
SelectEx:     FOLDERS             : undefined
SelectEx:     FILES               : true
SelectEx:     SINGLEFOLDER        : undefined
SelectEx:     SINGLEFOLDERMINCOUNT: undefined
SelectEx:     ITEMCOUNTRND        : undefined
SelectEx:     ITEMCOUNT           : 100
SelectEx:     ITEMCOUNTPERC       : undefined
SelectEx:     ACTION              : undefined
SelectEx:     NAME                : null
SelectEx:     MINSIZE             : undefined
SelectEx:     MAXSIZE             : undefined
SelectEx:     MAXSIZETOTAL        : 1048576000
SelectEx:     JSFILTER            : undefined
SelectEx:     JSBREAK             : undefined
SelectEx:     ECHO                : true
SelectEx:     COPYTOCOLL          : undefined
SelectEx:     COMMANDS            : undefined
SelectEx:     DESELECTNOMATCH     : undefined
SelectEx:     NODESELECT          : undefined
SelectEx:     XLOG                : all
SelectEx:     PT                  : undefined
SelectEx:     GET                 : undefined
SelectEx:     Scanning and pre-filtering..
SelectEx:         [J:\00000000 Magicompilation\Pool]..
SelectEx:     Picking items (1653 total)..
SelectEx:     Items (22):
J:\00000000 Magicompilation\Pool\Ghosts (Robbie Williams).wav
J:\00000000 Magicompilation\Pool\Bachelorette (Björk).wav
J:\00000000 Magicompilation\Pool\Dotti, medici e sapienti (Edoardo Bennato).wav
J:\00000000 Magicompilation\Pool\But Not For Me (Chet Baker).wav
J:\00000000 Magicompilation\Pool\Watermelon In East Hay (Frank Zappa).wav
J:\00000000 Magicompilation\Pool\C'Etait Toi [You Were The One] (Billy Joel).wav
J:\00000000 Magicompilation\Pool\Castles Made Of Sand (Jimi Hendrix).wav
J:\00000000 Magicompilation\Pool\Last December (Prince).wav
J:\00000000 Magicompilation\Pool\Inevitabilmente [Lettera dal carcere] (Enrico Ruggeri).wav
J:\00000000 Magicompilation\Pool\Bleecker street (Simon & Garfunkel).wav
J:\00000000 Magicompilation\Pool\To Love Somebody (Nina Simone).wav
J:\00000000 Magicompilation\Pool\Hymn (Ultravox).wav
J:\00000000 Magicompilation\Pool\Poppy (The Beautiful South).wav
J:\00000000 Magicompilation\Pool\Just can't get enough (Depeche Mode).wav
J:\00000000 Magicompilation\Pool\Ask (The Smiths).wav
J:\00000000 Magicompilation\Pool\Stranamore (Roberto Vecchioni).wav
J:\00000000 Magicompilation\Pool\Un Ottico (Fabrizio De André).wav
J:\00000000 Magicompilation\Pool\Street Worm (Spirit).wav
J:\00000000 Magicompilation\Pool\Un Uomo Da Bruciare (Renato Zero).wav
J:\00000000 Magicompilation\Pool\How Do You Sleep (John Lennon).wav
J:\00000000 Magicompilation\Pool\Non È Una Canzone D'amore (Enrico Ruggeri).wav
J:\00000000 Magicompilation\Pool\Underground (Tom Waits).wav
SelectEx:     Done.

Seems like the selection is working, so the problem must be in copy/move process.

It seems I accidentally removed an important piece, sorry. o) So please replace the line..

var cmd = data.func.command; tab.Vars.Set("SexRes") = "";

with..

var cmd = data.func.command, tab = data.func.sourcetab; tab.Vars.Set("SexRes") = "";

and try again.

It works perfectly! Thank you very very VERY much!

Really nice script. Great job tbone! Thanks

Updated to v0.5.3:
v0.5.2 - 1o/2o15

  • fix for inaccessable folders
  • new switch "NOFAIL" to prevent button from aborting in error situations (no items selected when trying to store selection e.g.)
  • new option CLEARVAR to remove stored selections in variables (supports multiple variables, separated by ";")
  • applying an empty selection container will give info message instead of error, but still fails the execution (override by NOFAIL if undesired)

v0.5.3 - o2/2o16 & o5/2o16

  • fix for FROMFILE creating nonexisting files
  • fix for TOFILE not creating nonexisting files
  • whenever a filter is set, a tab-scoped variable "Script.SelectEx.FilterEnabled" and "Script.SelectEx.FilterEnabled.bfc.drop" is created. The former allows a button to indicate a currently set filter in a folder by icon. The latter var is meant for use with the AutoVars addin (Event: AutoVars (event-handling for variables)), which will clear both vars and reset the indicator button automatically if it's installed.

Updated to v0.5.4:

  • fix for incorrect output informing about less selected files than expected
  • new option "ENCODING" to specify encoding of created files (unicode,ascii,default)
  • new option "EOL" to specify end of line characters (use "\r" for CR and "\n" for LF or any other text)
  • default eol for file and clipboard content will be "\r\n" from now on, if EOL option is not given
  • TOFILE and FROMFILE now automatically resolve DO aliases, libs and various other non standard paths
  • use of native url script property

A button with these commands does not works for me:

SelectEx NTH=2
Delete

The files are selected only. The delete command seems to do nothing.

Sending these two commands manually does work.

Any ideia why?

Yes, this is because of the unfortunate magic built into some of the native commands and the regular button engine.

If your button does not seem to make use of Select and there are no items currently selected, the Delete command will refuse to do it's job. It's the same for some other native commands iirc. To get around this, you need to add a dummy command at the top. This command will fool DO (or the Delete command) into thinking there are files selected and it will get to work eventually after SelectEx finished its selection. It's weird, I needed to try and was only lucky to remember this oddity, but that's how it is. o)

Select NONE
SelectEx NTH=2
Delete

These kind of irregularities make handling buttons and codes quite unpleasant at times.
This can drive sane people mad, right? o)

I understand now. Thank you for the script and for the help.

Updated to v0.5.5:

  • fix for files not being created if APPEND was used

Bug report, steps to reproduce:

  1. Enable 'grouped Flat View'. Files with identical names must be visible and there must be enough files to make the scroll bar visible.
  2. Select the last file which has the same name of another file, so that you can scroll up and it be out of sight.
  3. Use "SelectEx MAKEVISIBLE=selected".

Notice how all files with the same name as the one originally selected are selected, preventing scrolling to the intended file.

I will look into writing a patch to fix that if anyone else reproduce it (to rule out something else being the issue) - if the author does not.

Confirmed! Fix on the way! o)

1 Like

Feature request for random MP3 selection: select N files from inside selected folders. The way it is now, we can only random select a number of files from within a folder, or from all folders, after applying the flat view.

I'd like to select like 6 albums, getting a number of random MP3 files out of them. Also, it wouldn't be bad to have an additional function to send those files to the default player right away. In this case foobar.

:slight_smile:

Is there a method to use the Random select (say 100 files), move selection to a folder, then repeat until the original folders empty?

I think yes, that should work.. The easiest approach probably is something like this:
SelectEX RANDOM.. (etc.)
Copy MOVE Folder1
SelectEX RANDOM.. (etc.)
Copy MOVE Folder2
SelectEX RANDOM.. (etc.)
Copy MOVE Folder3

A more elegant solution would use a script to loop the 2 relevant commands multiple times and auto-generate the folder names of course. o)

SelectEx SIMILARMETAJS only works with one selected file, right?

So if in this list the bold ones are selected

File09
File17
File18
File19
File20
File21
File22
File30

SelectEx SIMILARMETAJS="return selItem.name.left(5)==item.name.left(5);" would select

File09
File17
File18
File19
File20
File21
File22
File30

instead of

File09
File17
File18
File19
File20
File21
File22
File30

Correct?

Could SelectEx be changed so it loops through selected files? After having a quick look at the source code I don't think I would find my way around any time soon.

Updated to v0.5.7:

  • add "selItems" (all selected files) to be used in SIMILARMETAJS/jsCompare()

Updated to v0.5.6:

  • fix for SelectEX MAKEVISIBLE USEPATH not working (error: Variable uses an Automation type not supported in JScript (0x800a01ca))
  • USEPATH switch by default for MAKEVISIBLE to prevent unwanted multiple selections if items with same name exist in flatview

@andersonnnunes
Your reported SelectEx MAKEVISIBLE bug should be fixed by now, sorry for taking so long and thx! o)

@lxp
Maybe try the updated version and run the line below. Tested here, it worked! o)

SelectEx SIMILARMETAJS="for(var i=0;i<selItems.count;i++) {if (selItems(i).name.left(5)==item.name.left(5)) return true;}"
1 Like

Yes! Works! That was quick! I am impressed! Thanks a lot!

@tbone: Sorry if these ideas were already discussed above (I've already exceeded my procrastination-time/-budget reading the Opus forum by a solid 3–4 hours today). :crazy_face:

I have two suggestions for improvement of SelectEx:

  1. There's no indication that filters activated by SelectEx, are in fact engaged, which can lead to confusion since it's easy to think that there are no items in a folder, when there are. On the other hand, if I use DOpus own filter bar, I have a different background color going on in the file list (see screenshot). Is it possible to achieve such background color or at least some sort of "filters are in play" indication with SelectEx?

  1. Resizable multi-filter list, preferably auto-resized to show all your filters (possibly too complicated)?

Snag_118aa96

Thanks for all your great Opus contributions!