Terminal control/Positional read: Difference between revisions
Content added Content deleted
(→{{header|AutoHotkey}}: Submit AutoHotkey example) |
(→{{header|AutoHotkey}}: inline the function -- it was crap anyway) |
||
Line 5: | Line 5: | ||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
{{works with|AutoHotkey_L}} |
{{works with|AutoHotkey_L}} |
||
<p>AutoHotkey is not built for the command line, so we call the WinAPI directly.</p><p>For fun, this writes random characters to the command window so that it has something to retrieve. </p> |
<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 |
<lang AHK>DllCall( "AllocConsole" ) ; create a console if not launched from one |
||
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 ) |
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 ) |
||
Loop |
Loop 10 |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
WriteConsole(hConsole, Chr(asc)) |
|||
⚫ | |||
⚫ | |||
} |
|||
MsgBox % ReadConsoleOutputCharacter(hConsole, 1, 3, 6) |
MsgBox % ReadConsoleOutputCharacter(hConsole, 1, 3, 6) |
||
Line 35: | Line 42: | ||
return out |
return out |
||
return 0 |
return 0 |
||
⚫ | |||
RandChars(n){ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
out .= Chr(asc) |
|||
⚫ | |||
return out |
|||
}</lang> |
}</lang> |
||