AutoHotkey Community

It is currently May 26th, 2012, 4:15 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 181 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 13  Next
Author Message
 Post subject:
PostPosted: April 10th, 2009, 9:41 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 11th, 2009, 4:41 am 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
catweazle wrote:
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.
Code:
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 12:34 am 
This script always opens a new explorer window in Windows 7 (instead of changing the current explorer window).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 7:43 am 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
Anonymous wrote:
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 8:48 am 
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 11:48 am 
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):
Code:
   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:
Code:
; 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:
Code:
   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:
Code:
; 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:
Code:
; Else just display menu
; Clear the w_Edit1Pos to do the default action
w_WinID =
w_Class =
w_Edit1Pos =
Menu, MainMenu, show
return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 11:53 am 
Rexx,

I read the documentation again:
Code:
; 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

Anonymous wrote:
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 1:57 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
catweazle wrote:
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):
Code:
;ControlClick, TfcPathEdit1, ahk_id %w_WinID%


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

catweazle wrote:
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:
Code:
   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.

catweazle wrote:
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

catweazle wrote:
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. :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 2:02 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
Anonymous wrote:
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

Anonymous wrote:
Code:
; 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:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 5:58 pm 
rexx wrote:
catweazle wrote:
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):
Code:
;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

rexx wrote:
catweazle wrote:
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:
Code:
        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):

Code:
   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}
   }

rexx wrote:
catweazle wrote:
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.

rexx wrote:
catweazle wrote:
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 11:52 pm 
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!


rexx wrote:
Anonymous wrote:
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



Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 3:48 am 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
catweazle wrote:
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.

catweazle wrote:
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"

catweazle wrote:
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 7:02 am 
Rexx, thank you so much for adding a new option!

Take care,
Peter


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2009, 9:40 am 
rexx wrote:
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2009, 12:46 pm 
Offline

Joined: February 28th, 2006, 4:38 pm
Posts: 73
catweazle wrote:
rexx wrote:
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.

catweazle wrote:
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 181 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 13  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto, Google [Bot] and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group