Try this
Code:
InputBox, letter, Alphabet, Give an alphabet `n`n Example: a/b/c,,,300, 100
Run, Notepad.exe,, , npPid
WinWait, ahk_pid %npPid%
ControlSetText, Edit1, % letter " 012345", ahk_pid %npPid%s
A couple of things:
- The pid in run (npPid) gives that specific window an id. This allows WinWait and ControlSetText to apply to the newly run window ONLY (in case theres other Notepads open).
- The WinWait gets rid of the need for sleep.
- The ControlSetText gets rid of the unreliable and interuptable send.
edit:
and then you could...
Code:
start:
InputBox, letter, Alphabet, Give an alphabet `n`n Example: a/b/c,,, 300, 100,
if Errorlevel ; Exits if cancel is pressed.
{
Msgbox, Process Canceled
ExitApp
}
if letter is not alpha ; Checks to make sure theres letters only.
{
Msgbox, Please enter letters only!
Goto, start
}
Else if !letter ; Checks to make sure that something was written.
{
Msgbox, You did not write anything!
Goto, start
}
Run, Notepad.exe,, , npPid
WinWait, ahk_pid %npPid%
ControlSetText, Edit1, % letter " 012345", ahk_pid %npPid%s
Also, if you wanted to just have the letter info placed into a new or existing txt file use
FileAppend.
hth