Command: SelectEx (extended Select command)

Works perfectly. Why couldn't I think of that myself. :frowning:

Thanks a lot for the fast reaction.

1 Like

In /desktop or file collection,“SelectEx FROMCLIP” can not work
Could you fix this problem?

I solved it.
Find
fileParentTrimmed = fileParentTrimmed.rTrim("/")

Add code at line 1605

			if(fileParentTrimmed == "/desktop" || fileParentTrimmed.search(/^coll:\/\//i) != -1) {
				cmd.AddLine('Select EXACT "' + item + '"')
				continue;
			}

Thanks, for posting your solution and sorry for not getting back to you last year! o)

I looked at the code now.. but who wrote this? o) It's kind of hard, it was written in a hurry it seems. I need to rewrite this at some point. The native "Select" command of DO also is more functional now than it was back then, some specific handling can probably be removed, and maybe there are still some bugs to hunt down?!

If you are in "/desktop" I would expect this to work, for some reason it does not.

cmd.AddFile("C:\\Users\\username\\Desktop\\Controller Editor.lnk");
cmd.RunCommand(Select FROMSCRIPT EXACT MAKEVISIBLE)

I tried with DOpus.FSUtil.Resolve() to get around specific handling of "/desktop" or "coll://", since items in there are regular file system items with regular paths, but it did not work out as I expected.

1 Like

for me this script doesn't work. i am trying both the select file by clipboard or file. but it doesn nothing. i use the latest dopus version. any idea whats going on?

Quickly tested selection to clipboard and clipboard to selection, works for me with most recent DO beta version. Is there anything in the script log, is the script installed correctly? Does "SelectEx" show up in the list of commands, when you type >select in a file display?

I believe to have to script installed correctly. Some other functions work like select nth or random.
That's the log:
28.02.2025 08:33 SelectEx: I Less/more items selected than given or some
28.02.2025 08:33 SelectEx: I matching items were already selected before.

Can you try again without the grouping?
When I activate the grouping, I get a separate grouping column, it seems like you don't have it, I cannot remove this Group column for some reason to get the same view as you with these expandable groups or maybe you know how to toggle the grouping display, I can't remember. o)

I tested here to copy from EditPlus and MS Notepad, restoring selections from copied text worked as expected. Also please try "Save Selection to Clipboard", then paste into regular notepad with CRLF mode, then try to restore selection. Maybe it is a line ending thing.

You can also try to restore the selection and get more debug output from SelectEx:

  • copy item names to clipboard
  • press ">" in the DO file display (a command line will appear)
  • paste "SelectEx EXACT FROMCLIP XLOG=all"
  • hit Enter
  • then post the output of the script console here, it should be way more verbose

Probably Preferences / File Display Columns / Options / Add Group column automatically when file display is grouped.

followed your steps but doesn't work. here is the log from command line

28.02.2025 12:38 SelectEx: CmdLine: SelectEx EXACT FROMCLIP XLOG=all
28.02.2025 12:38 SelectEx: SelectEx_FROMCLIP():
28.02.2025 12:38 SelectEx: SelectArrayItems():
28.02.2025 12:38 SelectEx: Params:
28.02.2025 12:38 SelectEx: SKIPITEMSWITHPATH : false
28.02.2025 12:38 SelectEx: SKIPITEMSWITHOUTPATH: false
28.02.2025 12:38 SelectEx: USEPATH : false
28.02.2025 12:38 SelectEx: MAKEVISIBLE : false
28.02.2025 12:38 SelectEx: DESELECTNOMATCH : false
28.02.2025 12:38 SelectEx: EXACT : true
28.02.2025 12:38 SelectEx: GO : false
28.02.2025 12:38 SelectEx: PT : undefined
28.02.2025 12:38 SelectEx: flatview : false
28.02.2025 12:38 SelectEx: Selecting items..
28.02.2025 12:38 SelectEx: -itema: 40031662
28.02.2025 12:38 SelectEx: -itemb: 40031662
28.02.2025 12:38 SelectEx: -parent0a:
28.02.2025 12:38 SelectEx: item [40031662], parent
28.02.2025 12:38 SelectEx: parent1 ;
28.02.2025 12:38 SelectEx: parent3 [D:\OneDrive - adidas\Desktop\New folder (2)];
28.02.2025 12:38 SelectEx: AddFile2(D:\OneDrive - adidas\Desktop\New folder (2)\40031662);
28.02.2025 12:38 SelectEx: cmd.Run()
28.02.2025 12:38 SelectEx: cmd.RunCommand(Select FROMSCRIPT EXACT)
28.02.2025 12:38 SelectEx: Results:
28.02.2025 12:38 SelectEx: I Less/more items selected than given or some
28.02.2025 12:38 SelectEx: I matching items were already selected before.
28.02.2025 12:38 SelectEx: items total : 1
28.02.2025 12:38 SelectEx: items filtered : 1
28.02.2025 12:38 SelectEx: selected before : 0
28.02.2025 12:38 SelectEx: selected after : 0

Yes, that option is enabled, thank you. I can indeed only remove the group column, of this option is disabled. Is this intentional? The option name "Add automatically.." does not imply a locked group column.

@manu
The log output seems to be fine, it adds the file to the internal command object, then runs "Select FROMSCRIPT EXACT", but for some reason you don't end up with a selected item. It works fine on my side, I tried "number as filename" as you, no extension, path with blanks and brackets, grouping on/off etc..

Please post all the results of the things I suggested (using different editor etc.).

Fixed in the next beta.

2 Likes

Unreal! Thank you! o)

@manu
I looked at the SelectEx code again for some minutes.. I really can't tell why it does not work for you at the moment. If you find time and motivation, maybe try to find the pattern when restoring the selection works and when it does not. Also try to not make use of any special folder in the path, no OneDrive, no Desktop, no Links, etc.. just for testing of course. If it works in a regular path like D:\myfolder\abc and not within a folder somewhere below your user profile or inside a OneDrive path, it can help to track the issue down.

Hi, sorry for late reply. It looks like it is somehow connected to OneDrive maybe as it worked on other local folder. Will keep trying to find out what was going on

hello, what is the meaning of arg "GOPT" ? thank you! :smiley:

With the arg "GO", I want the command to open path in a newtab, like "NEWTAB=deflister,findexisting", how to modity the script?

I don't see GOPT being listed as an option, it seems to be undocumented?!

You can use it (as it seems) to PT (pass through) options to the GO command.

So, something like this could do the trick:
SelectEx RANDOM GO "C:\" GOPT=NEWTAB=deflister,findexisting

BUT: It does not work here, it looks like something is wrong with the DO script command line parser. It seems to mix up values for the different parameters. I need to investigate this in an isolated manner before I can tell you more.

1 Like

I modify here

		if (args["GO"].exists && parent){
			args["GO"].exists = false;
			if (!DOpus.FSUtil.ComparePath(parent,sourcetab.path)){
				var cmdline =	'Go "'+parent+'"'+
								(args["GOPT"].exists?' '+args["GOPT"].value:'');
				Log("    cmd.RunCommand("+cmdline+");","D");
				cmd.RunCommand(cmdline);
				var lister = sourcetab.lister
				sourcetab.Update();
				lister.Update()
				sourcetab =lister.activetab
			}
		}

How does this fix the issue?!

EDIT: Your change is reasonable for cases where the GO option switches to another tab I think, I adopted that, thank you! I still don't see how it fixes the mixed up command line parameters?!

But DOpus still can not select files in the newtab :joy:
as a test, this will work:

var sLister = clickData.func.sourcetab.lister;
cmd.AddFile("C:\Program Files\Internet Explorer\iexplore.exe")
cmd.RunCommand('Go "C:\Program Files\Internet Explorer" TOFRONT NEWTAB=deflister,findexisting');
sLister.Update();
cmd.SetSourceTab(sLister.activetab);
cmd.RunCommand("Select EXACT FROMSCRIPT DESELECTNOMATCH MAKEVISIBLE=immediate");

I don't know why your script do not work... :joy: