Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- SetTitleMatchMode, 2
- SettingsFile = Settings.ini
- Errorz = Error
- Menu, Tray, NoStandard
- Menu, Standards, Standard
- Menu, Script, Add, Change Window, ChangeWindow
- Menu, Script, Add, Change Hotkey, ChangeHotkey
- Menu, Tray, Add, Script, :Script
- Menu, Tray, Add, Standards, :Standards
- IniRead, XPos, %SettingsFile%, Mouse, XPos, -1
- IniRead, YPos, %SettingsFile%, Mouse, YPos, -1
- IniRead, Window, %SettingsFile%, Window, Name, -1
- IniRead, CurrentHotkey, %SettingsFile%, Hotkeys, SingleClick, -1
- If (XPos < 0) or (YPos < 0) or (Window = -1)
- Gosub, ChangeWindow
- If CurrentHotkey = -1
- {
- Gosub, ChangeHotkey
- NewHotkey:=True
- }
- If not NewHotkey
- Hotkey, %CurrentHotkey%, SingleClick, On
- NewHotkey:=False
- HotkeysActive:=True
- Return
- SingleClick:
- IniRead, XPos, %SettingsFile%, Mouse, XPos, -1
- IniRead, YPos, %SettingsFile%, Mouse, YPos, -1
- IniRead, Window, %SettingsFile%, Window, Name, -1
- If (XPos < 0) or (YPos < 0) or (Window = -1)
- SoundBeep
- Else
- ControlClick, X%XPos% Y%YPos%, %Window%,,, 1
- Return
- ChangeWindow:
- InputBox, WindowNew,, Please enter all or part of the window's name.
- Gosub, SplashWinMove
- SetTimer, SplashWin, 0
- SetTimer, SplashWin, On
- KeyWait, LButton, Down
- MouseGetPos, XPosNew, YPosNew
- IniWrite, %XPosNew%, %SettingsFile%, Mouse, XPos
- IniWrite, %YPosNew%, %SettingsFile%, Mouse, YPos
- IniWrite, %WindowNew%, %SettingsFile%, Window, Name
- SetTimer, SplashWin, Off
- SplashImage, Off
- MsgBox, Done!
- Return
- SplashWin:
- MouseGetPos, XPosSplash, YPosSplash
- If (XPosSplash < 325) and (YPosSplash < 115)
- {
- XSplash:=330
- YSplash:=120
- SplashMoved:=True
- }
- Else
- {
- XSplash:=0
- YSplash:=0
- SplashMoved:=False
- }
- If SplashMoved and not SplashAlreadyMoved
- {
- GoSub, SplashWinMove
- SplashAlreadyMoved:=True
- }
- If not SplashMoved and SplashAlreadyMoved
- {
- GoSub, SplashWinMove
- SplashAlreadyMoved:=False
- }
- Return
- SplashWinMove:
- SplashImage,, x%XSplash% y%YSplash%, Please click on the button you would like to select.
- Return
- ChangeHotkey:
- Gui, Add, Text, w300, Please select the box below and press any key/combonation of keys and then submit your input.
- Gui, Add, Hotkey, vChosenHotkey
- Gui, Add, Button, gSubmitHotkey, Submit
- Gui, Show
- Return
- SubmitHotkey:
- Gui, Submit, NoHide
- If not ChosenHotkey
- {
- MsgBox, 16,, Please enter a valid hotkey.
- Return
- }
- Gui, Destroy
- IniRead, CurrentHotkey, %SettingsFile%, Hotkeys, SingleClick, -1
- If Hotkey = -1
- Hotkey, %CurrentHotkey%, SingleClick, Off
- IniWrite, %ChosenHotkey%, %SettingsFile%, Hotkeys, SingleClick
- Hotkey, %ChosenHotkey%, SingleClick, On
- MsgBox, 64,, Success!
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement