SelectEx - a script-addin for extended "Select" functionality. It tries to combine and enhance on some (unmaintained) contributions. This add-in allows you to remove several standalone scripts from your configuration and tries to be as versatile as the native Select command already is. You can make use of popular Select switches like MAKEVISIBLE, NODESELECT, DESELECTNOMATCH e.g., just like you're used to.
Features summary:
- automatic selection of specific items after entering a folder
- select a single item with full path (not covered by native Select)
- select items from clipboard, file, memory
- store selected items to clipboard, file, memory (optional append)
- scroll selected or checkboxed items into view (makevisible)
- select randomly by number, size, name, type
- select linearly by number, size, name, type
- select by metadata (image-size or mp3-artist or just item-name e.g.)
- select by (multiple) predefined filters (dropdown or checkboxed-list)
- select every n-th item
Menu-Button & Preview:
SelectEx_MenuButton_v0.2.dcf (2022.01.30) (39.7 KB)
SelectEx_MenuButton_v0.1.dcf (18 KB)
Includes generic/enhanced variants of following addins:
- "SelectFromTxt (select files from text file)" (Command: SelectFromTxt (select files from text file))
- "Select every nth files in a lister" (Select every nth files in a lister)
- "SelectRandom" (Command: SelectRandom (randomly select files/folders))
- "Auto-select items when entering folders" (Auto-select certain files when entering certain folders)
- "Select by Filter buttons" ("Select By Filter" menu button)
- "Select Similar Dimensions" menu button" ("Select Similar Dimensions" menu button)
- "ScrollSelectionIntoView" (Command: ScrollSelectionIntoView)
Thanks for sharing goes out to: AlbatorV, Aussieboykie, Leo and YankeeZulu o)
Main command line switches:
- FROMFILE Select items from a file (needs to be ANSI, ASCII or UNICODE (UTF16-LE))
- FROMCLIP ..from clipboard
- FROMVAR ..from memory/var
Switches:
- SKIPITEMSWITHPATH Skip items with paths when selecting from clip/file/mem
- SKIPITEMSWITHOUTPATH Skip items with no path
- EXACT Like native EXACT switch (do not interpret pattern-chars)
- GO Goes to folder of first item before selecting
- USEPATH Select by full path instead of using names only
Examples:
- Select items listed in C:\Itemlist.txt
SelectEx FROMFILE="C:\Itemlist.txt"
- Open file by requester to select from
SelectEx FROMFILE="{dlgopen|Choose file to select from}"
- Go to the first path found in var "Slot01" and select items
SelectEx FROMVAR=Slot01 GO
- Select items from clipboard, use full qualified path for selecting
SelectEx FROMCLIP USEPATH
- TOFILE Save selected items to file (in UNICODE, UTF16-LE)
- TOCLIP ..to clipboard
- TOVAR ..to variable/memory
Switches:
- APPEND Append selection to file/clip/memvar
- ENCODING Set endoding for new files (default,unicode,ascii)
- EOL Specify custom characters for custom line endings (\r = CR and \n = LF)
Examples:
- Save selected items to C:\Itemlist.txt
SelectEx TOFILE="C:\Itemlist.txt"
- Save and append selected items to memvar called "Slot01"
SelectEx TOVAR=Slot01 APPEND
- CLEARVAR Clear the selection stored to the default variable or user defined variables.
Multiple variables can be cleared by separating their names with ";".
- NTH Select every n-th item
- ITEM Select a single item (with full path if USEPATH is used - not covered by the native Select)
Switches:
- USEPATH Select by full path instead of using name only
- RANDOM Select items randomly (formerly known as SelectRandom add-in)
- LINEAR Select items linear (same as RANDOM, just not random)
Switches:
- FOLDERS Select folders only
= depthmin limit results to folders with this minimum distance
= depthmax limit results to folders with this maximum distance
= subfldmin limit results to folders with at least this number of subfolders
= subfldmax limit results to folders with this maximum number of subfolders
= skipsubfld exclude all (sub)folders for which the subfldmin/max criteria matched
- FILES Select files only
- SINGLEFOLDER Select a single folder if there are at least x numbers of folders
- SINGLEFOLDERMINCOUNT Number of folders, used in conjunction with SINGLEFOLDER switch
- ITEMCOUNT How many items to select (default is 1)
- ITEMCOUNTRND Select a random *number* of items
- ITEMCOUNTPERC How many items to select in percent
- ACTION Optional action to perform ("dblclk" eg., lookup FileType ACTION command)
- COMMANDS Raw commands to run on selection, separate by "\n", make sure param is last
- PATH External path instead of tab, use with SETVAR/SETENV (items will not be selected)
- SETVAR The tab scoped var name to store chosen items (full paths), separated by "\r\n"
- SETENV The process scoped env-var to store chosen items (full paths), separated by "\r\n"
- NAME Filter items by name/extension (regular expression)
- RECURSE Recursive mode, meant to be used with PATH
- JSFILTER Custom scripting filter logic (provide js-snippet)
Return true to filter item and false to consider item for a random select/pick
- JSBREAK Custom scripting break to stop picking/selecting items
Return true to stop item picking, false to skip and null/undefined to select/pick
- MINSIZE Filter files by minimum file size
- MAXSIZE Filter files by maximum file size
- MAXSIZETOTAL Limit total size
- COPYTOCOLL Copy results to a dopus file collection
- TOFILE Save paths of picked/selected items to file
- APPEND Append mode for use with TOFILE
- ECHO Output selection results to the console for easy testing
Examples:
- Select a random file, run the doubleclick action and make item visible
(chooses a movie and autom. launches player eg.)
SelectEx RANDOM FILES ACTION=dblclck MAKEVISIBLE
- Select 20 images and start slideshow
SelectEx RANDOM NAME=".*(\.jpg|png)" FILES ITEMCOUNT=20 COMMANDS=Show SLIDESHOW
- Select 1 file out of an external folder and provide result in env- and tab-var called "SelexRnd"
SelectEx RANDOM FILES PATH="C:\Items" ITEMCOUNT=1 SETVAR="Result.SelectRandom" SETENV="SelexRnd"
- Select 50% of files:
SelectEx RANDOM FILES ITEMCOUNTPERC=50
- Select a single file, or a single folder if there are at least 3 subfolders present. This can be used
for a button that when repeatedly pressed, opens random folders and eventually "doubleclicks" a file.
SelectEx RANDOM FILES SINGLEFOLDER ACTION=dblclk
- Fetch 10 random "NewAge" tracks from "D:\music" and store them in a new collection called "NewAge"
(Notice: using the RECURSE switch takes some time for heavier music collections).
var jsFilter = ""+
"if (item.metadata == 'audio'){ "+
"var genre = new String(item.metadata.audio['mp3genre']);"+
"if (genre.indexOf('New Age')!=-1) return false; /*do not filter*/"+
"}";
cmd.RunCommand('SelectEx RANDOM ITEMCOUNT=10 '+
'PATH="D:\\music" RECURSE JSFILTER="'+jsFilter+'" COPYTOCOLL=NewAge');
- Select a maximum number of 100 random folders or total size of 8gb
SelectEx RANDOM MAXSIZETOTAL=8gb FOLDERS ITEMCOUNT=100
- Select the first 100 folders (not random, top to bottom)
SelectEx LINEAR ITEMCOUNT=100 FOLDERS
- Select 8gb of items, that are larger than 1mb (not random, top to bottom)
SelectEx LINEAR MAXSIZETOTAL=8gb MINSIZE=1mb
- AUTO Trigger auto-selection (simulate onafterfolderchange event)
- SIMILARMETA Select files with similar meta data
- SIMILARMETAJS Select files with similar meta data using a jscript snippet
item = item to test for selection (will represent every item in src or dst (if INDEST is used).
selItem = first selected file (DO item)
selItems = collection of all selected files (DO items)
cmd = command object to be used
Switches:
- INDEST Apply selection to destination lister or tab
Examples:
- Select all images, that have the same height and width as the currently selected image
SelectEx SIMILARMETA="metadata.image.picheight;metadata.image.picwidth"
- Select items with same name as the currently selected (looking at the first 8 chars only)
SelectEx SIMILARMETAJS="return selItem.name.left(8)==item.name.left(8);"
- Select all wma-files for which their actual filename does not match their track and artist information.
The filename matched against here is "<track> - <title>.wma", "03 - The Songtitle.wma"
SelectEx SIMILARMETAJS="if (item.name.search('0?'+item.metadata.audio_text.mp3track+
' \- '+item.metadata.audio_text.mp3title+'\.wma')!=0) return true;"
- Select all files, for which the title-tag cannot be found in the filename (case-sensitive)
SelectEx SIMILARMETAJS="if (item.name.indexOf(item.metadata.audio_text.mp3title)==-1) return true;"
- FILTERDROP Un/select, un/hide items by choosing a filter from a dropdown
- FILTERLIST Un/select, un/hide items by choosing (multiple) filters from a list
= <select> Select items by chosen filter (default)
= deselect Deselect items..
= hide Hide items..
= hidenomatch Hide nonmatching items..
Whenever a filter is set, a tab-scoped variable "Script.SelectEx.FilterEnabled" and "Script.SelectEx.FilterEnabled.bfc.drop"
is created to allow buttons to indicate a set filter status and the Autovar addin to clear vars and status automatically.
Global switches:
- MAKEVISIBLE Scroll selected items into view
= checked Scroll checkboxed items into view if present
- NODESELECT Do not deselect selected items
- DESELECTNOMATCH Deselect items that are not affected
- PT Switches and options to PassThrough to the native Select command
- NOFAIL Will never return failure (makes buttons run following commands in error situations)
- XLOG Level of output, defaults to normal, which means important information only
= off,xit,err,inf,warn,<normal>,trace,dump
Auto-Selection:
Auto-Selection of items when entering folders needs to be enabled and configured in the config section.
You can use aliases, regular paths or regular expressions to restrict automatic selection of items to specific folders. You can use regular item names or regular expressions again to define the items to be selected, use REGEX= prefix as shown. The dialog also allows to toggle the MakeVisible feature, which takes you to the first auto-selected item automatically.
Installation:
To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
Trouble-Shooting:
In case you encounter errors, add XLOG=dump to your commandline or raise the global log level in the script config.
Then re-do what failed and post the result (output) right here! o)
cya,
tb
Download:
v.0.5.8 - 2021.03.07 - fix ftp path handling
Command.Generic_SelectEx.js.txt (158.4 KB)
v0.5.7 - 2018.09.04 - add "selItems" (all selected files) to be used in SIMILARMETAJS/jsCompare()
Command.Generic_SelectEx.js.txt (154.9 KB)
v0.5.6 - 2017.11.27 - USEPATH switch by default for MAKEVISIBLE
v0.5.5 / 2017.09.01 - fix for files not being created if APPEND was used
Command.Generic_SelectEx.js.txt (153.8 KB)
v0.5.4 / 2016.11.01 - added ENCODING and EOL options, resolving and fixes
Command.Generic_SelectEx.js.txt (153 KB)
v0.5.3 / 2016.05.08 - added NOFAIL and CLEARVAR and fixes
Command.Generic_SelectEx.js.txt (146 KB)
v0.5 / 2015.07.03 - added TODEST, enhanced FOLDERS and added new script-config "AutoSelect.Actions":
Command.Generic_SelectEx.js.txt (141 KB)
v0.4.5 / 2015.06.11 - changes to AUTO (auto-selection triggered by command line):
Command.Generic_SelectEx.js.txt (130 KB)