Allow File Associations to work on *Folders* (no .extension)

Features wanted...
Post Reply
jwinter
Posts: 9
Joined: 07 Dec 2008 13:35

Allow File Associations to work on *Folders* (no .extension)

Post by jwinter »

Maybe there is some way of doing this already - if so I would very much appreciate being enlightened.

I purchased XYplorer almost exclusively for its portable file associations capability as I operate almost entirely from a portable drive these days with all my applications on it.

What I often want to do, and can't find an easy way, is to right-click on a folder and run WinDirStat-Portable on the contents of the folder. (This will then indicate which sub-folders are the culprits in terms of consuming space on the drive containing the folder). As it is, I have to fire up WinDirStat the slow way, then choose a drive and navigate up from the root to the folder of interest the painful way. All this time I have the folder of interest selected and waiting in XYplorer.

I imagine that there would be quite a number of cases where one would wish to invoke a command with a path to a *folder* rather than just a file with a particular extension (eg .txt > Notepad2.exe) which seems to be the only capability of the file association facility.

A closely related feature which I have found very useful for systems with WinMerge *installed* is to be able to sequentially click on one *folder* and feed it to WinMerge (I suppose the path actually gets temporarily stored somewhere), then click elsewhere to select a *second folder*, and then feed that one also (both together probably) to WinMerge so that it then kicks off and does a compare/merge function on the entire contents of the two individually selected folders.

I would really love to be able to program this type of functionality into my *portable* system using XYplorer and WinMerge-Portable?

Is there a way of being able to do this already? If not is there any hope for such a facility to be added?

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by jacky »

Well, the pattern defined on your PFA isn't limited to files, it goes for all items (files+folders). So if you use *foo* then it'll apply to all files and folders containing "foo" in their names.

And, if you want to add a PFA to be applied to all folders only, simply use \ as pattern, e.g. something like this:

Code: Select all

|"WinDirStat"\>"..\WinDirStat\WinDirStat.exe"
Proud XYplorer Fanatic

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by admin »

Concerning WinMerge: You can use either of these OpenWith UDCs (replace with your path to WinMergeU.exe!):
"C:\Programme\WinMerge\WinMergeU.exe" "<item1>" "<clipboard>"
"C:\Programme\WinMerge\WinMergeU.exe" "<item1>" "<item2>"

Last time I tried they worked well, also with folders. For the first one, you send one folder to the clipboard (either Ctrl+C or Ctrl+P -- both works!), then select another one, then run the UDC.

jwinter
Posts: 9
Joined: 07 Dec 2008 13:35

Re: Allow File Associations to work on *Folders* (no .extension)

Post by jwinter »

Amazing - Got all these things working!!!

Thanks heaps for the incredibly quick and useful guidance. This has to be a record for any application ever!

By the way I think your quotes around items <item1> and <item2> however are misleading - it doesn't seem to want them although it definitely does want the quotes around the application call ("WinMergeU.exe").

And all the information is to be found in the help file documention! (I had previously experimented using wildcards of various sorts without success, and I had also not discovered the way to get "Open with" to work (ctrl-alt-enter) but had been looking for things to appear in the right-click list of functions).

So now I have WinDirStat working on any selected folder, WinMerge working on any two folders that can be selected, and also working between the clipboard and a selected folder ... and all portably. How good is that!

Thanks a million!

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by admin »

Welcome! :D
jwinter wrote:By the way I think your quotes around items <item1> and <item2> however are misleading - it doesn't seem to want them although it definitely does want the quotes around the application call ("WinMergeU.exe").
Mine works fine with the quotes. Dunno... anyway, if it works it works. :)

jwinter
Posts: 9
Joined: 07 Dec 2008 13:35

Re: Allow File Associations to work on *Folders* (no .extension)

Post by jwinter »

admin wrote:Mine works fine with the quotes. Dunno... anyway, if it works it works. :)
Mine definitely does'nt! If I put the quotes around as in "<item1>" "<item2>" then it doesn't even find the application "..\WinMergePortable\WinMergePortable.exe" which plain as daylight is there!!!

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by admin »

jwinter wrote:
admin wrote:Mine works fine with the quotes. Dunno... anyway, if it works it works. :)
Mine definitely does'nt! If I put the quotes around as in "<item1>" "<item2>" then it doesn't even find the application "..\WinMergePortable\WinMergePortable.exe" which plain as daylight is there!!!
1. We are talking about UDC, not PFA, right?
2. Are you using the last version of XY??

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by jacky »

jwinter wrote:
admin wrote:Mine works fine with the quotes. Dunno... anyway, if it works it works. :)
Mine definitely does'nt! If I put the quotes around as in "<item1>" "<item2>" then it doesn't even find the application "..\WinMergePortable\WinMergePortable.exe" which plain as daylight is there!!!
I think Don is thinking of/talking about either scripting (openwith) or simply UDC "Open With", while you are still on PFA. It seems that with PFA it doesn't work with so many quotes -- Or because it begins and ends with a quote, so XY treats the whole thing as the app's location/name.

That said, I'm not sure it's supposed to work with PFA, since it would trigger it as many times as there are selected items, as I don't think there's a way to specify a PFA to make a single instance call.

You can however bypass this by using scripting, e.g. define your PFA as

Code: Select all

*>::openwith "C:\Programme\WinMerge\WinMergeU.exe" "<item1>" "<item2>"
Then the quotes are supported as expected, and it's a single-instance call.
Proud XYplorer Fanatic

jwinter
Posts: 9
Joined: 07 Dec 2008 13:35

Re: Allow File Associations to work on *Folders* (no .extension)

Post by jwinter »

admin wrote: 1. We are talking about UDC, not PFA, right?
2. Are you using the last version of XY??
1. No I haven't come to grips with UDC yet, I am still playing with entries in PFA.
The complete entry that I tried which didn't work was:
|"WinMerge"\;*>"..\WinMergePortable\WinMergePortable.exe" "<item1>" "<item2>"
It says "Couldn't find application:" and lists the full path version of the command with the very first and very last double quotes missing. I think jacky is correct in that it thinks the entire string is a command because it begins and ends in quotes.
However it did work when I dropped the quotes off the <item1> and <item2> as:
|"WinMerge"\;*>"..\WinMergePortable\WinMergePortable.exe" <item1> <item2>

2. No, I am using version 7.80.000 still.

But I am happy - it works nicely thanks!

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by admin »

jwinter wrote:
admin wrote: 1. We are talking about UDC, not PFA, right?
2. Are you using the last version of XY??
1. No I haven't come to grips with UDC yet, I am still playing with entries in PFA.
The complete entry that I tried which didn't work was:
|"WinMerge"\;*>"..\WinMergePortable\WinMergePortable.exe" "<item1>" "<item2>"
It says "Couldn't find application:" and lists the full path version of the command with the very first and very last double quotes missing. I think jacky is correct in that it thinks the entire string is a command because it begins and ends in quotes.
However it did work when I dropped the quotes off the <item1> and <item2> as:
|"WinMerge"\;*>"..\WinMergePortable\WinMergePortable.exe" <item1> <item2>

2. No, I am using version 7.80.000 still.

But I am happy - it works nicely thanks!
If you drop the quotes off the <item1> and <item2> then you get problems if the paths contain blanks. But I fixed the bug. Next version will work as expected.
I would use this way (clipboard instead of item2):

Code: Select all

|\>"C:\Programme\WinMerge\WinMergeU.exe" "<item1>" "<clipboard>"
Otherwise (as jacky said already) WinMerge is started 2 times, once for each selected item.

jwinter
Posts: 9
Joined: 07 Dec 2008 13:35

Re: Allow File Associations to work on *Folders* (no .extension)

Post by jwinter »

admin wrote:If you drop the quotes off the <item1> and <item2> then you get problems if the paths contain blanks. ...
OK I can see that would produce problems.
admin wrote:I would use this way (clipboard instead of item2):
Code:
|\>"C:\Programme\WinMerge\WinMergeU.exe" "<item1>" "<clipboard>"
Yes, as suggested earlier, I actually created two versions of the command. An <item1> <item2> version for cases where the two items can be selected simultaneously (if they are at the same level of the same branch of the tree), and a clipboard version for cases where the two items to be compared are more distantly separated.
admin wrote:Otherwise (as jacky said already) WinMerge is started 2 times, once for each selected item.
Well thanks for the warning but it seems to work fine with WinMerge! Maybe WinMerge is setup so that a second invocation of the command with a new path is treated as a single invocation of the command with the two paths in the command line. Maybe a command other than WinMerge wouldn't be so forgiving?

admin
Site Admin
Posts: 64915
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Allow File Associations to work on *Folders* (no .extension)

Post by admin »

jwinter wrote:
admin wrote:Otherwise (as jacky said already) WinMerge is started 2 times, once for each selected item.
Well thanks for the warning but it seems to work fine with WinMerge! Maybe WinMerge is setup so that a second invocation of the command with a new path is treated as a single invocation of the command with the two paths in the command line. Maybe a command other than WinMerge wouldn't be so forgiving?
My version of WinMerge starts two times. But as you said, maybe it's a setting somewhere -- did not check.

Post Reply