AutoHotKey 소스코드 입니다.
; 활성창을 해당 모니터 영역의 좌측 1/2영역에 배치
^+1::
WinGetActiveTitle, title
WinGetPos, x, y, Width, Height, %title%
SysGet, MonitorCount, MonitorCount
Loop, %MonitorCount%
{
SysGet, Monitor, Monitor, %A_Index%
SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
if (MonitorWorkAreaLeft < MonitorWorkAreaRight){
half_width := (MonitorWorkAreaRight - MonitorWorkAreaLeft) / 2
}
else {
half_width := (MonitorWorkAreaLeft - MonitorWorkAreaRight) / 2
}
if ( x >= MonitorWorkAreaLeft && x < MonitorWorkAreaRight )
{
;MsgBox, 'Target Monitor NO: ' %A_Index%
WinMove, %title%, , MonitorLeft, MonitorTop, half_width, MonitorWorkAreaBottom
Break
}
}
return
; 활성창을 해당 모니터 영역의 우측 1/2영역에 배치
^+2::
WinGetActiveTitle, title
WinGetPos, x, y, Width, Height, %title%
SysGet, MonitorCount, MonitorCount
Loop, %MonitorCount%
{
SysGet, Monitor, Monitor, %A_Index%
SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
if (MonitorWorkAreaLeft < MonitorWorkAreaRight){
half_width := (MonitorWorkAreaRight - MonitorWorkAreaLeft) / 2
}
else {
half_width := (MonitorWorkAreaLeft - MonitorWorkAreaRight) / 2
}
if ( x >= MonitorWorkAreaLeft && x < MonitorWorkAreaRight )
{
;MsgBox, 'Target Monitor NO: ' %A_Index%
WinMove, %title%, , MonitorLeft + half_width, MonitorTop, half_width, MonitorWorkAreaBottom
Break
}
}
return
'테스트 & 자동화 > AutoHotkey' 카테고리의 다른 글
활성창의 크기를 조정하는 단축키 정의 입니다. (0) | 2021.05.29 |
---|---|
AutoHotkey 활성창을 특정 위치로 이동 (0) | 2020.07.25 |