Jump to content

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

Trying to write a hot key to bring a program, not a window, to the top and activate


  • Please log in to reply
2 replies to this topic
karamazov
  • Members
  • 6 posts
  • Last active: Mar 12 2014 06:06 PM
  • Joined: 21 Nov 2013

Hi all,

 

So I am trying to write a hot key that will bring a window, and all the windows assocaited with it, to the top of the screen.  (I hope I am correct in refering to this as a "program" instead of a window)

 

Specifically, I want to press F12, and bring my instant messaging buddy list, and all the open chat windows, to the top.  So far i have this script:

 

-------------------------------------------------------------------

;F12 will bring "Buddy List" to top and activate window

F12::
    SetTitleMatchMode 2
    IfWinExist Buddy List
    {
        WinSet Top
        WinActivate
    }
    return

 

-------------------------------------------------------------------

 

The problem I run into here is that each chat window has a different window name depending on who I am messaging.  Is there anyway to bring the buddy list and all associated windows to the top?

 

 

*** Additionally, I have been playing around with WinMinimize, and I can't get it to work.  I want to minimize the window if it is already active and on top if the same hot key is pressed

 

Thanks!



losjava
  • Members
  • 4 posts
  • Last active: May 08 2014 07:50 AM
  • Joined: 08 Mar 2014

What about marking each window you want and setting always on top?

I can't give you an example but you'd use

WinGet, active_pid, PID, A

and

 

Winset, Alwaysontop, , A

 

 

Hope this helps

 

Edit: Perhaps you can get process ID instead?



nomad619
  • Members
  • 39 posts
  • Last active: Aug 06 2016 06:42 PM
  • Joined: 01 Apr 2011

If you have pretty much the same 'buddies' each time you are using this program, then use windows spy to look at the title of each window that is revealed and the cabinet class of the program.

 

Then if you create a group in the autoexecute part of  your script: (this is an example from one of my scripts which does something when the two folders listed are opened)

GroupAdd, secure, ahk_class CabinetWClass,  GoogleDrive , non 
GroupAdd, secure, ahk_class CabinetWClass,  Run Apps, non 

Then you use the hotkey to activate the group

f12::
WinActivate, ahk_group secure ;(secure is the name that I gave to my group, you call it what you want for example 'buddy'