0

I want a script that automatically sets a position/size for each new window I open on Firefox, since I hate how when you open a new windows it's position is relative to the last window of the program instead of opening it in the exact same place the last windows was.

^n::SendInput !a
!a::WinMove, ahk_class MozillaWindowClass,, 10,-10,1350,750

I set Ctrl+N (new windows shortcut) to send the keystroke that sets the position/size so it does it immediatly after a new windows is opened. The problem is once I set it on AHK, Ctrl+N no longer works on Firefox.

I posted this on AHK forums and a guy made this code

#IfWinActive, ahk_class MozillaWindowClass

~^n::
WinGetActiveTitle, CurrentMozillaWin
WinWaitNotActive, %CurrentMozillaWin%
WinWaitActive, %CurrentMozillaWin%
WinMove,,, 10,-10,1350,750
Return

#IfWinActive
!a::WinMove, ahk_class MozillaWindowClass,, 10,-10,1350,750

But it doesn't work for me... also if someone could tell me how to make this work with other programs such as explorer.exe that would be awesome too...

0

In a new autohotkey file, try the code below. If you need additional browsers, simply add a new group line and get the ahk_class using a google search or autohotkey's window spy.

You may need to make the sleep a bit longer if your browser is not creating the new window fast enough. I tested this version on my instance of windows 8.1 using both IE and Firefox.

GroupAdd, Inet, ahk_class IEFrame
GroupAdd, Inet, ahk_class MozillaWindowClass

#IfWinActive ahk_group Inet

~^n::
Sleep 200
WinGetTitle, ActiveWin, A
WinMove, %ActiveWin%,, 10,-10,1350,750
return

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.