#Persistent
CoordMode, Mouse, Screen
SysGet, Mon, Monitor
SetTimer, CheckMouse, 10
Return
CheckMouse:
If (!GetKeyState("LButton"))
Return
MouseGetPos, X, Y
If (X <= MonLeft)
MouseMove, % MonRight - 5, %Y%, 0
Else If (X >= MonRight - 1)
MouseMove, % MonLeft + 5, %Y%, 0
Else If (Y <= MonTop)
MouseMove, %X%, % MonBottom + 5, 0
Else If (Y >= MonBottom - 1)
MouseMove, %X%, % MonTop - 5, 0
Return
Thursday, November 20, 2008
AHK - Mouse Wrap-around
Just a little code that will cause the mouse to wrap around to the other side of the screen when it gets all the way to one side.
Labels:
AHK scripts
AHK - 1337 5p43k typer
This script is just a fun one that will allow you to type in leet speak without having to think about it. You can add additional possibilities, but keep in mind that it only accepts up to 2 parameters in the Rand() function.
#UseHook
SetScrollLockState, Off
ScrollLock::Suspend, Toggle
a::Rand("4")
b::Rand("|3")
c::Rand("<","(")
d::Rand("C|")
e::Rand("3")
f::Rand("")
g::Rand("6")
h::Rand("|-|")
i::Rand("1","!")
j::Rand("")
k::Rand("|<")
l::Rand("|","1")
m::Rand("|\/|")
n::Rand("|\|")
o::Rand("0")
p::Rand("")
q::Rand("")
r::Rand("|2")
s::Rand("5","z")
t::Rand("7","+")
u::Rand("V")
v::Rand("\/")
w::Rand("|/\|")
x::Rand("")
y::Rand("j")
z::Rand("")
Rand(C1="",C2="") {
Chars := 2 + (C1 ? 1 : 0) + (C2 ? 1 : 0)
Random, R, 1, %Chars%
Send % "{RAW}" . (R == 1 ? L(SubStr(A_ThisHotkey,0,1)) : (R == 2 ? U(SubStr(A_ThisHotkey,0,1)) : (R == 3 ? C1 : C2)))
}
L(Str) {
StringLower, Str, Str
Return Str
}
U(Str) {
StringUpper, Str, Str
Return Str
}
Labels:
AHK scripts,
Examples
AHK - Gain SYSTEM status with explorer.exe
This simple script is supposed to give you system level privileges with explorer.exe on your computer. What it does is create and run a batch file, basically just restarting explorer.exe while elevating your privileges as well.
*Note - This program closes explorer.exe. Close any programs before running it.
Process, Close, explorer.exe
str = at %A_Hour%:%A_Min% /interactive explorer.exe
If (FileExist("SYSTEM.bat"))
FileDelete, SYSTEM.bat
FileAppend, % str, SYSTEM.bat
Loop {
If (FileExist("SYSTEM.bat"))
Break
}
RunWait, SYSTEM.bat
FileDelete, SYSTEM.bat
*Note - This program closes explorer.exe. Close any programs before running it.
Labels:
AHK scripts,
Utils
AHK - Auto Cursor Hider
This script automatically hides the mouse cursor after a 1 second delay, then makes it visible again when you start moving it.
* Note - This script uses Laszlo's SystemCursor() function, found here
Lazlo's SystemCursor() function
#Persistent
#NoTrayIcon
OnExit, ShowCursor
SetTimer, CheckMouse, 10
Cursor := 1
return
CheckMouse:
MouseGetPos, MX, MY
If (MX != _MX || MY != _MY) {
SystemCursor(1)
LastMove := A_TickCount
Cursor := 1
_MX := MX
_MY := MY
}
If (Cursor && (A_TickCount - LastMove) > 1000) {
SystemCursor(0)
Cursor := 0
}
Return
ShowCursor:
SystemCursor("On")
ExitApp
SystemCursor(T=1)
{
static AndMask, XorMask, $, h_cursor
,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13
, b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
, h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13
if (T = "Init" or T = "I" or $ = "")
{
$ = h
VarSetCapacity( h_cursor,4444, 1 )
VarSetCapacity( AndMask, 32*4, 0xFF )
VarSetCapacity( XorMask, 32*4, 0 )
system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650
StringSplit c, system_cursors, `,
Loop %c0%
{
h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
, "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
}
}
$ := T=0 ? "b" : "h"
Loop %c0%
{
h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
}
}
* Note - This script uses Laszlo's SystemCursor() function, found here
Lazlo's SystemCursor() function
Labels:
AHK scripts,
Utils
Subscribe to:
Posts (Atom)