AutoHotkey

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m (Source)
m (Source)
 
Line 54: Line 54:
 
===Source===
 
===Source===
 
<source lang="text">
 
<source lang="text">
#NoTrayIcon
+
;#NoTrayIcon
 
#SingleInstance force
 
#SingleInstance force
 
if (A_AhkVersion < "1.0.39.00") {
 
if (A_AhkVersion < "1.0.39.00") {

Latest revision as of 20:21, 9 June 2017

This tool is fabulous. Get it from here: http://www.autohotkey.com/

Contents

[edit] Attie's AHK Script

The following script is a combination of a couple of scripts I've seen: "kdestyle" and "Make Backspace in Windows 7 or Vista Explorer Go Up like XP Did".

[edit] kdestyle

Source

  • To move a window, press and hold the windows button, and then Left Click and drag.
  • To resize a window, press and hold the windows button, and then Right Clock and drag - resizes from the closest corner.
  • I changed it slightly, because they used the wrong hotkeys and added silly functions :)

[edit] Make Backspace in Windows 7 or Vista Explorer Go Up like XP Did

Source

  • Fixes a stupid mistake that Microsoft made

[edit] Make Ctrl+L select the address bar in explorer like every other browser

Source

  • Fixes a stupid decision that Microsoft made (try Alt+D)

[edit] Make Ctrl+W close Win8+ App Windows

Note: try if A_OSVersionNum > 6.2 [1]
#IfWinActive, ahk_class ApplicationFrameWindow
^W::
	Send !{f4}
	return
#IfWinActive

[edit] Auto Focus Winamp Search Box

I use AltGr+L to show/hide the media library... This has an issue with timings, so if your system is slow, try tweaking the sleep

~<^>!L UP::
	KeyWait LControl
	KeyWait RAlt
	KeyWait L
	sleep 50
	if WinActive("ahk_exe winamp.exe") and WinActive("Media Library") {
		ControlFocus Edit1,A
	}
	return

[edit] Make Ctrl+L focus the Winamp search box

#If WinActive("ahk_exe winamp.exe") and WinActive("Media Library")
^L::
	ControlFocus Edit1,A
	return
#If

[edit] Source

;#NoTrayIcon
#SingleInstance force
	if (A_AhkVersion < "1.0.39.00") {
		MsgBox,20,,This script may not work properly with your version of AutoHotkey. Continue?
		IfMsgBox,No
		ExitApp
	}
	SetWinDelay,2
	CoordMode,Mouse
	return
 
#LButton::
	MouseGetPos,KDE_X1,KDE_Y1,KDE_id
	WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
	if KDE_Win
		return
	WinGetPos,KDE_WinX1,KDE_WinY1,,,ahk_id %KDE_id%
	loop {
		GetKeyState,KDE_Button,LButton,P
		if KDE_Button = U
			break
		MouseGetPos,KDE_X2,KDE_Y2
		KDE_X2 -= KDE_X1
		KDE_Y2 -= KDE_Y1
		KDE_WinX2 := (KDE_WinX1 + KDE_X2)
		KDE_WinY2 := (KDE_WinY1 + KDE_Y2)
		WinMove,ahk_id %KDE_id%,,%KDE_WinX2%,%KDE_WinY2%
	}
	return
 
#RButton::
	MouseGetPos,KDE_X1,KDE_Y1,KDE_id
	WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
	if KDE_Win
		return
	WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
	if (KDE_X1 < KDE_WinX1 + KDE_WinW / 2) {
		KDE_WinLeft := 1
	} else {
		KDE_WinLeft := -1
	}
	if (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2) {
		KDE_WinUp := 1
	} else {
		KDE_WinUp := -1
	}
	loop {
		GetKeyState,KDE_Button,RButton,P
		if KDE_Button = U
			break
		MouseGetPos,KDE_X2,KDE_Y2
		WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
		KDE_X2 -= KDE_X1
		KDE_Y2 -= KDE_Y1
		WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2
		                        , KDE_WinY1 +   (KDE_WinUp+1)/2*KDE_Y2
		                        , KDE_WinW  -     KDE_WinLeft  *KDE_X2
		                        , KDE_WinH  -       KDE_WinUp  *KDE_Y2
		KDE_X1 := (KDE_X2 + KDE_X1)
		KDE_Y1 := (KDE_Y2 + KDE_Y1)
	}
	return
 
#IfWinActive, ahk_class CabinetWClass
Backspace::
	ControlGet renamestatus,Visible,,Edit1,A
	ControlGetFocus focussed, A
	if (renamestatus != 1 && (focussed = "DirectUIHWND3" || focussed = SysTreeView321)) {
		SendInput {Alt Down}{Up}{Alt Up}
	} else {
		Send {Backspace}
	}
	return
 
^L::
	Send !D
	return
#IfWinActive
 
#IfWinActive, ahk_class ApplicationFrameWindow
^W::
	Send !{f4}
	return
#IfWinActive
 
#If WinActive("ahk_exe winamp.exe") and WinActive("Media Library")
^L::
	ControlFocus Edit1,A
	return
#If
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox