I'm looking for a way to send information to a command prompt's output. For example, when I type ipconfig, the ipconfig program then shows some basic network adapter info in the prompt. That output is what I want to be able to send to the prompt after a script is executed by that prompt.
Any ideas? I'm assuming this is going to require DLL calls or something advanced that I have no idea where to begin looking for what I need.
Use a command prompt for information output?
Re: Use a command prompt for information output?
Yes its possible and pretty easy... there are two methods:
1) use AttachConsole to, well, attach to the console window that launched it
2) compile the script (or at least make a dedicated copy of ahk.exe) and set the exe subsystem to be a console application
you would then do a fileappend to stdout to write the text
searching the forum should reveal examples of both
1) use AttachConsole to, well, attach to the console window that launched it
2) compile the script (or at least make a dedicated copy of ahk.exe) and set the exe subsystem to be a console application
you would then do a fileappend to stdout to write the text
searching the forum should reveal examples of both
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
Re: Use a command prompt for information output?
The second option is better. Without it, the command prompt may not wait for your script to finish, because it is not a console app. In that case, the prompt may appear before your script writes its output; for example:
Code: Select all
C:\>script.exe
C:\>The output of your script.
Re: Use a command prompt for information output?
I agree and use the second option whenever possible. But, the downside is if you use the app both from the command prompt and not, then you get the ugly command prompt pop up when you don't want it... So there is no all-case perfect solution as far as i know
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
Re: Use a command prompt for information output?
Of course, you can run both the compiled console app and the uncompiled script. Or you can modify AutoHotkey and use both the modified version and the original.
Every other console program out there has the same issue. Usually the solution is either to have two executables, or to just hide the console window.
Every other console program out there has the same issue. Usually the solution is either to have two executables, or to just hide the console window.
Who is online
Users browsing this forum: Google [Bot], iamMG and 130 guests