4 options to change the current folder in Windows Explorer

Get help with using AutoHotkey and its commands and hotkeys
User avatar
joedf
Posts: 5833
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: 4 options to change the current folder in Windows Explor

07 Nov 2013, 23:17

ill test whatever, i use virtualbox with the consumer preview that i never deleted :P
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: 4 options to change the current folder in Windows Explor

08 Nov 2013, 06:32

LearningOne, I took the liberty of cleaning up your code. I hope you don't mind. It looks like it suffered from the common case of "over-commenting". A good rule of thumb is to avoid using end-of-line comments and to limit the length of a line to 100 columns/characters.


Code: [Select all] [Expand] [Download] (Part of RM's Navigator.ahk)GeSHi © Codebox Plus


As far as I know, I didn't change any of the code at all except for formatting/spacing inconsistencies.
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: 4 options to change the current folder in Windows Explor

08 Nov 2013, 09:44

chaz, thanks for cleaning up my code from over-commenting ;)
joedf, it would be great if you could test code below on Win 8 ;)

* * *

New, upgraded (I hope) Navigator is now available for testing. I tested it on Win 7 and it works fine for me. Tell me does it work for you... (+ please write your OS Version) 8-)

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

User avatar
joedf
Posts: 5833
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: 4 options to change the current folder in Windows Explor

08 Nov 2013, 17:26

Works Perfectly/Flawlessly Under WinXP, Win7, Win8 - Confirmed
;) nice script btw!
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

09 Nov 2013, 22:20

LearningOne wrote: Else if WinTitle contains Open,Save,Export,Import,Upload,Select ; this is the case in some MS office dialog windows, which are not #32770 class.

@LearningOne: Maybe the following approach would avoid the need to rely on dialog box titles to detect MS Office dialog boxes and would work with any localization of MS Office apps:

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

	Else if InStr(WinClass, "bosa_sdm_") ; for some MS office dialog windows, which are not #32770 class.

BTW, I found that Word and Excel dialog boxes have standard class name #32770 under Win7. It is only under WinXP that I found these special classes: "bosa_sdm_XL9" (Microsoft Excel 2010) and "bosa_sdm_Microsoft Office Word 12.0" (Microsoft Word 2010).
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

09 Nov 2013, 22:41

@joedf: Thanks for testing !

@LearningOne: I did some cherry picking in your code. Many thanks.

@All: I posted the ALPHA version of my code on GitHub (download these two files: PopupFolders.ahk and PopupFolders_LANG.ahk). This is (yet) another favorite folders popup menu. But this one will be my preferred :-)

Once loaded, press MIDDLE mouse button when mouse is over Windows Explorer, Desktop or a file dialog box to open the folders popup menu. You can also press SHIFT+MIDDLE mouse button anywhere.

The settings Gui is not implemented yet but you can edit the settings directly in the .ini file if you wish. There is a lot of debugging code in the script but it will not interfere with its execution.

Next in the pipeline: support for Console support, implements Gui buttons commands, implement Add Folder and Add Dialog boxes, etc.

Fell free to report bugs or suggestions/comments here on in the GitHub Issues.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
joedf
Posts: 5833
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: 4 options to change the current folder in Windows Explor

09 Nov 2013, 23:01

Console support?? LibCon? http://joedf.github.io/libcon/
what do you mean?
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: 4 options to change the current folder in Windows Explor

10 Nov 2013, 09:09

joedf wrote:Console support?? LibCon? http://joedf.github.io/libcon/
what do you mean?

Console support as in you can use the middle-click menu to go to one of your favourite folders in Command Prompt, instead of the default C:\\.
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

10 Nov 2013, 09:34

joedf wrote:Console support?? LibCon? http://joedf.github.io/libcon/
what do you mean?

Your console app looks interesting but all I need is to change directory while the mouse is over the console (SendInput cd /d %Path% {Enter}).

This has been added to v0.3 ALPHA that is now online: PopupFolders.ahk and PopupFolders_LANG.ahk.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: 4 options to change the current folder in Windows Explor

10 Nov 2013, 12:56

To be honest, JnLlnd, I prefer rbrtryn's way of doing it, with the functions instead of the labels. To me, using labels in place of functions is a poor approach because it makes everything so much more difficult to follow/read, and totally goes against the concept of encapsulation--that is, hiding all the nitty-gritty work of how it's done inside a function and providing an interface, the function call. Plus, it's less reliable precisely because there's no concept of scope anywhere--everything is at the top level, and it shouldn't be.

The only fault of rbrtryn's script was that he tied the front- and back-ends together too much, and it seems like you're doing exactly the same thing. Plus, navigating to the current folder wasn't totally reliable, and there was no support for special folders. Using LearningOne's method of programmatic navigation, this is easily solved. All that is needed is to determine if an added folder matches a special folder, then save the associated number in its place. Separating the UI code from the rest wouldn't be very hard either.

I don't mean to be an idiot by saying this, because your script is still good, but I just wanted to state my opinion.
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

10 Nov 2013, 14:14

I respect your opinion and if I was writing my script for other programmers, I would agree with your comments. But I'm writing this first for users and for myself. 1) For users, my goal is to make it as reliable, convenient and easy to use as possible. 2) And, being the one who will primarily maintain it, I prefer the script to be be written following my coding style. Not to say that it is better than other's. Just that it is just better for me. And regarding variable scope and these concerns, I'm confident that in a script of this size the risk is under control.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: 4 options to change the current folder in Windows Explor

11 Nov 2013, 02:02

@joedf: Thank you very much for testing! ;)
@JnLlnd: I wrote:

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

Else if WinTitle contains Open,Save,Export,Import,Upload,Select ; this is the case in some MS office dialog windows, which are not #32770 class.
Actually, the code comment I wrote there is not correct - I remember there were some dialog boxes which were not #32770 nor "bosa_sdm_" class, and that's why I used Open,Save... etc WinTitle keywords.
I tried your PopupFolders. Good job! ;)
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

11 Nov 2013, 07:10

LearningOne wrote:Actually, the code comment I wrote there is not correct - I remember there were some dialog boxes which were not #32770 nor "bosa_sdm_" class, and that's why I used Open,Save... etc WinTitle keywords.
I tried your PopupFolders. Good job! ;)

Thank you! About the dialog boxes, I use MS Office a lot. If whenever I find this situation in the future, I will report it here and adapt my code.
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

11 Nov 2013, 19:26

@LearningOne: Just found how to make Explorer_Navigate work with UNC locations. An example of UNC is a Sharepoint WebDAV folder: "\\my.sharepointserver.com@SSL\DavWWWRoot\Folder\Subfolder".

I added an "else if" to your code to detect a UNC (check if the first 2 characters are "\\").

I'm not very familiar with this but, from my tests, I found that, in this case we must keep the path as is (ie not adding the "file:///" prefix).

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
joedf
Posts: 5833
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: 4 options to change the current folder in Windows Explor

11 Nov 2013, 20:31

"\\" is the correct method, also
in cmd (console) you can do it by doing the following:

Code: [Select all] [Download] GeSHi © Codebox Plus

pushd \\UNC_Path\Sharename

or something like that...

here! found this, it will help ;)
http://superuser.com/questions/282963/c ... ping-it-to
and this: http://support.microsoft.com/kb/317379
User avatar
Learning one
Posts: 119
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: 4 options to change the current folder in Windows Explor

16 Nov 2013, 05:06

@JnLlnd: great, thanks for sharing ;)
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

16 Nov 2013, 08:59

JnLlnd wrote:I added an "else if" to your code to detect a UNC (check if the first 2 characters are "\\").


Another approach that I'm trying is to simply remove the "file:///" prefix. This make the same pExp.Navigate call work with both files and UNC. Up to now, it works well on Win7 and XP. But I'm not sure if this would work in any situation?

Code: [Select all] [Expand] [Download] (Script.ahk)GeSHi © Codebox Plus

Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

17 Nov 2013, 14:28

I'm almost finished with PopupFolders app. If you want to give a try to v0.5, the last alpha version.

Changes since the last version posted here:
- add GuiSave, GuiCancel, RemoveFolder, EditFolder, AddSeparator, MoveFolderUp/Down, RemoveDialog, EditDialog, fix bug in GuiShow, add tray icon
- add settings hotkey to ini file (default Crtl-Windows-F), enable AddThisFolder in all version Explorer and only in WIN_7/Win_8 dialog boxes (not working in WIN_XP)
- implemented GuiAbout and GuiHelp, added About and Help to tray menu, tray tip displayed only 5 times
- removed file:/// protocol prefix, added support for ExploreWClass, implemented try/catch to Explore shell method, offer to add manually when add folder failed

All functionality are implemented. There is still a lot of (inactive) debugging code that will be removed in the beta version coming soon.

Code: [Select all] [Expand] [Download] (PopupFolders-v05-Alpha.ahk)GeSHi © Codebox Plus



This script is also available on GitHub: PopupFolders.ahk

*** Also download the language file: PopupFolders_LANG.ahk. ***
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
User avatar
JnLlnd
Posts: 227
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada

Re: 4 options to change the current folder in Windows Explor

22 Nov 2013, 22:50

Final beta version of my new app is now released. Just decided to rename to "Folders Popup" it in the last minute (what a crazy idea!).

Apps source: https://github.com/JnLlnd/FoldersPopup
Apps home page: http://code.jeanlalonde.ca/folderspopup/

Thank you all for your help (as mentioned in the app's About page).
Author of freeware apps Quick Access Popup (http://www.quickaccesspopup.com),
FoldersPopup and CSV Buddy (http://code.jeanlalonde.ca)
Azevedo
Posts: 81
Joined: 07 Feb 2014, 11:35

Re: 4 options to change the current folder in Windows Explor

07 Feb 2014, 11:40

Hi.
About this code...

Code: [Select all] [Download] (Script.ahk)GeSHi © Codebox Plus

		location := "c:\windows"
WinGet, hwnd_id, ID, A
msgbox % hwnd_id

For pExp in ComObjCreate("Shell.Application").Windows
if (pExp.hwnd = hwnd_id) ; matching window found
pExp.Navigate(location)

It works fine on a regular windows explorer window but it won't work on Open/Save dialogs.
Any help?

Thanks

Return to “Ask For Help”

Who is online

Users browsing this forum: blad4, Odlanir, RunarSF and 39 guests