AutoHotkey Community

It is currently May 27th, 2012, 11:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: February 15th, 2006, 12:11 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
Hi,

what I don't really like about "process, close, bla.exe" is that it just kills the process but leaves the program's tray icon in the tray... do you know any way to prevent that?

_________________
DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2006, 12:37 pm 
Offline

Joined: November 15th, 2005, 11:15 am
Posts: 537
Location: Germany
Hi,
well it's the same behaviour, if you kill the thread with taskmanager.
The Explorer doesn't recognize, that the tread had died.

I have only 2 very bad "solutions"
1. Kill all explorer-tasks and start a new one. The tray is recreated. But this means that all explorerwindows will close and some programs does not draw its trayicon again so you can "loose" some icons (Really bad idea)

The second idea: If you move your mouse over the icon, it vanishes.
Perhaps you can remember the current mouseposition, gets the coordinates of the trayicon, kill the thread, move the mouse to that position and moves it back.

I hope somebody has better ideas :-)

Ciao
Micha


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2006, 12:54 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
WinSet Redraw, , ahk_class TrayNotifyWnd
(Untested)

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on February 15th, 2006, 7:09 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2006, 2:19 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
@Micha:
Hehe, nice, I thought about something like that too but then thought there MUST be some better way :)

@PhiLho:
Thanks, sounds perfect, but doesn't work :(

I tried
Code:
WinSet Redraw, , ahk_class TrayNotifyWnd


and

Code:
WinSet, Redraw, , ahk_class Shell_TrayWnd


and even

Code:
DetectHiddenWindows, on
WinSet, Redraw, , ahk_class Shell_TrayWnd



..but nothing works :(

_________________
DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2006, 3:19 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
TrayNotifyWnd1 seems to refresh after you move the mouse over it. You can use MouseMove to simulate this.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2006, 3:53 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
I'm not sure I can follow... since I'm using the Windows task bar on the left side of the desktop my (currently 15) tray icons are piling up in 3 icon rows... so you suggest to zig-zag the mouse over all the possible tray icon positions with MouseMove?

_________________
DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 15th, 2006, 7:11 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
The doc. suggests to try to hide and unhide the window if WinSet Redraw fails... Still untested...

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2006, 3:25 am 
Offline

Joined: February 9th, 2006, 10:39 am
Posts: 33
I was just to ask the same thing & I stumble on this thread :D

Now I'm using the MouseMove solution but thats not foolproof, somehow refreshing the systray would do it but I've no idea how to do that (exept for killing explorer.exe & restarting it but that's a bit overkill :lol:).

More ideas are welcome...

_________________
In a world without walls and fences, who needs Windows and Gates?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2006, 12:19 pm 
Offline
User avatar

Joined: December 20th, 2004, 12:19 pm
Posts: 798
Location: LooseChange911.com Ask Questions, Demand Answers █ The WTC bldgs █ shouldn't have fallen █ that fast
Whitespliff wrote:
More ideas are welcome...

...have you both tried all manner of asking the process to close besides Process, Close...get a handle to a window & do WinClose on it or do PostMessage, WM_CLOSE or WM_QUIT...or something...anything is better than Process, Close...what programs do you need to close so hard?

Code:
WM_CLOSE=0x10
WM_QUIT=0x12

DetectHiddenWindows, On
Process, Exist, dienow.exe
pid:=errorlevel
IfWinExist, ahk_pid %pid%
{
   WinClose
   ;PostMessage, WM_CLOSE
   ;PostMessage, WM_QUIT
}
else msgbox, No dice!

_________________
AutoHotkey-Hotstring.ahk - Helping the world spell "AutoHotkey" correctly! (btw, it's a lowercase k!)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2006, 1:21 pm 
Offline

Joined: February 9th, 2006, 10:39 am
Posts: 33
In my case it are 2 processes that start along with my TV software, when I close PCTV the processes keep running.

EDIT: I'm not on the cpu that has the script running but I think this would work, TNX!

_________________
In a world without walls and fences, who needs Windows and Gates?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2006, 9:18 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
JSLover wrote:
...have you both tried all manner of asking the process to close besides Process, Close...get a handle to a window & do WinClose on it or do PostMessage, WM_CLOSE or WM_QUIT...or something...anything is better than Process, Close...


You are totally right, I'm now using your WM_QUIT approach, thanks! :)

Too bad that neither that removes the tray icon...

_________________
DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2006, 10:01 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
Buried in the manual somewhere was this method I've been using of closing windows, which is supposed to be the same as clicking on the window close button (the X):

Code:
WindowID = ; need to get the window ID one way or another

; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
PostMessage, 0x112, 0xF060,,, ahk_id %WindowID%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2006, 5:34 pm 
Offline

Joined: February 9th, 2006, 10:39 am
Posts: 33
brotherS wrote:
Too bad that neither that removes the tray icon...
Strange, it removes the tray icon on my scripts.
There was 1 script where I had to loop it 2 times before the icon disappeared.

_________________
In a world without walls and fences, who needs Windows and Gates?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 18th, 2006, 7:19 pm 
Offline
User avatar

Joined: December 20th, 2004, 12:19 pm
Posts: 798
Location: LooseChange911.com Ask Questions, Demand Answers █ The WTC bldgs █ shouldn't have fallen █ that fast
brotherS wrote:
Too bad that neither that removes the tray icon...

...what prog? Also...instead of zig-zagging you could make an image (screenshot) of only the tray icon...then use ImageSearch to find it on screen & MouseMove to the icon & back...to cause it to disappear from a mouse over...if nothing else ends up working...

Whitespliff wrote:
There was 1 script where I had to loop it 2 times before the icon disappeared.

...ok...

Code:
WM_CLOSE=0x10
WM_QUIT=0x12

DetectHiddenWindows, On
Process, Exist, dienow.exe
pid:=errorlevel
Loop
{
   IfWinExist, ahk_pid %pid%
   {
      WinClose
      ;PostMessage, WM_CLOSE
      ;PostMessage, WM_QUIT
   }
   else if A_Index>1
      break
   else msgbox, No dice!
}

_________________
AutoHotkey-Hotstring.ahk - Helping the world spell "AutoHotkey" correctly! (btw, it's a lowercase k!)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 19th, 2006, 9:08 pm 
Offline

Joined: June 1st, 2005, 12:36 pm
Posts: 174
Thanks for your help, I still hope Chris will come up with a RefreshTray command though... :lol:

_________________
DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Edd, Exabot [Bot], Google Feedfetcher, HotkeyStick and 12 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