AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Quick resize windows with the keyboard only

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
DranDane



Joined: 26 Jun 2007
Posts: 54

PostPosted: Mon Mar 17, 2008 5:11 pm    Post subject: Quick resize windows with the keyboard only Reply with quote

Hello,

This script allow you to resize your widow quickly on the left, up, right or bottom of the screen by using the command "winkey" + left, right, up or down key. Usefull for people that use the keyboard to control windows.

Code:

; Author:         Dran Dane <drandane-forums@yahoo.fr>
;
; Script Function: This script allow you to resize your widow quickly on the left, up, right or bottom of the screen by using the command "winkey" + left, right, up or down key. Usefull for people that use the keyboard to control windows.

;

#SingleInstance force
#Persistent
;#NoTrayIcon
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Hotstring B0 *
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;#Include %A_ScriptDir%\Includes\KeyList.ahk
;#Include %A_ScriptDir%\Includes\TTS.ahk

#Down::
  Sysget, MonitorWorkArea, MonitorWorkArea
  IfWinActive, A
  {
    if IsDown()
    {
      WinMinimize, A
    }
    else
    {
      if IsUp()
      {
        WinMove ,,,0, 0, MonitorWorkAreaRight, MonitorWorkAreaBottom
      }
      else
      {
        WinMove ,,,0, (MonitorWorkAreaBottom/2), MonitorWorkAreaRight, (MonitorWorkAreaBottom/2)
      }
    }
  }
return

#Up::
  Sysget, MonitorWorkArea, MonitorWorkArea
  IfWinActive, A
   {
    if IsUp()
    {
      WinMaximize, A
    }
    else
    {
      if IsDown()
      {
        WinMove ,,,0, 0, MonitorWorkAreaRight, MonitorWorkAreaBottom
      }
      else
      {
        WinMove ,,,0, 0, MonitorWorkAreaRight, (MonitorWorkAreaBottom/2)
      }
    }
  } 
return

#Left::
  Sysget, MonitorWorkArea, MonitorWorkArea 
  IfWinActive, A
   {
    if IsRight()
    {
      WinMove ,,,0, 0, MonitorWorkAreaRight, MonitorWorkAreaBottom
    }
    else
    {
      WinMove ,,,0, 0, (MonitorWorkAreaRight/2), MonitorWorkAreaBottom
    }
  } 
return

#Right::
  Sysget, MonitorWorkArea, MonitorWorkArea
  IfWinActive, A
   {
    if IsLeft()
    {
      WinMove ,,,0, 0, MonitorWorkAreaRight, MonitorWorkAreaBottom
    }
    else
    {
      WinMove ,,,(MonitorWorkAreaRight/2), 0, (MonitorWorkAreaRight/2), MonitorWorkAreaBottom
    }
  } 
return

IsDown()
{
  WinGetPos, X, Y, Width, Height, A
  Sysget, MonitorWorkArea, MonitorWorkArea
  if (X = 0 && Y = MonitorWorkAreaBottom/2 && Width = MonitorWorkAreaRight && Height = MonitorWorkAreaBottom/2)
    return true
  return false
}

IsUp()
{
  WinGetPos, X, Y, Width, Height, A
  Sysget, MonitorWorkArea, MonitorWorkArea
  if (X = 0 && Y = 0 && Width = MonitorWorkAreaRight && Height = MonitorWorkAreaBottom/2)
  {
    return true
  }
  return false
}

IsLeft()
{
  WinGetPos, X, Y, Width, Height, A
  Sysget, MonitorWorkArea, MonitorWorkArea
  if (X = 0 && Y = 0 && Width = MonitorWorkAreaRight/2 && Height = MonitorWorkAreaBottom)
  {
    return true
  }
  return false
}

IsRight()
{
  WinGetPos, X, Y, Width, Height, A
  Sysget, MonitorWorkArea, MonitorWorkArea
  if (X = MonitorWorkAreaRight/2 && Y = 0 && Width = MonitorWorkAreaRight/2 && Height = MonitorWorkAreaBottom)
  {
    return true
  }
  return false
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group