Run('notepad.exe')
$Hwnd = WinWait("[CLASS:Notepad]", "", 5)
If Not $Hwnd Then
MsgBox(4096, 'Сообщение', 'Окно не найдено, завершаем работу скрипта')
Exit
EndIf
_MySend($Hwnd, "Эта строка{Enter}{F5}{Enter}выслана в элемент {{}Edit{}}^a")
Func _MySend($Hwnd, $Text)
$aSymbol = StringSplit($Text, '')
For $i = 1 To $aSymbol[0]
$NextSymbol = ''
If $aSymbol[$i] = '{' Then
Do
$NextSymbol &= $aSymbol[$i]
$i += 1
Until $aSymbol[$i] = '}'
If $i + 1 <= $aSymbol[0] And $aSymbol[$i + 1] = '}' Then
$NextSymbol &= '}}'
$i+=1
Else
$NextSymbol &= '}'
EndIf
ElseIf $aSymbol[$i] = '!' Or $aSymbol[$i] = '+' Or $aSymbol[$i] = '^' Or $aSymbol[$i] = '#' Then
$NextSymbol = $aSymbol[$i] & $aSymbol[$i + 1]
$i += 1
Else
$NextSymbol = $aSymbol[$i]
EndIf
Opt("SendKeyDelay", 100 + Random(0, 55, 1))
Opt("SendKeyDownDelay", 50 + Random(0, 55, 1))
ControlSend($Hwnd, '', '', $NextSymbol)
Next
EndFunc