Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Folder Menu - a popup menu to quickly change your folders


  • Please log in to reply
101 replies to this topic
catweazle
  • Guests
  • Last active:
  • Joined: --
I noticed that I get an error if I run the ahk script without the .exe being present in the same directory. Should the script just fall back to not using icons when the .exe is not available? Or perhaps the icons could be made available in a separate .ico file, as well as being in the .exe, so that the .exe isn't required? Maybe not worth bothering but it just seems a bit odd to require the exe to be there...

John.

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

I noticed that I get an error if I run the ahk script without the .exe being present in the same directory. Should the script just fall back to not using icons when the .exe is not available? Or perhaps the icons could be made available in a separate .ico file, as well as being in the .exe, so that the .exe isn't required? Maybe not worth bothering but it just seems a bit odd to require the exe to be there...

John.


yes, currently i use the exe as the source of icons for both running exe or ahk.
if the exe is not available, some menu items will have no icon.
and if you want to run script with icons, you can modify lines with "%f_Icons%" in the script.
"%f_Icons%" is the icon source of special items like "edit", "exit" and folder items..etc.
you can use you icons instead.

and i found that the error msg is because i forgot to add UseErrorLevel while setting tray icon...
add two lines to avoid that.
if A_IsCompiled =
{
	StringReplace, f_Icons, f_Icons, .ahk , .exe, 1
	Menu, Tray, UseErrorLevel ; avoid error msg
	Menu, Tray, Icon, %f_Icons%, 13
	Menu, Tray, UseErrorLevel, OFF ; avoid error msg
}

btw, thanks for the 3 apps support, i'll add it in the next version. : D

  • Guests
  • Last active:
  • Joined: --
This script always opens a new explorer window in Windows 7 (instead of changing the current explorer window).

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

This script always opens a new explorer window in Windows 7 (instead of changing the current explorer window).

you should use mouse middle click to open the menu to change folder in current window.
win+w will always open a new explorer.

  • Guests
  • Last active:
  • Joined: --
Rexx,

Indeed. Thank you very much for the quick response!

This is a great script! Thanks so much, your (and savage's) script really helps me a lot - every day.

Thanks!

catweazle
  • Guests
  • Last active:
  • Joined: --
I've just upgraded to the 20090413 version of FolderMenu.ahk (thanks Rexx for adding support for Emacs, FreeCommander and Rxvt).

I found that the FreeCommander support was only intermittently working - sometimes the current directory didn't change. It seems a bit bizarre but I found that calling ControlSetText twice seems to fix it (not sure why, perhaps there's a timing issue):
else if w_Class = TfcForm
	{
		Send, !g
		;ControlClick, TfcPathEdit1, ahk_id %w_WinID%
		ControlSetText, TfcPathEdit1, %f_OpenFavPath%, ahk_id %w_WinID%
		ControlSetText, TfcPathEdit1, %f_OpenFavPath%, ahk_id %w_WinID%
		ControlSend, TfcPathEdit1, {Enter}, ahk_id %w_WinID%
	}

I've also added support for Console2, which I use at work as an alternative to Rxvt (it provides tabs for multiple command windows, supporting cmd.exe, (Cygwin) zsh, powershell.exe, etc.

Here's the update to f_DisplayMenu:
; Command Prompt, Emacs, FreeCommander, Console2
if w_Class in ConsoleWindowClass,Emacs,TfcForm,Console_2_Main
{
	w_Edit1Pos = 1
	Menu, MainMenu, show
	return
}

.. and the update to f_OpenFavorite:
else if w_Class = Console_2_Main
	{
		WinActivate, ahk_id %w_WinID%
                SendMode,Play
;		SetKeyDelay, 0 ; This will be in effect only for the duration of this Thread.
                Send, cd `'%f_OpenFavPath%`'{Enter}
                Send, ls{Enter}
	}

Note, I had to use `SendMode,Play' because if I use `SetKeyDelay, 0' and try to open a folder with an underscore in its name the underscore gets replaced by a dash (-) and the `cd' obviously then fails. I guess it's a timing-related issue because if I use `SetKeyDelay, 1' it avoids the problem but then it's too slow. I had exactly the same problem when I added Console2 support to Savage's version and used `SendMode,Play' for that too.

I've also made a one-line change in f_OpenFavorite to 'run' items that are not folders:
if !FileExist(f_OpenFavPath) || !InStr(FileExist(f_OpenFavPath), "D") ; file doesn't exist or is not a folder, run it

I've noticed that if I configure a UNC path as a favorite folder it doesn't open. I haven't had chance to look into this yet, but possibly a bug assuming UNC is supported?

I've also tweaked f_DisplayMenu to allow Hotkey1 to work (just open the folder) even for apps that are not explicitly supported, as I like to be able to press the hotkey anywhere and have it just open the folder as best it can. I realize I could use hotkey2 but I have that as a mouse binding and I often just prefer to use the keyboard :-). Not sure if this behaviour should be a user option?

I just commented out these lines in f_DisplayMenu:
; return if not supported
;if w_Class not in %f_SupportApps%
;	if w_Class not contains %f_SupportAppsC%
;		return
.. and changed the end of f_DisplayMenu:
; Else just display menu
; Clear the w_Edit1Pos to do the default action
w_WinID =
w_Class =
w_Edit1Pos =
Menu, MainMenu, show
return


  • Guests
  • Last active:
  • Joined: --
Rexx,

I read the documentation again:
; The Hotkey1 will only display the menu in a supported windows and avoid showing
; the menu for other windows, while the Hotkey2 will always display the menu.
; And upon selecting a favorite while an unsupported window type is active,
; a new Explorer window will be opened to display the contents of that folder.

However on Windows 7, with Hotkey2 a new Explorer window will be opened even if a supported window is active.

Hotkey1 behaves correctly.

Please advise,
Peter

Rexx,

Indeed. Thank you very much for the quick response!

This is a great script! Thanks so much, your (and savage's) script really helps me a lot - every day.

Thanks!



rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

I found that the FreeCommander support was only intermittently working - sometimes the current directory didn't change. It seems a bit bizarre but I found that calling ControlSetText twice seems to fix it (not sure why, perhaps there's a timing issue):

;ControlClick, TfcPathEdit1, ahk_id %w_WinID%

have you tried uncomment this line?
it seems works for me.

I've also added support for Console2, which I use at work as an alternative to Rxvt (it provides tabs for multiple command windows, supporting cmd.exe, (Cygwin) zsh, powershell.exe, etc.

.. and the update to f_OpenFavorite:

	else if w_Class = Console_2_Main
	{
		WinActivate, ahk_id %w_WinID%
                SendMode,Play
;		SetKeyDelay, 0 ; This will be in effect only for the duration of this Thread.
                Send, cd `'%f_OpenFavPath%`'{Enter}
                Send, ls{Enter}
	}
Note, I had to use `SendMode,Play' because if I use `SetKeyDelay, 0' and try to open a folder with an underscore in its name the underscore gets replaced by a dash (-) and the `cd' obviously then fails. I guess it's a timing-related issue because if I use `SetKeyDelay, 1' it avoids the problem but then it's too slow. I had exactly the same problem when I added Console2 support to Savage's version and used `SendMode,Play' for that too.

i think this can use the same code as windows command prompt.
and sometimes i got problem even use only the play mode.
maybe i'll add an option to turn off the fast input.
i'll also use the play mode for fast input.

I've noticed that if I configure a UNC path as a favorite folder it doesn't open. I haven't had chance to look into this yet, but possibly a bug assuming UNC is supported?

UNC is supported in explorer, dialog..etc. for my computer.
i think it's because FileExist() return false for UNC path.
i'll check the starting "\" for UNC path

I've also tweaked f_DisplayMenu to allow Hotkey1 to work (just open the folder) even for apps that are not explicitly supported, as I like to be able to press the hotkey anywhere and have it just open the folder as best it can. I realize I could use hotkey2 but I have that as a mouse binding and I often just prefer to use the keyboard :-). Not sure if this behaviour should be a user option?

why not hotkey2?
sorry i don't get your point. :?

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

However on Windows 7, with Hotkey2 a new Explorer window will be opened even if a supported window is active.

that's what i want it to do, hotkey2 always launch a new one.
if you want to change current window, use hotkey1.

btw i use windows 7 too :D

; And upon selecting a favorite while an unsupported window type is active,
; a new Explorer window will be opened to display the contents of that folder.

i found that it's the old description by Savage, maybe i should modify it in my script :oops:

catweazle
  • Guests
  • Last active:
  • Joined: --

I found that the FreeCommander support was only intermittently working - sometimes the current directory didn't change. It seems a bit bizarre but I found that calling ControlSetText twice seems to fix it (not sure why, perhaps there's a timing issue):

;ControlClick, TfcPathEdit1, ahk_id %w_WinID%

have you tried uncomment this line?
it seems works for me.

Ah, yes, it's working now - thanks. Not sure why it was commented out :O

I've also added support for Console2, which I use at work as an alternative to Rxvt (it provides tabs for multiple command windows, supporting cmd.exe, (Cygwin) zsh, powershell.exe, etc.

.. and the update to f_OpenFavorite:

        else if w_Class = Console_2_Main
        {
                WinActivate, ahk_id %w_WinID%
                SendMode,Play
;		SetKeyDelay, 0 ; This will be in effect only for the duration of this Thread.
                Send, cd `'%f_OpenFavPath%`'{Enter}
                Send, ls{Enter}
        }
Note, I had to use `SendMode,Play' because if I use `SetKeyDelay, 0' and try to open a folder with an underscore in its name the underscore gets replaced by a dash (-) and the `cd' obviously then fails. I guess it's a timing-related issue because if I use `SetKeyDelay, 1' it avoids the problem but then it's too slow. I had exactly the same problem when I added Console2 support to Savage's version and used `SendMode,Play' for that too.

i think this can use the same code as windows command prompt.
and sometimes i got problem even use only the play mode.
maybe i'll add an option to turn off the fast input.
i'll also use the play mode for fast input.


When you say it could use the same code as windows command prompt, do you mean to use f_SendBig5? I just tried this and I get a series of random numbers entered in the Console2 window :).
With play mode, I found that occasionally (rarely) it would enter 's' instead of 'ls'. Adding a short sleep between the 2 send commands seems to fix it (so far at least):

	else if w_Class = Console_2_Main
	{
		WinActivate, ahk_id %w_WinID%
                SendMode,Play
		SetKeyDelay, 0 ; This will be in effect only for the duration of this Thread.
                Send, cd `'%f_OpenFavPath%`'{Enter}
		Sleep, 10 ; Otherwise sometimes sends 's' instead of 'ls'
                Send, ls{Enter}
	}

I've noticed that if I configure a UNC path as a favorite folder it doesn't open. I haven't had chance to look into this yet, but possibly a bug assuming UNC is supported?

UNC is supported in explorer, dialog..etc. for my computer.
i think it's because FileExist() return false for UNC path.
i'll check the starting "\" for UNC path

Argh, my mistake - I had a bogus UNC path. It's working now.

I've also tweaked f_DisplayMenu to allow Hotkey1 to work (just open the folder) even for apps that are not explicitly supported, as I like to be able to press the hotkey anywhere and have it just open the folder as best it can. I realize I could use hotkey2 but I have that as a mouse binding and I often just prefer to use the keyboard :-). Not sure if this behaviour should be a user option?

why not hotkey2?
sorry i don't get your point. :?


I like Hotkey1 (Ctrl+Shift+e for me) to always display the folder menu, even for apps that are not in the list of supported apps. It then provides a reliable way to access my favorite folders regardless of what app I'm currently working with. I could use Hotkey2 (Ctrl+RButton Up for me) but if I'm already typing at the keyboard I often find it slows me down to switch over to the mouse (I can touch type).

This means both Hotkey1 and Hotkey2 work everywhere, one available as a keyboard shortcut, one as an easy-to-reach mouse-binding, which I would use if I'm already mousing around (e.g., in Firefox). The big difference is that Hotkey1 does something app-specific (sends a `cd' command or opens the folder in the Emacs mini-buffer). Since I'm 99% of the time using the keyboard in command prompts and Emacs that works really well. Hope that makes sense!

  • Guests
  • Last active:
  • Joined: --
Hi Rexx, Is there a way (even code change) to make hotkey1 to behave like hotkey2 (always open a menu), but reuse a window if it is supported?

Thanks again for this fantastic script!


However on Windows 7, with Hotkey2 a new Explorer window will be opened even if a supported window is active.

that's what i want it to do, hotkey2 always launch a new one.
if you want to change current window, use hotkey1.

btw i use windows 7 too :D



rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

Ah, yes, it's working now - thanks. Not sure why it was commented out :O

it's commented by me, because it seems not necessary for some other apps.

When you say it could use the same code as windows command prompt, do you mean to use f_SendBig5? I just tried this and I get a series of random numbers entered in the Console2 window :).

no, i mean those in "else if w_Class in ConsoleWindowClass"

I like Hotkey1 (Ctrl+Shift+e for me) to always display the folder menu, even for apps that are not in the list of supported apps. It then provides a reliable way to access my favorite folders regardless of what app I'm currently working with. I could use Hotkey2 (Ctrl+RButton Up for me) but if I'm already typing at the keyboard I often find it slows me down to switch over to the mouse (I can touch type).

This means both Hotkey1 and Hotkey2 work everywhere, one available as a keyboard shortcut, one as an easy-to-reach mouse-binding, which I would use if I'm already mousing around (e.g., in Firefox). The big difference is that Hotkey1 does something app-specific (sends a `cd' command or opens the folder in the Emacs mini-buffer). Since I'm 99% of the time using the keyboard in command prompts and Emacs that works really well. Hope that makes sense!

i see.
seems you and the "guest" have the same question.
i'll add an option to do so.

  • Guests
  • Last active:
  • Joined: --
Rexx, thank you so much for adding a new option!

Take care,
Peter

catweazle
  • Guests
  • Last active:
  • Joined: --

no, i mean those in "else if w_Class in ConsoleWindowClass"


The code within that `if' block uses f_SendBig5, which leads to the problem I mentioned with a series of seemingly random numbers appearing. Also, it first sends something like C:{Enter}, which wouldn't work in zsh and bash.

Btw, I'd also like to thank you heartily for this excellent script. Such things really help to make working in Windows more efficient.

rexx
  • Members
  • 73 posts
  • Last active: Sep 25 2009 03:23 AM
  • Joined: 28 Feb 2006

no, i mean those in "else if w_Class in ConsoleWindowClass"


The code within that `if' block uses f_SendBig5, which leads to the problem I mentioned with a series of seemingly random numbers appearing. Also, it first sends something like C:{Enter}, which wouldn't work in zsh and bash.

f_SendBig5 is used for send big5 characters in command prompt.
you can use a normal send to replace it.
and console2 can use windows cmd or bash, but their commands are not the same. cmd has no ls, and bash has no C:{Enter}, something like that.
so i decide not to add console2 support, also because of many problems with sending speed.
if you really need it maybe you can add it yourself, i'll always post the script here.

Btw, I'd also like to thank you heartily for this excellent script. Such things really help to make working in Windows more efficient.

thanks :D