Page 1 of 1

Right click multiple folder list to a script

Posted: 11 Feb 2015 23:53
by Imagine
I am looking to:
1. Select multiple folders, right click on one of them, select a menu item to activate a script (Done)
2. The script (I am using Python, but it does not have to be) pops up an input screen where options on what to do on these folders is selected.
3. All the folders are processed based on the user selected options in #2.

#1 is done, but #2 is an issue In standard Windows explorer: #1 sends individual folders to the script all in individual (separate) processes, so if I have 10 folders selected, I get 10 popups asking for user input. What I need is a single popup in #2, and all the folders processed based on the user input from that popup.

Any suggestions on how XYplorer can handle this?

Re: Right click multiple folder list to a script

Posted: 12 Feb 2015 00:12
by highend
It's not XY task to handle this, it's the script's task. XY doesn't control user defined context menus. So how is this context menu implemented?

Re: Right click multiple folder list to a script

Posted: 12 Feb 2015 00:28
by Imagine
It is done by adding a registry key to add a right click menu item and send the output to the script as argv[1].

Re: Right click multiple folder list to a script

Posted: 12 Feb 2015 05:36
by bdeshi
Add a new POM (Tools->Customize File Associations) entry like this:

Code: Select all

|"pass folder-selection to script"\>::run """path\to\script.py"" ""<get selectedItemsPathNames |>""";
which will pass |-separated list of selected folders (full paths) as argv[1] to your script.
You need to choose "Open With" in XYplorer's context menu -> "pass folder-selection to script".

But what are you going to do in your script. Maybe that can be done entirely inside XYplorer.

Re: Right click multiple folder list to a script

Posted: 13 Feb 2015 05:11
by Imagine
Thanks Sammay.

I added the code to Tools->Customize File Associations as a New entry. (See the attachment below showing Screen Capture of POM settings)

When I select a folder (or folders), right clicking does not bring up the option "Open with". Even with files, the open with option shows ip only when a single file is selected, and the custom script added does not show as one of the options.
capture.jpg

Re: Right click multiple folder list to a script

Posted: 13 Feb 2015 05:53
by RalphM
PFA's don't change the Windows context menu or Open With menu but are accessible via XY's own "Open With" button.

Re: Right click multiple folder list to a script

Posted: 14 Feb 2015 20:55
by Imagine
That works great! Thanks for your OUTSTANDING support (and great features!)