Код:
#include <GUiConstants.au3>
Opt("GUIOnEventMode", 1)
$gui = GUICreate ("", 100, 100)
GUISetOnEvent ($GUI_EVENT_CLOSE, "_exit")
$Function_1 = GUICtrlCreateButton ("Function_1", 10, 10, 80, 80)
GUICtrlSetOnEvent ($Function_1, "Function_1")
_notepad ()
GUISetState (@SW_SHOW, $gui)
While 1
sleep (1000)
WEnd
Func _notepad ()
Run ("notepad.exe")
WinWaitActive ("Безымянный - Блокнот")
Send ("Что-то выполняется до Function_1")
;Здесь сделать паузу до момента выполнения Function_1, потом продолжить
Send ("Что-то выполняется после Function_1")
EndFunc
Func Function_1 ()
WinActivate ("Безымянный - Блокнот")
Send ("{Enter}")
Send ("Выполнение Function_1")
Send ("{Enter}")
EndFunc
Func _exit ()
Exit
EndFunc