Skip to content

Instantly share code, notes, and snippets.

@hdf
Created February 1, 2016 19:48
Show Gist options
  • Save hdf/77f6c95b187897501ae4 to your computer and use it in GitHub Desktop.
Save hdf/77f6c95b187897501ae4 to your computer and use it in GitHub Desktop.
AutoHotKey scripts
WindowName = Számológép ; type the game window name here
WinGet, GameID, ID, %WindowName% ; Get ID of window, set to variable called GameID
Loop ; Start loop
{
while WinActive("ahk_id " GameID) and getkeystate("capslock", "T")
{
SendInput, {click} ; send mouse left click
Sleep 100
}
Sleep, 500 ; if GameID window is NOT active, wait .5 sec to recheck
}
F9::Pause ; Hotkey F9 to Pause script
F10::ExitApp ; Hotkey F10 to Exit Script entirly
SetTitleMatchMode, 2
WindowTitle := "Guild Wars 2"
Return
+1::Goto snd_zero
+2::ExitApp
snd_zero:
WinMove, %WindowTitle%, , 60, 20
return
Gui, Color, FFFFFF
Gui, Font, S14 CDefault Bold, Verdana
Gui, Add, Text, x0 y0 w70 h20, Active
Gui, +AlwaysOnTop -SysMenu -Caption +ToolWindow +LastFound
WinSet, TransColor, FFFFFF
WinSet, ExStyle, ^0x00000020
SetTitleMatchMode, 2
WindowTitle := "World of Warcraft"
Return
+1::Goto on
+2::Goto off
~w::Goto reset
+3::ExitApp
on:
SetTimer, MoveAbout, 60000
SetTimer, SnapTo, 10
return
off:
Gui, Hide
SetTimer, MoveAbout, Off
SetTimer, SnapTo, Off
return
reset:
SetTimer, MoveAbout, Off
SetTimer, MoveAbout, 60000
return
MoveAbout:
Gui, Show, Center
ControlSend, , {w down}{Space}, %WindowTitle%
Sleep, 100
ControlSend, , {w up}, %WindowTitle%
Sleep, 800
ControlSend, , {s down}{Space}, %WindowTitle%
Sleep, 100
ControlSend, , {s up}, %WindowTitle%
return
SnapTo:
WinGetPos, Xpos, Ypos, Width, Height, %WindowTitle%
Xpos := Xpos + (Width / 2) - (70 / 2)
Ypos := Ypos + (Height / 2) - (20 / 2)
Gui, Show, NoActivate x%Xpos% y%Ypos%
return
SetTitleMatchMode, 2
WindowTitle := "Skyrim"
Return
+1::Goto snd_zero
+2::ExitApp
snd_zero:
ControlSend, , 0, %WindowTitle%
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment