Bring window foreground

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Carnedge
Posts: 6
Joined: 21 Dec 2015, 11:46

Bring window foreground

21 Dec 2015, 12:00

I'm looking for information in regards to Autohotkey to see if it can execute a certain function. What I'm am looking for is a script that calls an already open window to the top when shift is held and when shift is released it'll go back to where it was. The window itself has a set name so that would be predefined in the code.

I play two accounts of a video game. While holding shift the second account becomes to master and the "actual master" account takes its commands from it. If I could get a script that brings the second account to the foreground while shift is held it would make the process much easier than alt-tabbing.

Any help would be appreciated. Even if the solution is not Autohotkey.
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Bring window foreground

21 Dec 2015, 12:09

doable in AHK with some work

Carnedge
Posts: 6
Joined: 21 Dec 2015, 11:46

Re: Bring window foreground

21 Dec 2015, 12:44

It looks like I can use Winshow and Winhide with +(shift) as a modifier. Not sure how to set all this up exactly to work without shift being held... Maybe I could use 2 Winshow commands (1 for each window) and have the shift tied to the second one. Put the second one above the main one with some sort of stop script below the second one to keep the main one from activating if shift is held...
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: Bring window foreground

21 Dec 2015, 13:10

i originally thought you may need to do a GetKeyState() but it seems not

Code: Select all

~Shift::
   WinActivate, Untitled - Notepad
return

~Shift Up::
   WinActivate, Calculator
return

Esc:ExitApp

Carnedge
Posts: 6
Joined: 21 Dec 2015, 11:46

Re: Bring window foreground

21 Dec 2015, 18:05

You're awesome! Works like a charm! Only had to add a second : after Esc to get it to compile. I love you m8
Carnedge
Posts: 6
Joined: 21 Dec 2015, 11:46

Re: Bring window foreground

21 Dec 2015, 20:00

Hmmm I've run into a problem. The Shift key works great. Since all the movement keys are bound to Shift-up, Shift-left, Shift-right as soon as it hit shift my 2nd character takes off. However all of my 2nd characters cool downs (First also but with a nomod:shift in them) are bound to Alt 1-9. So when I hold shift on my second character and go to use a cooldown ability by pressing Alt my screen goes back to my primary character. Pressing Alt stops the script. I tried adding in a script that makes my second account come to the foreground when pressing Alt&Shift... and it works IF I press alt and shift at the same time. But If am already pressing Shift and then go to hit Alt the screen drops.

Only thing I can think of is maybe having the script ignore the Alt key somehow.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Rohwedder and 122 guests