UDC: Variable for item of inactive panel

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
MBaas
Posts: 692
Joined: 15 Feb 2016 21:08

UDC: Variable for item of inactive panel

Post 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?
____________________________________________________________________________________
Happy user. Screen scaling 100% and W11Pro [Version 10.0.26200.7922], XY 28.30.14000 * * LinkTree

highend
Posts: 14994
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: UDC: Variable for item of inactive panel

Post by highend »

Welcome to the club.

Code: Select all

$item = gettoken(get("SelectedItemsPathNames", "|", "i"), 1, "|");
One of my scripts helped you out? Please donate via Paypal

MBaas
Posts: 692
Joined: 15 Feb 2016 21:08

Re: UDC: Variable for item of inactive panel

Post 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?
____________________________________________________________________________________
Happy user. Screen scaling 100% and W11Pro [Version 10.0.26200.7922], XY 28.30.14000 * * LinkTree

highend
Posts: 14994
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: UDC: Variable for item of inactive panel

Post 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.
One of my scripts helped you out? Please donate via Paypal

MBaas
Posts: 692
Joined: 15 Feb 2016 21:08

Re: UDC: Variable for item of inactive panel

Post 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 :)
____________________________________________________________________________________
Happy user. Screen scaling 100% and W11Pro [Version 10.0.26200.7922], XY 28.30.14000 * * LinkTree

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: UDC: Variable for item of inactive panel

Post 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.

Post Reply