Page 1 of 1

UDC: Variable for item of inactive panel

Posted: 16 Feb 2016 07:24
by MBaas
I'd like to set up a UDC to launch a Compare-Tool, giving it the current item of the 1st and 2nd panel.I found <curitem> - but how can I refer to the item in the 2nd panel?

Re: UDC: Variable for item of inactive panel

Posted: 16 Feb 2016 08:22
by highend
Welcome to the club.

Code: Select all

$item = gettoken(get("SelectedItemsPathNames", "|", "i"), 1, "|");

Re: UDC: Variable for item of inactive panel

Posted: 16 Feb 2016 09:22
by MBaas
Thanks for the welcome and the quick solution :-)

I'm a total newbie, so pls. forgive the silly question, but I do not see how to apply your code? My idea was to set up a UDC "Open with" - where <curitem> can be put in the "Application"-field. But your code looks like I should write a script and embed that, is that right?

I wonder why the 2nd panel is accessed so differently from the 1st. Is my way of using XY so untypical that this idea never came up? Would the task of comparing the current file or folder to another one by calling an external utiity be better addressed in another way, is there a XY-style of doing such operations on 2 items?

Re: UDC: Variable for item of inactive panel

Posted: 16 Feb 2016 10:03
by highend
I'm a total newbie, so pls. forgive the silly question, but I do not see how to apply your code? My idea was to set up a UDC "Open with" - where <curitem> can be put in the "Application"-field. But your code looks like I should write a script and embed that, is that right?

I wonder why the 2nd panel is accessed so differently from the 1st. Is my way of using XY so untypical that this idea never came up? Would the task of comparing the current file or folder to another one by calling an external utiity be better addressed in another way, is there a XY-style of doing such operations on 2 items?
Sorry, yeah, it's meant for a script. Not all variables that XYplorer "exposes" to the user exist for both panes. I'm using a script to compare different folders / files, etc. depending on selections, dual / single pane etc. as well.

Look at it from this perspective: Even if there is a simple variable for the selected item in the non active pane... You'd still need to check if it currently contains anything to not run your comparison tool with only one parameter (and supplying an empty one as the second).

If you need help with a script, just ask.

Re: UDC: Variable for item of inactive panel

Posted: 16 Feb 2016 10:39
by MBaas
Look at it from this perspective: Even if there is a simple variable for the selected item in the non active pane... You'd still need to check if it currently contains anything to not run your comparison tool with only one parameter (and supplying an empty one as the second).
Yes, that's the "super-user-friendly" way of doing it. I would have been happy with a "superuser-friendly" way (just pass that "<inactiveItem>" and assume user know what he's doing. It it's undefined and causes a crash - well, that is a "user-error") ;-)
If you need help with a script, just ask.
Thanks, will do :)

Re: UDC: Variable for item of inactive panel

Posted: 16 Feb 2016 12:49
by TheQwerty
If you can adjust your requirement from "current items" to "focused items" then you could use <get item i>. Then you can create an Open UDC that for the program with the focused items as parameters by setting the Item field similar to:

Code: Select all

"?:\Path\To\Comparer\BeyondCompare\BCompare.exe" "<get item a>" "<get item i>"
You could use <focitem> instead of <get item a> if you like as they are the same.

Note however that this will not work well if you want to create an Open With UDC, because in that case XY will automatically attempt to open the active pane's current selection in addition to the arguments you provide - unless you include <items> in some way that your comparer ignores the expanded items.