bearware Guest
|
Posted: Fri Jul 15, 2005 11:12 am Post subject: controlling windows without a mouse |
|
|
Below is a script to allow some control of windows using the keybourd.
I have developed repetitive strain ingery from using the mouse, so I wrote this script. It does not simulate a mouse it alows you to directly do some of the things you would normaly use a mouse for. Please feel free to add to it and post improvments. But remember the idea is not to simulate the mouse, thing of tasks/goals you are trying to do. and how they can better be done with the keyboard.
I have another script (multi desktop) that also has some simala window control stuf. it is only in a seperate script because it shares code with the desktop switching.
| Code: | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The following code copyright Richard Delorenzi 2005
; You may ether:
;
; 1) Do with it only that permited by local copyright laws.
; OR
; 2) DO What is permited by GPL licence version 2 see
; http://www.gnu.org/licenses/gpl.html
; OR
; 3) you can use, copy, modify, sell, study, etc.
; but if you pass it on you must pass on the same rights as you have
; and not block them technicaly
; i.e. if you turn it in to a .exe you must provide the script as well
;
; If excersising cluse 2 you may remove the text of clause 1 and 3 if it helps.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; run commands. allows commands to be entered Win/x Command
#x::
input,TextIn,CI,{ENTER}{ESC}{SPACE}
ifequal,TextIn,title
{
gosub,SetTitle
}
ifequal,TextIn,terminal
{
gosub,RunTerminal
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Helpers for run commands
RunTerminal: ; :todo: fix broken
olddir=%S_WorkingDir%
run,c:\Program Files\AutoHotkey\xterm.bat.lnk
setWorkingDir,%olddir%
return
SetTitle:
ToolTip,type in a title,0,0
input,TextIn,CI,{ENTER}{ESC}
ifequal,ErrorLevel,EndKey:Enter
{
winsettitle,A,,%TextIn%
}
ToolTip
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Move active window
; Win and arrows to move
; Win/ctrl arrows to move faster
; Win/Shift arrows to move to edge
;slow move window
#Right::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X+10,Y
return
#Left::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X-10,Y
return
#Up::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,Y-10
return
#Down::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,Y+10
return
;fast move window
#^Right::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X+100,Y
return
#^Left::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X-100,Y
return
#^Up::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,Y-100
return
#^Down::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,Y+100
return
;move window to edge
#+Right::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,A_ScreenWidth-W,Y
return
#+Left::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,0,Y
return
#+Up::
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,0
return
#+Down::
WinGetPos,TX,TY,TW,TH,ahk_class Shell_TrayWnd,,,
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,A_ScreenHeight-H-TH
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Resize active window
; win/t make active window tall
; win/m minimize active window
#t:: ;max hight current window
WinGetPos,TX,TY,TW,TH,ahk_class Shell_TrayWnd,,,
WinGetPos,X,Y,W,H,A,,,
WinMove,A,,X,0,W,A_ScreenHeight-TH
; if window does not honer resize exactly so is slightly smaller than
; asked for its bottom edge will be where expected but to edge will be lower
; nextline puts top enge where I want it.
WinMove,A,,X,0 ; :langbug: above line gets y position slightly wrong
return
#M:: ; minimize(iconify) current window
WinMinimize,A,,,
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; explorer
;;key conflict
;+Right:: ;;fast next link
; IfWinActive, ahk_class IEFrame
; {
; Loop,10
; {
; Send,{Tab}
; }
; }
; else
; {
; Send,+{Right}
; }
;return
;+Left:: ;;fast prev link
; IfWinActive, ahk_class IEFrame
; {
; Loop,10
; {
; Send,+{Tab}
; }
; }
; else
; {
; Send,+{Left}
; }
;return
#e:: ;;start explorer
Run,c:/Program Files/Internet Explorer/iexplore.exe file:////c:/controlled/arm/src
return |
|
|