AutoHotkey Community

It is currently May 26th, 2012, 9:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 73 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: July 8th, 2008, 11:51 pm 
Offline

Joined: June 3rd, 2008, 7:34 pm
Posts: 86
Location: Italy
I found an XP machine to trying reproduce the behaviour with the previous version of the script. In XP right-clicking the icon of the window minimized works as expected, unminimizing window like the left button, but i found a more strange behaviour following these tasks:

1) Minimize a window
2) Right click the script tray icon and then right click the minimized window tray icon without deleting the ahk default menu.

This time, the window will be unminimized, but the tray icon will remain and the default ahk menu will be shown. Furthermore, if the unminimized window is on full-screen, right clicking the hanged tray icon will toggle the full-screen to that window. To unlock the hanged tray icon, you must minimize to tray the relative window and the unminimize it.

These behaviour is fixed by your new version. When i go home i will test it in Vista.

Thank you :D

_________________
All my scripts/snippets are released under the WTFPL: http://sam.zoy.org/wtfpl/COPYING


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2008, 7:07 am 
Offline

Joined: June 3rd, 2008, 7:34 pm
Posts: 86
Location: Italy
Excellent, works with Vista like a charm. Fixed all behaviours, also the "half working" minimize button.


For me, this is the script of the year :)

_________________
All my scripts/snippets are released under the WTFPL: http://sam.zoy.org/wtfpl/COPYING


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2008, 1:08 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
ABCza wrote:
Excellent, works with Vista like a charm. Fixed all behaviours, also the "half working" minimize button.
For me, this is the script of the year :)

Thanks! And glad that it works flawlessly for you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 26th, 2008, 11:10 pm 
Offline

Joined: July 17th, 2008, 7:16 pm
Posts: 15
Wonderful script!
As I need to minimize with AltGr+K and as inexperienced, I added: ...
Code:
...
OnExit
ExitApp

<^>!k::                 ; ************************* ADDED
     WinTraymin(h)

RButton Up::
If   h:=WM_NCHITTEST()
   WinTraymin(h)
Else   Click, % SubStr(A_ThisHotkey,1,1)   ; for hotkey: LButton/MButton/RButton
Return
...

Seems working, no side effect ...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2008, 1:39 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
kardus wrote:
Wonderful script!
Thanks.
Quote:
As I need to minimize with AltGr+K and as inexperienced, I added: ...
I suggest to use the following instead.
Code:
<^>!k::WinTraymin()


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2009, 5:01 pm 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
Great script. I'm using it with FreeSpell 4.5, which is useful for spell checking any selected (highlighted) text. (I use it for tex-files). The free version doesn't let you minimize it to tray, so I use this function.

Problem: When I move the mouse cursor over the FreeSpell tray icon, the icon disappears. The process continues to run in the background, and will check any selected text when the chosen hotkey is pressed, but I'd like to see the tray icon just to know whether the program is running or not - I don't think the tray icon has any menus or such.

Is there any way to modify the WinTraymin function so preserve the tray icon?

I have the script as posted in my Lib directory, and here's my code for launching FreeSpell:

Code:
;to start FreeSpell minimized in tray
#f3::
Run %A_ProgramFiles%\FreeSpell\FreeSpell.exe
WinWait, FreeSpell 4.5 ahk_class #32770
freeID:= WinExist("FreeSpell 4.5 ahk_class #32770")
WinTraymin(freeID,0)
ToggleFree:=1
Return

;to call FreeSpell from tray (or hidden state) or to send it back
+#f3::
If ToggleFree = 1
{
  WinTraymin(freeID,-1)   
  WinRestore, FreeSpell 4.5 ahk_class #32770
  ToggleFree:= -1
}
Else
{
  WinTraymin(freeID,0)
  ToggleFree:= 1
}
Return

_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2009, 10:23 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
pajenn wrote:
Is there any way to modify the WinTraymin function so preserve the tray icon?
Ensure that the auto-execution section of the script is actually executed, specifically in this case DetectHiddenWindows On and hAHK.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 26th, 2009, 12:00 am 
Offline

Joined: February 7th, 2009, 11:28 pm
Posts: 384
Sean wrote:
pajenn wrote:
Is there any way to modify the WinTraymin function so preserve the tray icon?
Ensure that the auto-execution section of the script is actually executed, specifically in this case DetectHiddenWindows On and hAHK.


That worked. Thanks.

In particular, I added the two lines to my code for launching FreeSpell:

Code:
#f3::
Run %A_ProgramFiles%\FreeSpell\FreeSpell.exe
WinWait, FreeSpell 4.5 ahk_class #32770
freeID:= WinExist("FreeSpell 4.5 ahk_class #32770")
DetectHiddenWindows On
hAHK:=WinExist("ahk_class AutoHotkey ahk_pid " . DllCall("GetCurrentProcessId"))
WinTraymin(freeID,0)
ToggleFree:=1
Return


fwiw, I changed the FreeSpell launcher script to just minimize the program to tray if already running, but not minimized, and vice versa:

Code:
#f3::
Process, Exist, FreeSpell.exe
If ErrorLevel
{
  DetectHiddenWindows, Off
  If !WinExist("FreeSpell 4.5 ahk_class #32770")   
  {
    WinTraymin(freeID,-1)   
    WinRestore, FreeSpell 4.5 ahk_class #32770
  }
  Else
    WinTraymin(freeID,0)
}
Else
{
  Run %A_ProgramFiles%\FreeSpell\FreeSpell.exe
  WinWait, FreeSpell 4.5 ahk_class #32770
  freeID:= WinExist("FreeSpell 4.5 ahk_class #32770")
  DetectHiddenWindows, On
  hAHK:=WinExist("ahk_class AutoHotkey ahk_pid " . DllCall("GetCurrentProcessId"))
  WinTraymin(freeID,0)
}
Return

_________________
Hardware: 1.8 GHz laptop with 4 GB ram, Windows XP/SP3
Software: Prevx, Privatefirewall, KeyScrambler.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: WinTraymin Menu
PostPosted: November 9th, 2009, 12:48 pm 
Offline

Joined: June 17th, 2008, 9:03 pm
Posts: 19
Location: Kiel, Germany
Who knows how to add a menu to the trayicon :?:
So that each minimized window has its own menu (Restore and Exit) :idea:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: WinTraymin Menu
PostPosted: November 9th, 2009, 3:35 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Open the script and search
Code:
If wParam=1028
and replace with
Code:
If (wParam=1028||lParam=0x205)
then see what happen at right click. You got the idea now.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: WinTraymin Menu
PostPosted: November 9th, 2009, 8:00 pm 
Offline

Joined: June 17th, 2008, 9:03 pm
Posts: 19
Location: Kiel, Germany
Thanks, Sean.
If someone is interested: This is the code that works for me as desired (inside my ever running script).
Code:
Menu, wtmMenu, Add, Restore, wtm_Restore
Menu, wtmMenu, Add, Exit, wtm_Exit
Menu, wtmMenu, Default, Restore
; end of autoexcute

wtmRestore:
  WinShow, ahk_id %wtmhwnd%
  WinActivate, ahk_id %wtmhwnd%
Return

wtmExit:
  WinClose, ahk_id %wtmhwnd%
Return


WM_SHELLHOOKMESSAGE(wParam, lParam, nMsg)
  {
    Global wtmhwnd
    Critical
    If nMsg=1028
      {
        If   wParam=1028
            Return
        Else If lParam=0x205 ; RButton
          {
            wtmhwnd := hWnd_%wParam%
            Menu, wtmMenu, Show
          }

        Else If (lParam=0x201||lParam=0x207)
            WinTraymin(hWnd_%wParam%,3)
      }
    Else If (wParam=1||wParam=2)
        WinTraymin(lParam,wParam)
    Return 0
  }


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 13th, 2009, 2:59 am 
iv gota program 'taskbar shuffle', its pretty useful, just helps me rearrange the taskbar icons and stuff but this program doesnt work with it. taskbar shuffle works by grabbing a tray icon and dragging it along, shifting its position. when i click on the minimized icon, it restores it, but doesnt register releasing the click.

its like i clicked it to resize it then continue to drag the icon. do u have any idea to help me?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2009, 8:33 am 
Offline

Joined: September 23rd, 2008, 3:37 am
Posts: 49
Excellent, works with Windows XP and Windows 7 Ultimate like a charm - Thanks a lot Sean.

One question:
Many applications use icons for their windows(the icon at the left side of Window title) that are different from the .exe icon.
Is it possible for this script to find and use this icon as the minimized window's tray icon?

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2009, 1:00 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Basically you can use WM_GETICON for that.
Code:
hIcon_%uID% := DllCall("user32\SendMessage", "Uint", hWnd, "Uint", 127, "Uint", 0, "Uint", 0, "Uint") ; ICON_SMALL:=0, ICON_BIG:=1, ICON_SMALL2:=2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2009, 8:35 pm 
Offline

Joined: September 23rd, 2008, 3:37 am
Posts: 49
Quote:
Basically you can use WM_GETICON for that.

Thanks Sean, but just replacing the "hIcon_%uID%" line 73 with new one, i get no tray icon at all! It seems that something i missed.

Also, it would be very useful if the tray icon's tooltip shows the title of the minimized window.

Thanks a lot


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: stevep and 22 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