[AHK] redirecting Windows Explorer to XY

Discuss and share scripts and script files...
autocart
Posts: 836
Joined: 26 Sep 2013 15:22

Re: [AHK] redirecting win explorer windows to XY

Post by autocart » 05 May 2014 20:43

After testing it on my home system (slower, older, MS Security Essentials) I slightly updated the code and the exe in the 1st post again.
binocular222 wrote:Shellhook method only works with new parent window (not work with child window)
binocular222, what do you mean, what do you want to say by that?
Last edited by autocart on 05 Apr 2020 00:15, edited 1 time in total.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 06 May 2014 01:50

Yeah, mine was only replicating native XY behaviour but it didn't really matter to me as long as it meant that WE wasn't opened. On the other hand my script doesn't require XY to be open so it's a little but of a trade-off with either script. I do LOVE that yours selects the file because that's one of my biggest annoyances about XY (although I'm usually redirecting to a folder not a file) but, for me at least, it doesn't scroll the file into view. Is that expected behaviour and, if so, can it be changed? Because if I still have to scroll to the file then it's lessens the benefit of having it preselected. Cheers.

binocular222
Posts: 1414
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: [AHK] redirecting win explorer windows to XYp

Post by binocular222 » 06 May 2014 03:42

autocart wrote:After testing it on my home system (slower, older, MS Security Essentials) I slightly updated the code and the exe in the 1st post again.
binocular222 wrote:Shellhook method only works with new parent window (not work with child window)
binocular222, what do you mean, what do you want to say by that?
example: Notepad is parent window but its "File-open-dialog" is its child window. Shellhook will trigger action only when a parent window is created (but not when a child window is created)
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

autocart
Posts: 836
Joined: 26 Sep 2013 15:22

Re: [AHK] redirecting win explorer windows to XY

Post by autocart » 06 May 2014 08:33

@kiwichick:
Thx for the feedback. Although I did think of these possibilities also, your expressions where exactly what I needed to give me the extra push to actually implement it.
Now (1st post and download is updated):
If XY is not running it will be started automatically. If the autostart does not work it will wait for the user to start it.
Selected file is scrolled into view.

@binocular222:
Ah, ok, thx. So this is more some additional side info. Good to know - just in case.
It does not have anything to do with "Gui +LastFound", does it? In either case, thank you.
Last edited by autocart on 05 Apr 2020 00:16, edited 1 time in total.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 06 May 2014 08:55

autocart wrote:@kiwichick:
If XY is not running it will be started automatically. If the autostart does not work it will wait for the user to start it.
Selected file is scrolled into view.
Thanks autocart, Yip XY will open if not already but the file doesn't scroll into view and is no longer selected.

EDIT: Actually I forgot to turn off the XY config for default file manager. But when I do that there is an error when the script tries to open XY - Failed attempt to launch program or document; line 82: Run,XYPlorer.exe. But this only happens when XY isn't already open. It works perfectly when XY is open.

ANOTHER EDIT: I've changed Run,XYPlorer.exe to include the path to XYPlorer.exe and it seems to be working just fine now. YAY!!!

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 06 May 2014 15:15

OK I've come across a bit of a problem for when I actually want WE to open - in particular when accessing the Control Panel. I paused the script but it still tried to open the Control Panel in XY (which just results in the "Location not available" error). The tray icon for the redirect script appears to re-activate and then pause again after launching XY. Is there some reason the pause doesn't seem to work? Cheers.

autocart
Posts: 836
Joined: 26 Sep 2013 15:22

Re: [AHK] redirecting win explorer windows to XY

Post by autocart » 06 May 2014 20:59

Mhm, forgot about control panel when I rewrote the code.
I think I will change the command line params to state paths and folder-keywords that should be redirected (allowing for * placeholders). Anything else will then be ignored and not get redirected.
Plan to do that with in the next days, for right now the script needs to be stopped for control panel access and then restarted again. Or you can also add the keywords like "control panel" (I dont know exactly, I only have the German version) to the command line params right now. At the moment the paths/keywords in the params get ignored, not included. Only thing you need to add the correct keyword for every subpath of control panel individually. (You can figure out the correct keyword if you let it get "redirected" and then check the XY address bar.)

Why the pause does not work I think it is because of the script installs some win api event or so which is not affected by pausing the actual script (I think you can view it as external to the actual script). I dont fully understand it myself, becuase it is part of someone elses code that I more or less just copy-pasted.
Last edited by autocart on 05 Apr 2020 00:16, edited 1 time in total.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 07 May 2014 00:23

Thanks again autocart, Adding subpaths like "Power Options" and "Personalization" to $excludePaths works great but, unfortunately, adding "Control Panel" or "All Control Panel Items" doesn't work. They still open in XY.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 07 May 2014 01:55

OK, so I don't what I'm doing wrong but can you please clairfy how I add multiple $excludePaths? I've tried:

$excludePaths := "Action Center | Administrative Tools | Default Programs | Device Manager | Mouse | Power Options | Personalization | User Accounts | Windows Firewall"

$excludePaths := "Action Center" | "Administrative Tools" |"Default Programs" | "Device Manager" | "Mouse" | "Power Options" | "Personalization" | "User Accounts" | "Windows Firewall"

$excludePaths := Action Center "|"Default Programs "|" Device Manager "|" Mouse "|" Power Options "|" Personalization "|" Windows Firewall

NOTHING works if I go there from the Control Panel menu in the Start Menu. It only works if I go there from somewhere else (eg: Notification Area. Desktop context menu). And if any of my combinations work, it's only in the first instance. So if I go to Power Options it works - but if I try to go there again it doesn't.

autocart
Posts: 836
Joined: 26 Sep 2013 15:22

Re: [AHK] redirecting win explorer windows to XY

Post by autocart » 07 May 2014 07:14

kiwichick wrote:OK, so I don't what I'm doing wrong but can you please clairfy how I add multiple $excludePaths?
I see, you are setting it right in the code but you have never programmed before, right?
$excludePaths := "Action Center|Administrative Tools|Default Programs|Device Manager|Mouse|Power Options|Personalization|User Accounts|Windows Firewall"
This way it should work.

Regarding the correct name of control panel I already said that I don't know if "control panel" is the correct name. Let it get redirected to XY and then copy and paste the XY address bar here. Hopefully we can find out. Or add a "MsgBox "%$path%"" (without outer quotes) in the next line after "XY_send_message_noreturnvalue("::selectitems '" . $selected . "';#1012;")" This way the extracted/used keyword will be shown (in quotes) in a message box after redirecting.

EDIT: Funny, how hard it is to make some code end-user-proof. :biggrin:
Last edited by autocart on 05 Apr 2020 00:16, edited 1 time in total.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 07 May 2014 07:53

autocart wrote: $excludePaths := "Action Center|Administrative Tools|Default Programs|Device Manager|Mouse|Power Options|Personalization|User Accounts|Windows Firewall"
This way it should work.
Yip that got it!!
autocart wrote:Let it get redirected to XY and then copy and paste the XY address bar here.
C:\PortableApps\XYplorer\All Control Panel Items

autocart
Posts: 836
Joined: 26 Sep 2013 15:22

Re: [AHK] redirecting win explorer windows to XY

Post by autocart » 07 May 2014 08:57

kiwichick wrote:C:\PortableApps\XYplorer\All Control Panel Items
In this case
$excludePaths := "All Control Panel Items|Action Center|Administrative Tools|Default Programs|Device Manager|Mouse|Power Options|Personalization|User Accounts|Windows Firewall"
*should* do the trick. If that works as supposed then it was a problem with wrong spacing in your previous input.
Last edited by autocart on 05 Apr 2020 00:16, edited 1 time in total.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 07 May 2014 09:19

Yes it was definitely the spacing (the one option I didn't try hahahaha). And I discovered I needed a | delimiter after the last exclude.

Working absolutely fabulously now, autocart!! Thanks heaps. Now it just needs to have the "XY must be already open" issue sorted and it will be PERFECTO!!!!

autocart
Posts: 836
Joined: 26 Sep 2013 15:22

Re: [AHK] redirecting win explorer windows to XY

Post by autocart » 07 May 2014 10:57

kiwichick wrote:And I discovered I needed a | delimiter after the last exclude.
Oops, right, forgot to think of that. Thx for figuring that out yourself.
kiwichick wrote:Now it just needs to have the "XY must be already open" issue sorted and it will be PERFECTO!!!!
I thought you took care of that by putting the full path to XYplorer.exe into the code.
Last edited by autocart on 05 Apr 2020 00:17, edited 1 time in total.

kiwichick
Posts: 277
Joined: 08 Aug 2012 04:14

Re: [AHK] redirecting win explorer windows to XYp

Post by kiwichick » 08 May 2014 07:02

autocart wrote:I thought you took care of that by putting the full path to XYplorer.exe into the code.
Now my turn to oooops :biggrin: Yes I already had!!!

Post Reply