[AHK] redirecting Windows Explorer to XY

Discuss and share scripts and script files...
Dustydog
Posts: 321
Joined: 13 Jun 2016 04:19

Re: [AHK] redirecting win explorer windows to XY

Post by Dustydog »

This is a few years old, but still incredibly useful. Thank you - really! Solves a problem with several programs I really wish had a custom browser feature - and had even requested of the developers in a couple of cases.

I went through the control panel (so far) and updated the excludes for Win 10. I also commented out "MsgBox Could not retrieve the path of the explorer window." as (at least once) an exclude didn't work, but the AHK Msgbox, of course, did. I personally didn't feel I needed to know. After I excluded it, I obviously no longer knew if there was more than a single case. (Make sure to leave the surrounding lines in if you choose to do this too, otherwise you'll get XY open pointing to folder ERROR.)

So, here's the control panel entries for Win 10 as of this post (in no particular order); some things are obviously pretty low use. I split the lines at my editor's approximate margins. I'm sure I'll bump in to a few more things I'll want to exclude, but as Windows moves more towards the newer interface, things will pop up less often. There are a few quirky things here that are just on my system. Pull them out if you feel the need after looking in your Control Panel for anything that might be unique to yours. Of course, you can always temporarily stop the script instead:

Code: Select all

$excludePaths := "All Control Panel Items|Storage Spaces|Sync Center|System|Network and Sharing Center|Programs and Features|Recovery|RemoteApp and Desktop Connections|"
 . "Security and Maintenance|Speech Recognition|Autoplay|Fonts|Backup and Restore (Windows 7)|Devices and Printers|Dolby Audio|Ease of Access Center|File History|"
 . "BitLocker Drive Encryption|Color Management|Credential Manager|Device Manager|Action Center|Administrative Tools|Default Programs|Mouse|Power Options|Personalization|"
 . "User Accounts|Windows 10 Firewall Control|Troubleshooting|Windows Defender Firewall|Work Folders|"

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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

Hey Dustydog,

thank you very much for commenting and sharing.
I am very happy that this script is useful to someone.
If u have any ideas of how to improve it further, don't hold back letting me know.
However, I cannot promise if I will actually work on the code or not.
But thanks for the feedback so far! :D :tup:

Dustydog
Posts: 321
Joined: 13 Jun 2016 04:19

Re: [AHK] redirecting win explorer windows to XY

Post by Dustydog »

Mostly, I just wanted to give you a sincere thank you. Here's another: Thank you! :appl:

The only odd thing about this- and this is my bad for not knowing enough about AHK - is that if one pauses the script, it still continues operating: One needs to exit in order to turn it off temporarily, which I find I need to do sometimes.

If you felt like making shortcuts that actually turned it on and off, then I could stick it in my standard AHK script that I load on startup in which I combine as many of the small utilities I use from various sources as possible. As is, this one has to sit alone to start and exit manually.

If you don't feel like doing something like that, I'll get around to it eventually myself and post it here, but whenever I use AHK, currently, I have to look up most of what I'm doing.

Much of what I'm running from AHK are for my Lenovo laptop's quirks, but I also have tiny utilities to keep a window on top, resize the MediaInfo GUI window when it opens (I open MediaInfo by default on several media types in XY - yeah, I know that's pretty redundant to built-in features, but I'm used to it and program with it), open the 64-bit XY context menu using Win-Right Click, etc.

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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

Hey Dustydog and anyone else,

I completely rewrote the first post to provide a better explaination.
I also changed some things to the code. Change log also in first post.

Mainly I made the script respect it's paused state. But also changed a few other things.
I hope that the changes are cool.
If you want some old way of usage back, please let me know.
I am also still open for more ideas and suggestions.

Regards, S.

BTW,
Dustydog wrote: 22 Apr 2020 19:01... open the 64-bit XY context menu using Win-Right Click, etc.
That is a really cool idea.


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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

Updated the downloadable zip file.
It failed to contain:
  1. the icon file
  2. the url file to the autohotkey download website


yuyu
Posts: 114
Joined: 19 Jun 2018 12:40

Re: [AHK] redirecting win explorer windows to XY

Post by yuyu »

autocart wrote: 28 Apr 2020 01:10 -) Fixed some wrong logic in the processing of events.
That always seemed a weak point to me. Thanks for fixing!

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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

Hey yuyu,

you are most welcome. :kidding:
If you have any other thoughts about the script, which would make it better, don't hold back. Please, let me know. :tup:

1024mb
Posts: 205
Joined: 14 Dec 2018 23:26

Re: [AHK] redirecting win explorer windows to XY

Post by 1024mb »

Thanks for the script, it works great.

There is just a little problem I've been facing, sometimes the path is opened in the focused tab or latest tab to the right instead of a new one. I've been trying to reproduce it but so far I haven't got the exact steps to do it. It is currently only happening with Internet Download Manager (I haven't another application to test it with), and as I said before, I don't know the steps to reproduce it.
If you download something with IDM and select the option to open the directory where the file has been downloaded it sometimes opens the path in the last tab (to the right) instead of opening a new one. It also happens if you open the IDM window, select a downloaded file -> right click -> open folder.

Sometimes it happens, sometimes it doesn't, it almost seems random but at the same time it seems that it happens mostly with compressed files (zip and rar, haven't tested with 7z).

Thanks again!

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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

1024mb wrote: 28 Apr 2020 19:27... sometimes the path is opened in the focused tab or latest tab to the right instead of a new one. ... It is currently only happening with Internet Download Manager (I haven't another application to test it with), ...
... open the directory where the file has been downloaded it sometimes opens the path in the last tab (to the right) instead of opening a new one. ... also ... if you ... select a downloaded file -> right click -> open folder.

... mostly with compressed files (zip and rar, haven't tested with 7z).
Hi 1024mb,
thanks for the feedback.

The way how the script works when redirecting a path to XY is, that the script first looks for a tab in the currently active pane which would already contain the redirected path. If there is such a tab, then it reuses this tab because why open another one with exactly the same path and just clutter the tabbar. If such a tab does not exist, then it opens a new tab. I should explain this behaviour in the first post.

If you think that the script behaves differently on your end, please, let me know. Or if you have a reason to why you would like this behaviour to change, please, let me know as well.

In general, the whole behaviour of the whole script has nothing to do with the original program, which opens the Windows Explorer window. The script starts reacting to the Windows Explorer window and does not care about where it comes from or how it was opened.

Also the zip file should not make a difference. The only time, where a zip file might make a difference is when the compare method is *not* RegEx (but direct "identical" compare) and WE would show the *content* of a zip file. But then the script would not redirect the WE window at all. (And if the compare method *is* RegEx and the WE content view of a zip file *would be* redirected, then XY as of now might show different results depending on whether such a tab already existed or not - I am about to change that to always just show the containing folder and select the file.)

1024mb
Posts: 205
Joined: 14 Dec 2018 23:26

Re: [AHK] redirecting win explorer windows to XY

Post by 1024mb »

autocart wrote: 28 Apr 2020 22:41
1024mb wrote: 28 Apr 2020 19:27... sometimes the path is opened in the focused tab or latest tab to the right instead of a new one. ... It is currently only happening with Internet Download Manager (I haven't another application to test it with), ...
... open the directory where the file has been downloaded it sometimes opens the path in the last tab (to the right) instead of opening a new one. ... also ... if you ... select a downloaded file -> right click -> open folder.

... mostly with compressed files (zip and rar, haven't tested with 7z).
Hi 1024mb,
thanks for the feedback.

The way how the script works when redirecting a path to XY is, that the script first looks for a tab in the currently active pane which would already contain the redirected path. If there is such a tab, then it reuses this tab because why open another one with exactly the same path and just clutter the tabbar. If such a tab does not exist, then it opens a new tab. I should explain this behaviour in the first post.

If you think that the script behaves differently on your end, please, let me know. Or if you have a reason to why you would like this behaviour to change, please, let me know as well.

In general, the whole behaviour of the whole script has nothing to do with the original program, which opens the Windows Explorer window. The script starts reacting to the Windows Explorer window and does not care about where it comes from or how it was opened.

Also the zip file should not make a difference. The only time, where a zip file might make a difference is when the compare method is *not* RegEx (but direct "identical" compare) and WE would show the *content* of a zip file. But then the script would not redirect the WE window at all. (And if the compare method *is* RegEx and the WE content view of a zip file *would be* redirected, then XY as of now might show different results depending on whether such a tab already existed or not - I am about to change that to always just show the containing folder and select the file.)
The weird thing is that folders (paths) redirected weren't already opened in XYplorer, it changes the path to the redirected one. I could have been in C:\Users\1024mb and the redirected could be E:\RandomFolder\RandomFolder2 and it will still change the path instead of opening another one.

I have just tested this, like right now and this is what happened.

XYplorer focused tab was in "C:\xampp\apache". I have two files in the IDM window, one is a txt and the other is a rar file.
Right clicked the txt file -> Open folder and it opened in a new tab. I closed that tab.
Right clicked the rar file -> Open folder and it opened the path in the focused tab instead of a new one.

I've tried this multiple times. I used "Open folder" with the txt file like 5 times and all of them the script opened the path in a new tab. I used "Open folder" with the rar file 5 times and all of them the script opened the path in the focused tab.
I don't know why this is happening, its so weird. Tried again randomly opening folder of the txt and rar files and the same happened.

I have now tried with other applications and they behave normally.

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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

1024mb, thx for testing!
I am very happy to get this feedback and see that the script is generally useful and people want it to work well.

I have a new version coming out in a "few" minutes. Please test it again with that version. If it will still give you problems, I will be happy to continue trying to help.

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

Re: [AHK] redirecting win explorer windows to XY

Post by autocart »

New Update in 1st post.
Version 3.4 - a true bugfix release
viewtopic.php?f=7&t=10671

1024mb
Posts: 205
Joined: 14 Dec 2018 23:26

Re: [AHK] redirecting win explorer windows to XY

Post by 1024mb »

autocart wrote: 29 Apr 2020 03:59 New Update in 1st post.
Version 3.4 - a true bugfix release
viewtopic.php?f=7&t=10671
Thanks for the update and the quick response, I didn't expected that, sorry for taking so long to write back.

I tried the latest version but unfortunately it's still happening.
This time I tried with a txt file, 3 compressed files (2 zips, 1 rar) and 1 executable. With the 3 compressed files their paths were opened in the focused tab. The executable and txt's paths were the only ones that were opened in a new tab.

I'm curious to know if this is happening only on my end. Have you tried installing the software and opening the paths? IDM has a trial if you want to download it, I can will of course keep providing feedback.


Wait a minute, don't mind anything I said before. I mistaken and instead of launching the 3.4 script I launched the 3.3 :mrgreen: .
With 3.4 everything works GREAT, paths are opened in a new tab now with every single file, thanks!!!

=======================================================================

By the way, I have collected some strings (at least the ones that Windows 10 uses) that belong to Control Panel but they are in Spanish so you can add them to the script:

Code: Select all

|Panel de control|Sistema y seguridad|Seguridad y mantenimiento|Firewall de Windows Defender|Sistema|Opciones de energía|Cifrado de unidad BitLocker|Carpetas de trabajo|Redes e Internet|Centro de redes y recursos compartidos|Hardware y sonido|Dispositivos e impresoras|Reproducción automática|Programas|Programas y características|Programas predeterminados|Cuentas de usuario|Administrador de credenciales|Apariencia y personalización|Reloj y región|Accesibilidad|Centro de accesibilidad|Reconocimiento de voz|
Thanks for all your work! :beer:

Post Reply