Код:

#region: - Option
Opt('GUIOnEventMode', 1)
Opt('MustDeclareVars', 1)
Opt('TrayIconDebug', 1)
Opt('TrayIconHide', 0)
#endregion
#region: - Include
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#endregion
#region: - Win Msg Global
Global $hMsgWin
;~ Title, Width, Height, X, Y, Style, ExStyle
Global $sMsgWinTitle = '1234'
Global $iMsgWinWidth = 200
Global $iMsgWinHeight = 93
Global $iMsgWinX = -1
Global $iMsgWinY = -1
Global $iMsgWinStyle = $WS_CAPTION+$WS_SYSMENU
Global $iMsgWinExStyle = -1
;~ Settings
Global $fMsgWinOnTop = 0
;~ GUI Ctrl
Global $hsWinMsgText
#endregion
#region: - Win Msg Function
Func _WinMsg_Create()
$hMsgWin = GUICreate($sMsgWinTitle, $iMsgWinWidth, $iMsgWinHeight, $iMsgWinX, $iMsgWinY, $iMsgWinStyle, $iMsgWinExStyle)
GUISetIcon('shell32.dll', -10)
GUISetOnEvent($GUI_EVENT_CLOSE, '_Pro_Exit')
GUICtrlCreateGroup(' Введите текст: ', 5, 5, $iMsgWinWidth-10, $iMsgWinHeight-10)
$hsWinMsgText = GUICtrlCreateInput('', 15, 25, $iMsgWinWidth-30, 20)
GUICtrlCreateButton('OK', 14, 53, ($iMsgWinWidth-28-2)/2, 24)
GUICtrlSetOnEvent(-1, '_WinMsg_OK')
GUICtrlCreateButton('Отмена', 14+($iMsgWinWidth-28-2)/2+2, 53, ($iMsgWinWidth-28-2)/2, 24)
GUICtrlSetOnEvent(-1, '_Pro_Exit')
If $fMsgWinOnTop Then WinSetOnTop($hMsgWin, '', 1)
GUISetState(@SW_SHOW, $hMsgWin)
EndFunc
Func _WinMsg_Close()
;~ GUIDelete($hMsgWin)
_Pro_Exit()
EndFunc
Func _WinMsg_OK()
Local $sText = GUICtrlRead($hsWinMsgText)
If StringStripWS($sText, 8) == '' Then
MsgBox(48, 'Ошибка!', 'Пожалуйста, введите текст')
GUICtrlSetData($hsWinMsgText, '')
GUICtrlSetState($hsWinMsgText, $GUI_FOCUS)
Else
;~ MsgBox(64, 'OK', 'Отлично')
_PutTextToNotepad($sText)
_WinMsg_Close()
EndIf
EndFunc
#endregion
#region: - After creating all GUI
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
_WinMsg_Create()
#endregion
#region: - Sleep, Exit
While 1
Sleep(10)
WEnd
Func _Pro_Exit()
Exit
EndFunc
#endregion
Func _PutTextToNotepad($sText)
Local $iPid, $iHwd
$iPid = Run('notepad.exe')
While 1
$iHwd = _ProcessGetWindow($iPid)
If IsHWnd($iHwd) Then ExitLoop
WEnd
WinWait($iHwd)
ControlSetText($iHwd, '', '[CLASS:Edit; INSTANCE:1]', $sText)
EndFunc
Func _ProcessGetWindow($iPID, $iRet=1)
Local $aWinList = WinList()
Local $aRet[2]
If IsString($iPID) Then $iPID = ProcessExists($iPID)
For $i = 1 To UBound($aWinList)-1
If WinGetProcess($aWinList[$i][1]) = $iPID Then
$aRet[0] = $aWinList[$i][0] ;Title
$aRet[1] = $aWinList[$i][1] ;WinHandle
If $iRet = 0 Then Return $aRet[0]
If $iRet = 1 Then Return $aRet[1]
Return $aRet
EndIf
Next
Return SetError(1, 0, $aRet)
EndFunc
Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam)
Local $iProc = DllCall('user32.dll', 'int', 'DefWindowProc', 'hwnd', $hWnd, 'int', $Msg, 'wparam', $wParam, 'lparam', $lParam)
If $iProc[0] = $HTCLIENT Then Return $HTCAPTION
Return $GUI_RUNDEFMSG
EndFunc