Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v1) • Error in AHK script

$
0
0
This script keeps giving an error at line 15.
the following variable name contains an illegal character ""A""

Any idea why? Its abusing me :}

CODE:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.

; Define the hotkey (replace CapsLock with your desired key)
SetCapsLockState, Off ; Avoid conflicts if CapsLock is already a hotkey
CapsLock:: ; This line defines CapsLock as the hotkey

WinTitle := "EverQuest" ; Target window title (change if different)

^+!:: ; Detect any key combination (Ctrl+Alt+Shift+)
{
Loop, FindWindows,, %WinTitle% ; Loop through all EverQuest windows
{
WinExist("A") ; Check if the window exists (prevents errors)
IfWinExist("A")
{
WinGetHandle, ahk_id, A ; Get the handle of the found window
SendKeysToWindow(ahk_id, A_ThisKey) ; Send the currently pressed key to the window
}
}
}

SendKeysToWindow(hwnd, KeyToPress) ; Function to send keystrokes to a window
{
WinActivate, ahk_id ; Activate the window (minimized windows will be restored)
Send, {%KeyToPress%} ; Send the specified key
WinDeactivate, ahk_id ; Deactivate the window (optional)
}

Statistics: Posted by zMarc — Today, 13:18



Viewing all articles
Browse latest Browse all 579

Trending Articles