#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
#UseHook
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CoordMode, Mouse, Window
oVoice:=ComObjCreate("SAPI.SpVoice")
Global XPos, YPos, Color
; Toggle Preferences
^,::
If (IsKKPreferences() = 1) ;this function returns 1 if this window is open
; Objective, to get AHK to close the preferences
{
GetReferencePosition() ; this function places the mouse in a consistent place on the target window, so that mouse movements are consistent in programs in which it is used
Sleep, 100
MouseMove, 130, 298, , R
Click
oVoice.Speak("PreferencesClosed:") ; this uses SAPI to give feedback to the visually impaired user
}
ElseIf (IsKK() = 1) ; if the main KK window is open and it's not the prefferences
{
Send, ^,; send the default keystroke in this app in order to open the preferences
oVoice.Speak("PreferencesOpen:") ; again spoken feedback
}
Else
{
MsgBox "not in any KK window" ; if it's not the KK or KK preferences window, do the default/ normal key action
}
I'm pretty sure it's to do with my implamentation of {}'s, so trying to get a grip of it
![Smile :)](./images/smilies/icon_e_smile.gif)