AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WinClose vs. Process, Close

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jtuttle



Joined: 06 Nov 2008
Posts: 26

PostPosted: Tue Jun 09, 2009 10:06 am    Post subject: WinClose vs. Process, Close Reply with quote

I'm trying to close a program via WinClose, but the program in question, by default, minimizes to systray so WinClose, windowname doesn't work - as there is no window. I don't want to just nuke the process via Process, Close but I don't know what exactly to do here. If the icon was at a reliable position in the systray I could just doubleclick it and then WinClose the window, but it isn't.


Program in question is uTorrent - I'm working on a script to automatically start it when the computer goes idle and close it when the computer stops being idle. The whole rest of the script works, just hung on this. x.x
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Jun 09, 2009 10:17 am    Post subject: Re: WinClose vs. Process, Close Reply with quote

jtuttle wrote:
Program in question is uTorrent


Code:
DetectHiddenWindows, On
Process, Exist, utorrent.exe
WinGet, W, List, ahk_pid %ErrorLevel%
Loop %W%
 {
 WinGetClass, Class, % "ahk_id" W%A_Index%
 If InStr( Class, "µTorrent" ) {
   hWnd := W%A_Index%
   Break
 }}
MouseGetPos, X, Y
MouseMove, A_ScreenWidth, A_ScreenHeight, 0
PostMessage, 0x8001, 0,0x204,, ahk_id %hWnd% ; Right Click down
PostMessage, 0x8001, 0,0x205,, ahk_id %hWnd% ; Right Click Up
ControlSend,,{Up 1}{Enter},ahk_id %hWnd%
MouseMove, X, Y, 0


http://www.autohotkey.com/forum/viewtopic.php?t=41097
_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
jtuttle



Joined: 06 Nov 2008
Posts: 26

PostPosted: Tue Jun 09, 2009 10:36 am    Post subject: Reply with quote

Not exactly what I was hoping for, but it does exactly what I needed, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group