Terminal control/Positional read: Difference between revisions

→‎{{header|AutoHotkey}}: inline the function -- it was crap anyway
(→‎{{header|AutoHotkey}}: Submit AutoHotkey example)
(→‎{{header|AutoHotkey}}: inline the function -- it was crap anyway)
Line 5:
=={{header|AutoHotkey}}==
{{works with|AutoHotkey_L}}
<p>AutoHotkey is not built for the command line, so we need call the WinAPI directly.</p><p>For fun, this writes random characters to the command window so that it has something to retrieve. </p>
<lang AHK>DllCall( "AllocConsole" ) ; create a console if not launched from one
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 )
Loop 1510
{
WriteConsole(hConsole, RandChars(7) "`n")
Loop % n10
}{
Random, asc, % asc("A"), % Asc("Z")
WriteConsole(hConsole, Chr(asc))
}
WriteConsole(hConsole, RandChars(7) "`n")
}
 
MsgBox % ReadConsoleOutputCharacter(hConsole, 1, 3, 6)
Line 35 ⟶ 42:
return out
return 0
RandChars(n){
Loop % n
{
Random, asc, % asc("A"), % Asc("Z")
out .= Chr(asc)
}
return out
}</lang>