Split Screen to 4 windows Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Caporeira
Posts: 14
Joined: 23 Mar 2021, 08:05

Split Screen to 4 windows

23 Mar 2021, 08:15

I want to split screen (i want to have 4 windows on my display).

I founded this script, and it help to split two windows on my display.
How to modify it, or maybe the are ready script for this ?

Code: Select all

;-------------------- 
;HiRes Screen Splitter -- by JOnGliko 
;-------------------- 
; 
;Split the screen in areas 
;Really usefull for HiRes Monitor, make it look like dual monitor ! 
; 
; 
;Hotkey for the ACTIVE window--> WinKey + Arrow direction && WinKey + Numpad 1 2 3 4 5 6 7 8 9 
;Hotkey for the window under the ACTIVE window--> WinKey + Alt + Arrow direction && WinKey + Alt Numpad 1 2 3 4 5 6 7 8 9 
;Special Hotkey --> Two Time on the Up arrow maximize the active window (num 0 on the pad do the same) 
;Special Hotkey --> Two Time on the down arrow minimize the active window 
;_______________________________________________________________________ 


#Left:: 
#Numpad4:: ;put the Active window in the left part of the screen 
   ToLeft() 
Return 

#!Left:: 
#!Numpad4:: 
   Send, !{esc} 
   ToLeft() 
   Send, !+{esc} 
Return    
    
#Right:: 
#Numpad6::  ;put the Active window in the right part of the screen 
  ToRight() 
Return 

#!Right:: 
#!Numpad6:: 
   Send, !{esc} 
   ToRight() 
   Send, !+{esc} 
Return 

#Up:: 
#Numpad8:: 
if (A_PriorHotkey <> "#Up" or A_TimeSincePriorHotkey > 400) 
{ 
   KeyWait, Up 
   ToUp() ; One time key press put the Active window to top 
   return 
} 
   ToMaxi() ; Two time key press maximize the active window 
Return 

#!Numpad8:: 
#!Up:: 
   Send, !{esc} 
   ToUp() 
   Send, !+{esc} 
Return 

#Down:: 
#Numpad2:: 
if (A_PriorHotkey <> "#Down" or A_TimeSincePriorHotkey > 400) 
{ 
   KeyWait, Down 
   ToBottom()  ; One time key press put the window on the bottom 
   return 
} 
   WinMinimize, A ; Two time key press minimize the active window 
Return 

#!Down:: 
#!Numpad2:: 
   Send, !{esc} 
   ToBottom() 
   Send, !+{esc} 
Return 

#Numpad0:: ;Maximize 
   ToMaxi() 
Return        

#Numpad7:: ;put the Active window in the upper left corner 
   ToUpperLeft() 
Return 

#!Numpad7:: ;put the window in the upper left corner 
   Send, !{esc} 
   ToUpperLeft() 
   Send, !+{esc} 
Return 

#Numpad9:: ;put the Active window in the upper right corner 
   ToUpperRight() 
Return 

#!Numpad9:: ;put the window in the upper right corner 
   Send, !{esc} 
   ToUpperRight() 
   Send, !+{esc} 
Return 

#Numpad3:: ;put the Active window in the bottom right corner 
   ToBottomRight() 
Return 

#!Numpad3:: ;put the window in the bottom right corner 
   Send, !{esc} 
   ToBottomRight() 
   Send, !+{esc} 
Return 

#Numpad1:: ;put the Active window in the bottom left corner 
   ToBottomLeft() 
Return 

#!Numpad1:: ;put the window in the bottom left corner 
   Send, !{esc} 
   ToBottomLeft() 
   Send, !+{esc} 
Return 

#Numpad5:: ;Center the Active window 
   ToMiddle() 
Return 

#!Numpad5:: ;Center the window 
   Send, !{esc} 
   ToMiddle() 
   Send, !+{esc} 
Return 

ToUp() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,0,0,A_ScreenWidth,A_ScreenHeight/2-TrayHeight/2 
   Return 
} 
ToBottom() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,0,A_ScreenHeight/2-TrayHeight/2,A_ScreenWidth,A_ScreenHeight/2-TrayHeight/2 
   Return 
} 
ToLeft() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,0,0,A_ScreenWidth/2,A_ScreenHeight-TrayHeight 
   Return 
} 
ToRight() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight-TrayHeight 
   Return 
} 
ToMaxi() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,0,0,A_ScreenWidth,A_ScreenHeight-TrayHeight 
   Return 
} 
ToMiddle() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,A_ScreenWidth/4,0,A_ScreenWidth/2,A_ScreenHeight-TrayHeight 
   Return 
} 
ToUpperLeft() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,0,0,A_ScreenWidth/2,A_ScreenHeight/2-TrayHeight/2 
   Return 
} 
ToUpperRight() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,A_ScreenWidth/2,0,A_ScreenWidth/2,A_ScreenHeight/2-TrayHeight/2 
   Return 
} 
ToBottomLeft() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,0,A_ScreenHeight/2-TrayHeight/2,A_ScreenWidth/2,A_ScreenHeight/2-TrayHeight/2 
} 
ToBottomRight() 
{ 
   WinGetPos,,,,TrayHeight,ahk_class Shell_TrayWnd,,, 
   WinMove,A,,A_ScreenWidth/2,A_ScreenHeight/2-TrayHeight/2,A_ScreenWidth/2,A_ScreenHeight/2-TrayHeight/2 
}
Last edited by gregster on 23 Mar 2021, 11:33, edited 1 time in total.
Reason: Topic moved to 'Ask For Help'.
User avatar
boiler
Posts: 16952
Joined: 21 Dec 2014, 02:44

Re: Split Screen to 4 windows

23 Mar 2021, 14:42

It already has the capability to put windows into each of the four corners. Don't the hotkeys below do what you want?

Win+Numpad7 - put the active window in the upper-left corner

Win+Numpad9 - put the active window in the upper-right corner

Win+Numpad3 - put the active window in the lower-right corner

Win+Numpad1 - put the active window in the lower-left corner


The Win and any Numpad number keys are laid out nicely such that they put the active window into the corner or top/bottom/sides/middle that correspond to the Numpad layout.
Rohwedder
Posts: 7645
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Split Screen to 4 windows  Topic is solved

24 Mar 2021, 04:02

Hallo,
@boiler the ability you describe does not have my Windows 10 Pro, 2009.
But maybe I disabled it sometime earlier.
@Caporeira your script already has the capability you want!

Since I have 2 monitors I use the following script.
Left Win key + Numpad keys for the left monitor, right correspond:

Code: Select all

SysGet, Mo, 80 ;Number of monitors
Loop,% Mo
{ ;capture the MonitorWorkAreas of your monitors
    n := A_Index
    SysGet, Mo%n%, MonitorWorkArea, %n%
    Mo%n%Width := Mo%n%Right - Mo%n%Left, Mo%n%Height := Mo%n%Bottom - Mo%n%Top
}
Return
#IF (LR := GetKeyState("LWin")) Or (LR := Min(Mo,2*GetKeyState("RWin")))
#Numpad1::WinMove, A,,Mo%LR%Left,Mo%LR%Top+Mo%LR%Height//2,Mo%LR%Width//2,Mo%LR%Height//2
#Numpad2::WinMove, A,,Mo%LR%Left,Mo%LR%Top+Mo%LR%Height//2,Mo%LR%Right,Mo%LR%Bottom//2
#Numpad3::WinMove, A,,Mo%LR%Left+Mo%LR%Width//2,Mo%LR%Top+Mo%LR%Height//2,Mo%LR%Width//2,Mo%LR%Height//2
#Numpad4::WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height
#Numpad5::
WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width,Mo%LR%Height
WinMaximize, A
Return
#Numpad6::WinMove, A,,Mo%LR%Left+Mo%LR%Width//2,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height
#Numpad7::WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height//2
#Numpad8::WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width,Mo%LR%Height//2
#Numpad9::WinMove, A,,Mo%LR%Left+Mo%LR%Width//2,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height//2
#If
Edit: Script shortened.
Last edited by Rohwedder on 24 Mar 2021, 11:50, edited 1 time in total.
User avatar
boiler
Posts: 16952
Joined: 21 Dec 2014, 02:44

Re: Split Screen to 4 windows

24 Mar 2021, 06:47

Rohwedder wrote:
24 Mar 2021, 04:02
Hallo,
@boiler the ability you describe does not have my Windows 10 Pro, 2009.
But maybe I disabled it sometime earlier.
I was telling him about the script’s capabilities, not built-in Windows features.
Caporeira
Posts: 14
Joined: 23 Mar 2021, 08:05

Re: Split Screen to 4 windows

22 Apr 2021, 02:43

boiler wrote:
23 Mar 2021, 14:42
It already has the capability to put windows into each of the four corners. Don't the hotkeys below do what you want?

Win+Numpad7 - put the active window in the upper-left corner

Win+Numpad9 - put the active window in the upper-right corner

Win+Numpad3 - put the active window in the lower-right corner

Win+Numpad1 - put the active window in the lower-left corner


The Win and any Numpad number keys are laid out nicely such that they put the active window into the corner or top/bottom/sides/middle that correspond to the Numpad layout.
You have right ! It works very well :) Thank you.
Rohwedder wrote: Hallo,
@boiler the ability you describe does not have my Windows 10 Pro, 2009.
But maybe I disabled it sometime earlier.
@Caporeira your script already has the capability you want!

Since I have 2 monitors I use the following script.
Left Win key + Numpad keys for the left monitor, right correspond:

Code: Select all

SysGet, Mo, 80 ;Number of monitors
Loop,% Mo
{ ;capture the MonitorWorkAreas of your monitors
    n := A_Index
    SysGet, Mo%n%, MonitorWorkArea, %n%
    Mo%n%Width := Mo%n%Right - Mo%n%Left, Mo%n%Height := Mo%n%Bottom - Mo%n%Top
}
Return
#IF (LR := GetKeyState("LWin")) Or (LR := Min(Mo,2*GetKeyState("RWin")))
#Numpad1::WinMove, A,,Mo%LR%Left,Mo%LR%Top+Mo%LR%Height//2,Mo%LR%Width//2,Mo%LR%Height//2
#Numpad2::WinMove, A,,Mo%LR%Left,Mo%LR%Top+Mo%LR%Height//2,Mo%LR%Right,Mo%LR%Bottom//2
#Numpad3::WinMove, A,,Mo%LR%Left+Mo%LR%Width//2,Mo%LR%Top+Mo%LR%Height//2,Mo%LR%Width//2,Mo%LR%Height//2
#Numpad4::WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height
#Numpad5::
WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width,Mo%LR%Height
WinMaximize, A
Return
#Numpad6::WinMove, A,,Mo%LR%Left+Mo%LR%Width//2,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height
#Numpad7::WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height//2
#Numpad8::WinMove, A,,Mo%LR%Left,Mo%LR%Top,Mo%LR%Width,Mo%LR%Height//2
#Numpad9::WinMove, A,,Mo%LR%Left+Mo%LR%Width//2,Mo%LR%Top,Mo%LR%Width//2,Mo%LR%Height//2
#If
Edit: Script shortened.
How can i implement this option the script one I use (i have two monitors) ?
Caporeira
Posts: 14
Joined: 23 Mar 2021, 08:05

Re: Split Screen to 4 windows

22 Apr 2021, 04:30

@boiler It's working, very well, thank you :)
@Rohwedder How can I implement this to that one script I use ? I want to use also for two monitors.
Rohwedder
Posts: 7645
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Split Screen to 4 windows

22 Apr 2021, 10:35

You want to implement my script into the one script you are using, that is "HiRes Screen Splitter -- by JOnGliko"?
Doesn't work, because my script uses hotkeys which are also used by "HiRes Screen Splitter"!
Either you give "HiRes Screen Splitter" the ability to work with 2 monitors or you complete my script with what you are still missing.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: downstairs, filipemb, OrangeCat and 165 guests