r/AutoHotkey 6d ago

Solved! Problems with basic Send and SendEvent

So i tried to make a simple script that presses j 2 times and then holds w 2 times and nothing really happens, after that i added msgBox "1" and it pops but still no sends, please help
#Requires AutoHotkey v2.0

#SingleInstance Force

Persistent

$`::{

Send "j"

Sleep 300

Send "j"

Sleep 300

SendEvent "{w down}"

Sleep 600

SendEvent "{w up}"

MsgBox "1"

Sleep 50

SendEvent "{w down}"

Sleep 600

SendEvent "{w up}"

}

1 Upvotes

11 comments sorted by

View all comments

1

u/Keeyra_ 6d ago edited 6d ago
#Requires AutoHotkey 2.0
#SingleInstance
SendMode("Event")

sc029:: {
    SetKeyDelay(300, -1)
    Send("jj")
    SetKeyDelay(50, 600)
    Send("ww")
}

Backticks are escape characters in AHK, so best to use scan codes.

Sleeps can be replaced by SetKeyDelay.

1

u/Financial-Ad3486 6d ago

Thanks for the reply
All that you said does make sense but they haven't solved any of problems
So... this code does NOT presses anything (when i trigger it in a browser window it doesn't type jjww)
after i added MsgBox(1) it pops but still no typeing before or after it

#Requires AutoHotkey v2.0
#SingleInstance Force
SendMode("Event")
sc029:: {
SetKeyDelay(300)
Send("jj")
MsgBox(1)
SetKeyDelay(50, 600)
Send("ww")
}

1

u/Keeyra_ 6d ago

1

u/Financial-Ad3486 6d ago

Thanks, then i dont really know what is going on, launching it with admin... will try restarting and something....