I want to write a script for my dictionary application, so that when I hold the key j for a short time then it active the existed KMPlayer window and send space and maximize it( by sending middle button of the mouse) and if KMPlayer doesn't exist it sends Alt+Esc.
Here is my script :
#IfWinActive Oxford Advanced Learner's Dictionary
~$j::
KeyWait,j,T0.2
If (ErrorLevel)
{
If WinExist ("KMPlayer 64X")
{
WinActivate
sleep,50
SendInput,{space}
sleep,50
sendinput,{MButton}
}
else
{
SendInput,!{Esc}
}
}
return
But unfortunately when I hold the button in the search bar of my dictionary it just type something like
j jjjjjj j jjj j jjjjjj j jj
Rather than doing the functions. I don't know how to fix the script.