Main Area and Open Discussion > General Software Discussion
MoveIt 1.5.1.0
MilesAhead:
I noticed I left a thing for 's' square when I moved it from the other app.. holding down Shift made the window a bit bigger. I like top and bottom size as is. But maybe I'll add the shift so if someone wants 1/2 screen without using the up/down grid they can just hold down shift. It will be like an Easter Egg or something. :)
I'll play around with stuff and see what the next rev. should be. Thanks for your thoughts. :)
MilesAhead:
I did not want to sound rude or demanding, I was merely stating my observations. What you did here is great.
-Attronarch (May 27, 2012, 03:49 AM)
--- End quote ---
Not at all. I didn't mean to seem peeved. I just meant doing it this hotkey way is kind of a kludge. But you can get maybe 90% of what the sophisticated apps do with a few days of work. It's trying to monitor stuff and have everything automated that turns it from 6 days work to 6 months. :)
On the grid change hotkey, I suppos I could have an option for the user-defined hotkey. Either user defined keyboard hotkey is for sizing, or for grid switching with A - F. That wouldn't be difficult. I prefer mouse based hotkey for resize anyway. Those who wnat the keyboard hotkey, it would stay as is by default. I could add another menu choice with check mark for "Keyboard Hotkey Switches Grid" or something like that.
MilesAhead:
I thought I had this stable but it turns out of you complicate the desktop setup, such as having a work area with numbers quite different from the screen res on several sides, the calculations get really hairy. I'm dumping 'g' as it just confuses the issue.
I'll never stop messing with this unless I just switch to Grid A is it, and set your settings to move the dividers around. All these rotations are insane!
MilesAhead:
SectionAte gets the Section 8!! After experimenting with various work areas I find that for me it's more hassle than it's worth. I'm using a cut down version with no grids just to size stuff to convenient shapes.
Anyway, if anyone who already has the source wants to mod it, feel free. I'm taking it down from my site so I don't get support emails. Too much of a headache. Sorry. :)
MilesAhead:
I cheated! :) I surgically removed the grids from SectionAte. Then I changed t and b keys to set up my browser on bottom and something like Notepad on top so they fit nicely together.
It still has the Alt Arrow keys. That's all I need with TicClick. Not really a grid type of guy. I tried GridMove just to check it out. Obviously a lot of work went into it. I'm just not enamored of grids. More curious than anything. :)
Anyway here's a screen shot of my "MoveIt" hack at work.
Here's the source
--- ---/*
* * * Compile_AHK SETTINGS BEGIN * * *
[AHK2EXE]
Exe_File=%In_Dir%\MoveIt.exe
No_UPX=1
[VERSION]
Set_Version_Info=1
File_Version=1.0.0.0
Inc_File_Version=0
Legal_Copyright=2012 www.favessoft.com
Product_Version=1.0.0.0
[ICONS]
Icon_1=%In_Dir%\mycomputer.ico
* * * Compile_AHK SETTINGS END * * *
*/
; To compile yourself use AutoHotKey_L as AHK basic does not have
; Object() support. I used AHK_L 1.1.07.03 32 bit Unicode English
; You may get AHK_L here: http://l.autohotkey.net/
;
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
progname := _FileBaseName(A_ScriptFullPath)
Menu Tray,NoStandard
Menu Tray,Add,Donate,DoDonate
Menu Tray,Add,Visit Hotkey Page,DoVisit
Menu Tray,Add,Set Keyboard Hotkey,DoKeyboard
Menu Tray,Add,Set Keyboard Hotkey as Text,DoKeyboardAsText
Menu Tray,Add
Menu Tray,Add,About,DoAbout
Menu Tray,Add,Delete Dead Window Info,PurgeUndo
Menu Tray,Add
Menu Tray,Add,Quit,DoQuit
Menu Tray,Default,About
Menu Tray,Click,1
Menu Tray,Tip,%progname%
if (A_IsCompiled)
Menu Tray,Icon,%A_ScriptFullPath%,1
; window style for sizeable border
WS_SIZEBOX := 0x40000
; for Undo
wArray := Object()
; for _MarginWorkArea()
marg := 4
param := ""
len := 0
if 0 > 0
{
param = %1%
len := StrLen(param)
if (len > StrLen("margin="))
StringMid,marg,param,StrLen("margin=") + 1
}
l := -1
t := -1
r := -1
b := -1
w := 0
h := 0
key := "0"
AWindow := 0
AboutOpen := false
KHotkey := "^+s"
KbdSet := false
IniFile = %A_ScriptDir%\%A_ScriptName%
IniFile := RegExReplace(IniFile,"i)ahk$","ini")
IniFile := RegExReplace(IniFile,"i)exe$","ini")
IniRead,KHotkey,%IniFile%,Settings,KeyboardHotkey,%KHotkey%
if (KHotkey)
Hotkey,%KHotkey%,DoHotKey,UseErrorLevel
If ErrorLevel
{
MsgBox, 4112, %progname%, %KHotkey% is not a valid Hotkey
ExitApp
}
KbdSet := (KHotkey != "")
_EmptyWorkingSet()
; Winkey click window then press a key
; or use hotkey from ini file
DoHotKey:
~#LButton::
Input,key,L1
if (key != "u")
goto,bypass
else
gosub,DoUndo
return
; Hold down middle mouse button and hit a key
; Undo
~MButton & u::
gosub, DoUndo
return
~MButton & t::
~MButton & b::
~MButton & c::
~MButton & l::
~MButton & r::
~MButton & s::
StringRight,key,A_ThisHotKey,1
bypass:
AWindow := WinExist("A")
WinGet,attr,Style,A
if (! (attr & WS_SIZEBOX) )
or (AWindow = WinExist("Program Manager"))
or (AWindow = WinExist("Start menu"))
return
gosub,DoMove
SetTimer,DumpMemory,-1000
return
DoMove:
gosub,SaveUndoInfo
chunk := (r - l) // 20
TH := (b - t) * .33
BH := (b - t) * .67
if (key = "t")
{
WinMove,ahk_id %AWindow%,,l + chunk,t,(r - l) - chunk,TH
;WinMove,ahk_id %AWindow%,,l + Round((r - l) * .05),t,Round((r - l) * .8),(b - t) // 2 - 3
}
else if (key = "b")
{
chunk := (r - l) // 20
WinMove,ahk_id %AWindow%,,l + chunk,TH + 10,(r - l) - chunk,BH - 10
;WinMove,ahk_id %AWindow%,,l + Round((r - l) * .05),(b - t) // 2 + 3,Round((r - l) * .8),(b - t) // 2 - 3
}
else if (key = "c")
gosub, SectionCenter
else if (key = "s")
gosub, SectionSquare
else if (key = "l")
WinMove,ahk_id %AWindow%,,l,t,(r - l) // 2,b - t
else if (key = "r")
WinMove,ahk_id %AWindow%,,r - ((r - l) // 2) ,t,(r - l) // 2,b - t
return
SectionCenter:
gosub,SaveUndoInfo
w := (r - l) // 6 * 5
h := (b - t) // 5 * 4
l := l + (r - w) // 2
t := t + (b - h) // 2
WinMove,ahk_id %AWindow%,,l,t,w,h
return
SectionSquare:
gosub,SaveUndoInfo
w := (r - l) // 2
if GetKeyState("Shift")
w := w + (w // 5)
h := w
t := ((b - t) - h) // 2
WinMove,ahk_id %AWindow%,,l,t,w,h
return
DoUndo:
AWindow := WinExist("A")
wPos := wArray[AWindow]
if (wPos)
{
WinActivate,ahk_id %AWindow%
WinMove,A,,wPos[1],wPos[2],wPos[3],wPos[4]
}
return
SaveUndoInfo:
WinGetPos,x,y,w,h, ahk_id %AWindow%
_MarginWorkArea(l, t, r, b, marg)
wPos := [x,y,w,h]
wArray[AWindow] := wPos
return
!Left::
AWindow := WinExist("A")
If (AWindow = WinExist("Program Manager"))
or (AWindow = WinExist("Start menu"))
return
gosub,SaveUndoInfo
xinc := (r - l) // 10
WinGetPos,X,Y,Width,Height,ahk_id %AWindow%
if ((X - xinc) > l)
WinMove,ahk_id %AWindow%,,X - xinc,Y
else
WinMove,ahk_id %AWindow%,,l,Y
SetTimer,DumpMemory,-1000
return
!Right::
AWindow := WinExist("A")
If (AWindow = WinExist("Program Manager"))
or (AWindow = WinExist("Start menu"))
return
gosub,SaveUndoInfo
xinc := (r - l) // 10
WinGetPos,X,Y,Width,Height,ahk_id %AWindow%
if ((X + xinc + Width) <= r)
WinMove,ahk_id %AWindow%,,X + xinc,Y
else
WinMove,ahk_id %AWindow%,,r - Width,Y
SetTimer,DumpMemory,-1000
return
!Up::
AWindow := WinExist("A")
If (AWindow = WinExist("Program Manager"))
or (AWindow = WinExist("Start menu"))
return
gosub,SaveUndoInfo
yinc := (b - t) // 10
WinGetPos,X,Y,Width,Height,ahk_id %AWindow%
if ((Y - yinc) > t)
WinMove,ahk_id %AWindow%,,X,Y - yinc
else
WinMove,ahk_id %AWindow%,,X,t
SetTimer,DumpMemory,-1000
return
!Down::
AWindow := WinExist("A")
If (AWindow = WinExist("Program Manager"))
or (AWindow = WinExist("Start menu"))
return
gosub,SaveUndoInfo
yinc := (b - t) // 10
WinGetPos,X,Y,Width,Height,ahk_id %AWindow%
if ((Y + yinc + Height) <= b)
WinMove,ahk_id %AWindow%,,X,Y + yinc
else
WinMove,ahk_id %AWindow%,,X,b - Height
SetTimer,DumpMemory,-1000
return
PurgeUndo:
For key, value in wArray
IfWinNotExist,ahk_id %key%
wArray.Remove(key)
SetTimer,DumpMemory,-5000
return
DoAbout:
if (AboutOpen)
return
AboutOpen := true
HotkeyText := KHotkey ? KHotkey : "( none set )"
filever := _ScriptVersion(A_ScriptFullPath)
MyMsg =
(
%progname% %filever% Copyright (c) %A_Year% www.FavesSoft.com`n
To Size and Move the Active Window use one of ...`n
Mouse Hotkey 1 - Hold Middle Mouse Button on Sizeable
Window Frame and press a key`n`nMouse Hotkey 2 - Winkey Click then press a key`n
User Keyboard Hotkey %HotkeyText% then press a key`n
t = top b = bottom c = center l = left r = right
s = square u = undo`n
Information for one Undo is saved for each Window moved`n
Press Alt Arrow to Move the Active Window in one dimension`n
Pass margin=n to adjust Desktop Margin
Valid range for n is 0 to 12 Default is 4
)
MsgBox, 4160, About %progname%, %MyMsg%
SetTimer,DumpMemory,-1000
AboutOpen := false
return
DoKeyboard:
if (KdbSet)
Hotkey,%KHotkey%,Off
Gui, Add, Hotkey, x6 y7 w140 h20 vHotkey,%KHotkey%
Gui, Add, Button, x156 y7 w110 h20 gGO , Set Hotkey
Gui, Show, w273 h39, Set Hotkey
Return
GO:
if (KbdSet)
SaveKHotkey := KHotkey
Gui, Submit
if (! Hotkey)
{
if (KdbSet)
{
KHotkey := SaveHotkey
Hotkey,%KHotkey%,On
}
return
}
KHotkey := Hotkey
Gui,Destroy
Hotkey,%KHotkey%,DoHotKey,UseErrorLevel
If ErrorLevel
{
KHotkey := SaveHotkey
Hotkey,%KHotkey%,DoHotKey,UseErrorLevel
if ErrorLevel
{
MsgBox, 4112, , %KHotkey% is not a valid - Reset to %SavedHotkey%
KHotkey := SavedHotkey
Hotkey,%KHotkey%,On
Gosub,DoIniWrite
}
}
Else
{
Hotkey,%KHotkey%,On
Gosub,DoIniWrite
}
Return
GuiEscape:
GuiClose:
Gui,Destroy
SetTimer,DumpMemory,-2000
return
DoKeyboardAsText:
SaveHotkey := KHotkey
if (KbdSet)
Hotkey,%KHotkey%,Off
InputBox,KHotkey,%progname%
,`nEnter Keyboard Hotkey`n( ! = Alt ^ = Control + = Shift # = Winkey )`n`nExample: ^+s for Control Shift s
,,,,,,,,%KHotkey%
if ErrorLevel
{
if (KbdSet)
{
KHotkey := SaveHotkey
Hotkey,%KHotkey%,On
}
}
else if (! KHotkey)
{
if (KdbSet)
Hotkey,%SaveHotkey%,Off
}
else
{
if (KdbSet)
Hotkey,%SaveHotkey%,Off
Hotkey,%KHotkey%,DoHotKey, UseErrorLevel
if ErrorLevel
{
if (KHotkey)
MsgBox, 4112, , Hotkey change Failed
KHotkey := ""
KdbSet := false
return
}
if (KbdSet)
Hotkey,%KHotkey%,On
}
Gosub,DoIniWrite
return
DumpMemory:
_EmptyWorkingSet()
return
DoDonate:
Run,"http://www.favessoft.com/donate.html"
return
DoVisit:
Run,"http://www.favessoft.com/hotkeys.html"
return
DoIniWrite:
IniWrite,%KHotkey%,%IniFile%,Settings,KeyboardHotkey
return
DoQuit:
Gosub,DoIniWrite
ExitApp
;----------- general purpose include functions -----------
; include at bottom so DebugBox() Line count works
;
#Include MilesAhead.ahk
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version