Is there any way of getting a handle to the console of a Command
Prompt application? I can get the process ID, because my Windows
program ran the process in the first place, and I have the window
handle. I want to read its buffer contents directly, rather than
stuffing Alt-Space,e,s,Enter into the keyboard buffer and then reading
the clipboard.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 9:42:09 AM |
|
Phil Hibbs wrote:
> I want to read its [another program's console] buffer contents
> directly, rather than stuffing Alt-Space,e,s,Enter into the
> keyboard buffer and then reading the clipboard.
For the record, this doesn't work reliably. Here, the "e" opens
the "E_igenschaften" (German for properties), not "E_dit".
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
|
|
0
|
|
|
|
Reply
|
Ulrich
|
3/31/2010 10:52:52 AM
|
|
Ulrich Eckhardt wrote:
> For the record, this doesn't work reliably. Here, the "e" opens
> the "E_igenschaften" (German for properties), not "E_dit".
Good point - I should use the cursor keys then, "{up 3}{right}{down 3}
{Enter}". Although I've seen things that mess with the menu in other
ways. Good reasons to move away from this method and grab the content
through an API, if it's possible.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 11:39:30 AM
|
|
* Phil Hibbs:
> Is there any way of getting a handle to the console of a Command
> Prompt application? I can get the process ID, because my Windows
> program ran the process in the first place, and I have the window
> handle. I want to read its buffer contents directly, rather than
> stuffing Alt-Space,e,s,Enter into the keyboard buffer and then reading
> the clipboard.
What's wrong with piping?
Cheers,
- Alf
|
|
0
|
|
|
|
Reply
|
Alf
|
3/31/2010 11:40:51 AM
|
|
Alf P. Steinbach wrote:
> What's wrong with piping?
That only works with simple programs that just use STDOUT, anything
that draws on the screen would not work. Also I want to leave the
Command Prompt running at the end so that the user can interact with
it. What I'm actually doing is running a Telnet session, logging it
in, running a couple of commands, then leaving it running.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 11:56:55 AM
|
|
* Phil Hibbs:
> Alf P. Steinbach wrote:
>> What's wrong with piping?
>
> That only works with simple programs that just use STDOUT, anything
> that draws on the screen would not work. Also I want to leave the
> Command Prompt running at the end so that the user can interact with
> it. What I'm actually doing is running a Telnet session, logging it
> in, running a couple of commands, then leaving it running.
Have you considered asking the Telnet client to log?
<example>
telnet [-a][-e escape char][-f log file][-l user][-t term][host [port]]
-a Attempt automatic logon. Same as -l option except uses
the currently logged on user's name.
-e Escape character to enter telnet client prompt.
-f File name for client side logging
-l Specifies the user name to log in with on the remote system.
Requires that the remote system support the TELNET ENVIRON option.
-t Specifies terminal type.
Supported term types are vt100, vt52, ansi and vtnt only.
host Specifies the hostname or IP address of the remote computer
to connect to.
port Specifies a port number or service name.
</example>
Just use option /k (short for "keep") for the command prompt.
Cheers & hth.,
- Alf
|
|
0
|
|
|
|
Reply
|
Alf
|
3/31/2010 12:27:52 PM
|
|
Alf P. Steinbach wrote:
> Have you considered asking the Telnet client to log?
The log output is buffered, and can't be read until the Telnet session
exits.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 12:55:20 PM
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote
cite="mid:a6e192d7-1fdf-4fc5-83d3-70262aba98ba@g4g2000yqa.googlegroups.com"
type="cite">
<p wrap="">Is there any way of getting a handle to the console of a
Command Prompt application? I can get the process ID, because my
Windows program ran the process in the first place, and I have the
window handle. <br>
</p>
</blockquote>
<p>Process handle, not window handle. If you spawned the process in
the first place, then you controlled what console it inherited via the
process creation flags.<br>
</p>
<p>But since this isn't your real problem ...</p>
<blockquote
cite="mid:f348487c-b790-483f-9d54-6e970a6793a5@n34g2000yqb.googlegroups.com"
type="cite">
<p wrap="">What I'm actually doing is running a Telnet session,
logging it in, running a couple of commands, then leaving it running.<br>
</p>
</blockquote>
<p>... you should <a
href="http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/put-down-the-chocolate-covered-banana.html">put
down the chocolate-covered banana, step away from the European currency
systems</a>, and solve your real problem. As M. Steinbach mentioned,
you can tell <code>telnet</code> to log-in as a given user via
command-line options.</p>
</body>
</html>
|
|
0
|
|
|
|
Reply
|
Jonathan
|
3/31/2010 5:17:54 PM
|
|
Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>
wrote in
news:IU.D20100331.T171811.P2159.Q0@J.de.Boyne.Pollard.localhost:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
> <title></title>
Please, don't post HTML to newsgroups.
|
|
0
|
|
|
|
Reply
|
Matti
|
3/31/2010 7:20:04 PM
|
|
Jonathan de Boyne Pollardwrote:
> ... you shouldput down the chocolate-covered banana, step away from the E=
uropean currency systems, and solve your real problem.=A0 As M. Steinbach m=
entioned, you can telltelnetto log-in as a given user via command-line opti=
ons.
Please, I know what I am doing, I still want to do what I originally
asked, which is to get a console buffer handle from either a process
ID or a window handle.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 7:28:35 PM
|
|
* Phil Hibbs:
> Jonathan de Boyne Pollardwrote:
>> ... you shouldput down the chocolate-covered banana, step away from
>> the European currency systems, and solve your real problem. As M.
>> Steinbach mentioned, you can telltelnetto log-in as a given user via
>> command-line options.
>
> Please, I know what I am doing, I still want to do what I originally
> asked, which is to get a console buffer handle from either a process
> ID or a window handle.
Why don't you read also the parts of Jonathan de Boyne Pollard's article that
you chose to not quote.
He mentioned another solution to your stated technical problem.
It's a good idea to read the articles that one replies to. Also, Jonathan's
advice to put down the chocolate-covered banana is good. It's probably not a
solution to your real problem, whatever that is.
Cheers & hth.,
- Alf
|
|
0
|
|
|
|
Reply
|
Alf
|
3/31/2010 7:31:29 PM
|
|
Alf P. Steinbach wrote:
> Why don't you read also the parts of Jonathan de Boyne Pollard's article that
> you chose to not quote.
>
> He mentioned another solution to your stated technical problem.
All I saw was how to log in, I didn't see anything about running more
commands after that and interrogating the output.
> Cheers & hth.,
No, didn't help at all.
Phil.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 8:04:47 PM
|
|
* Phil Hibbs:
> Alf P. Steinbach wrote:
>> Why don't you read also the parts of Jonathan de Boyne Pollard's article that
>> you chose to not quote.
>>
>> He mentioned another solution to your stated technical problem.
>
> All I saw was how to log in, I didn't see anything about running more
> commands after that and interrogating the output.
>
>> Cheers & hth.,
>
> No, didn't help at all.
Then, perhaps really *read* that article.
Say, make yourself stop completely after each sentence. Before moving on,
contemplate what that sentence said. Be sure that you really understood the
sentence that you just read, before moving on to the next.
If there is a sentence that is unclear, just ask about it (I'm sure Jonathan
will supply additional details & explanations if requested).
Cheers & hth.,
- Alf
PS: remember, really *read* -- one sentence at a time.
|
|
0
|
|
|
|
Reply
|
Alf
|
3/31/2010 8:13:15 PM
|
|
Alf P. Steinbach wrote:
> PS: remember, really *read* =A0-- =A0one sentence at a time.
Done that. I still don't understand what you are getting at. Perhaps
it's best that you conclude that I am an idiot, and ignore me. Maybe
someone else will come along that is helpful.
Phil.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 8:41:31 PM
|
|
OK, sorry about my somewhat flippant reply, here's a better one.
My original Y was to automate the launch of a Telnet window, log in to
it, and check whether the user is getting a message warning them that
their password is about to expire.
So, I used the technique that I described in my original post,
stuffing the commands into the keyboard buffer and scraping the
console buffer into the clipboard and checking for the expiry warning
(or at least I will when I get the warning because I don't know
exactly what to look for yet).
Now, I am trying to make this into a generic Command Prompt automation
suite, so I can quickly throw together scripts that send commands to a
Command Prompt and interrogate the screen, not limited to STDIO
either, I want this to work with screen-drawing applicatons,
eventually I want to write a Nethack bot with it.
So, I appreciate that you are probably trying to subtly tell me "don't
do that, just do your simple telnet thing another way", but I really
do want to do what I want to do. Telnet is just a MacGuffin.
Phil.
|
|
0
|
|
|
|
Reply
|
Phil
|
3/31/2010 8:51:53 PM
|
|
So you want to create an application that can process low-level console
input in raw mode? As you have already noted, the key is to get the console
input & output handles. AFAIK, the only way to get these handles is to run
in-process and use GetStdHandle, or to specify them when the process is
launched (as Jonathan has already mentioned). Look at ReadConsoleInput &
ReadConsoleOutput in MSDN for more details on how to read low-level console
input.
"Phil Hibbs" <snarks@gmail.com> wrote in message
news:40d9ddc2-8f9a-4abe-919f-d9914ffba236@z11g2000yqz.googlegroups.com...
> OK, sorry about my somewhat flippant reply, here's a better one.
>
> My original Y was to automate the launch of a Telnet window, log in to
> it, and check whether the user is getting a message warning them that
> their password is about to expire.
>
> So, I used the technique that I described in my original post,
> stuffing the commands into the keyboard buffer and scraping the
> console buffer into the clipboard and checking for the expiry warning
> (or at least I will when I get the warning because I don't know
> exactly what to look for yet).
>
> Now, I am trying to make this into a generic Command Prompt automation
> suite, so I can quickly throw together scripts that send commands to a
> Command Prompt and interrogate the screen, not limited to STDIO
> either, I want this to work with screen-drawing applicatons,
> eventually I want to write a Nethack bot with it.
>
> So, I appreciate that you are probably trying to subtly tell me "don't
> do that, just do your simple telnet thing another way", but I really
> do want to do what I want to do. Telnet is just a MacGuffin.
>
> Phil.
|
|
0
|
|
|
|
Reply
|
m
|
3/31/2010 10:15:50 PM
|
|
On Mar 31, 11:15=A0pm, "m" <m...@b.c> wrote:
> So you want to create an application that can process low-level console
> input in raw mode? =A0As you have already noted, the key is to get the co=
nsole
> input & output handles. =A0AFAIK, the only way to get these handles is to=
run
> in-process and use GetStdHandle, or to specify them when the process is
> launched (as Jonathan has already mentioned). =A0
> Look at ReadConsoleInput &
> ReadConsoleOutput in MSDN for more details on how to read low-level conso=
le
> input.
Yes, ReadConsoleOutput is exactly what I want to do, but I don't know
how to get the handle. I'm running the Telnet (or cmd.exe or
nethack.exe whatever) process, but the language and function I'm using
doesn't provide the facility to specify a console buffer. I'm using
AutoIt, and here's a link to my script and to the help page on the Run
function.
http://www.autoitscript.com/forum/index.php?showtopic=3D112372
http://www.autoitscript.com/autoit3/docs/functions/Run.htm
AutoIt does have wrappers for many of the lower-level API functions,
so if there's another API that lets me specify my own console buffer
for a new process, then I might be able to use that. I'll probably
need to specify the DLL hook for the API functions to create a console
buffer. I've not delved into this kind of thing much before, but I'm
not scared of it. Well, maybe a little.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
4/1/2010 6:17:20 PM
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<p>And at this point in the thread we find a problem statement of <em>another</em>
underlying different real problem:</p>
<blockquote
cite="mid:40d9ddc2-8f9a-4abe-919f-d9914ffba236@z11g2000yqz.googlegroups.com"
type="cite">
<p>Now, I am trying to make this into a generic Command Prompt
automation suite, so I can quickly throw together scripts that send
commands to a Command Prompt and interrogate the screen, not limited to
STDIO either, I want this to work with screen-drawing applicatons,
eventually I want to write a Nethack bot with it.</p>
</blockquote>
<p>Then you need to read <a
href="http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/capture-console-win32.html">another
Frequently Given Answer about that</a>.</p>
</body>
</html>
|
|
0
|
|
|
|
Reply
|
Jonathan
|
4/1/2010 10:28:05 PM
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote cite="mid:Xns9D4CE3334E264xmvuorikolumbusfi@195.197.54.114"
type="cite">
<p>Please, don't post HTML to newsgroups.</p>
</blockquote>
<p>Please learn about Usenet, and about the <em>actual</em>
distinction, between text and <em>binaries</em>, that it has. Then
learn what the 'T' in "HTML" stands for.<br>
</p>
</body>
</html>
|
|
0
|
|
|
|
Reply
|
Jonathan
|
4/1/2010 10:33:01 PM
|
|
I have never used, or even heard of, AutoIt before, so take my answer with
that in mind.
The handle you need to use with ReadConsoleOutput is the stdout handle for a
console. If the IO is redirected to a pipe or a file the call will fail,
but with an actual console it succeeds. I missed the first part of this
thread, but if you are creating the process, you can specify the console to
use; otherwise the easiest way is to attach to it and get the handle from
there (AttachConsole + GetStdHandle)
Hooking will not help in this case because the console is not usually
created by the process directly (either by the loader, or by a parent
process like cmd.exe)
"Phil Hibbs" <snarks@gmail.com> wrote in message
news:bf66d149-f9d8-4192-8a71-d1708d1096b5@8g2000yqz.googlegroups.com...
> On Mar 31, 11:15 pm, "m" <m...@b.c> wrote:
>> So you want to create an application that can process low-level console
>> input in raw mode? As you have already noted, the key is to get the
>> console
>> input & output handles. AFAIK, the only way to get these handles is to
>> run
>> in-process and use GetStdHandle, or to specify them when the process is
>> launched (as Jonathan has already mentioned).
>
>> Look at ReadConsoleInput &
>> ReadConsoleOutput in MSDN for more details on how to read low-level
>> console
>> input.
>
> Yes, ReadConsoleOutput is exactly what I want to do, but I don't know
> how to get the handle. I'm running the Telnet (or cmd.exe or
> nethack.exe whatever) process, but the language and function I'm using
> doesn't provide the facility to specify a console buffer. I'm using
> AutoIt, and here's a link to my script and to the help page on the Run
> function.
>
> http://www.autoitscript.com/forum/index.php?showtopic=112372
> http://www.autoitscript.com/autoit3/docs/functions/Run.htm
>
> AutoIt does have wrappers for many of the lower-level API functions,
> so if there's another API that lets me specify my own console buffer
> for a new process, then I might be able to use that. I'll probably
> need to specify the DLL hook for the API functions to create a console
> buffer. I've not delved into this kind of thing much before, but I'm
> not scared of it. Well, maybe a little.
>
> Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
m
|
4/2/2010 1:41:31 AM
|
|
Jonathan de Boyne Pollard wrote:
> And at this point in the thread we find a problem statement of another
> underlying different real problem:
How is that different from my original post? I want to get a
hConsoleOutput handle, so that I can read the contents directly
instead of stuffing the keys for a Select All command into the
prompt's system menu.
> Then you need to readanother Frequently Given Answer about that.
OK, that's 100% on topic for what I want to do, I do want to
continuously poll the output buffer and I am aware that I might miss
something if it scrolls out of the buffer before I poll it. There
isn't really an answer in there, though, just a general warning that
the approach is problematic. I know that, but it's the only approach
that can achieve what I want, so I'll have to either live with the
problems or stick with the Alt-Space key-stuffing approach which has
its own problems.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
4/2/2010 9:11:04 AM
|
|
[Note: deliberately ignoring f'up]
Jonathan de Boyne Pollard wrote:
> <blockquote cite="mid:Xns9D4CE3334E264xmvuorikolumbusfi@195.197.54.114"
> type="cite">
> <p>Please, don't post HTML to newsgroups.</p>
> </blockquote>
> <p>Please learn about Usenet, and about the <em>actual</em>
> distinction, between text and <em>binaries</em>, that it has.
Usenet is the thing with the humans, as opposed to the one with the tubes,
right? ;)
> Then learn what the 'T' in "HTML" stands for.<br>
By that logic, I could use Word Perfect, too, as it is a text processor, or
EBCDIC. Sorry, but I really don't understand what makes you think that HTML
is an accepted practice here. Or, are you merely implying that it isn't
forbidden? If that's the case, you are obviously perfectly right, but also
tragically stupid, because it's not about forbidden or right but about
communication, and there both ends must match. Deliberately violating best
practices isn't helpful, it will only get you ignored or flamed.
Cheers!
Uli
|
|
0
|
|
|
|
Reply
|
Ulrich
|
4/6/2010 12:39:42 PM
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote cite="mid:elmr87-77i.ln1@satorlaser.homedns.org" type="cite">
<blockquote type="cite">
<p>Please learn about Usenet, and about the <em>actual</em>
distinction, between text and <em>binaries</em>, that it has. Then
learn what the 'T' in "HTML" stands for.</p>
</blockquote>
<p>Usenet is the thing with the humans, as opposed to the one with
the tubes, right? ;)</p>
</blockquote>
<p>Humans are capable of looking at hypertext and recognizing it as
text. And there are large parts of Usenet dedicated to posts that
aren't directly read by humans. So you might want to think harder
about that question than you have. As I said: The actual distinction
on Usenet is between text and binaries.<br>
</p>
<blockquote cite="mid:elmr87-77i.ln1@satorlaser.homedns.org" type="cite">
<p>Sorry, but I really don't understand [...]</p>
</blockquote>
<p>That's because you don't know enough about Usenet. This is Usenet.
It has a "What is Usenet?" FAQ, and you need to start with the answer
to item #12 therein. It's especially apposite given that you mentioned
EBCDIC. The distinction on Usenet is between <em>text</em> and <em>binaries</em>,
with hyper<em>text</em> falling on the text side of that divide.
Binaries are bodypart types such as <code>audio/*</code>, <code>video/*</code>,
and <code>image/*</code>. <code>text/*</code> bodypart types are
text, obviously enough. One of the long-since-learned lessons of
Usenet (and many other discussion networks), moreover, is that markup
and metadata are necessary, with anything less being unreliable at
best. This is, of course, one of the reasons that they were invented
in the first place. <br>
</p>
<blockquote cite="mid:elmr87-77i.ln1@satorlaser.homedns.org" type="cite">
<p>Deliberately violating best practices isn't helpful, it will only
get you ignored or flamed.</p>
</blockquote>
<p>So why then did you deliberately violate the best practice of moving
a thread to the newsgroups where it is on-topic and out of the
newsgroups where it isn't? Did you want to be ignored or flamed for
being unhelpful to the people who subscribed to the newsgroups for
discussions of reading Usenet expecting that such discussions would be
found there?</p>
</body>
</html>
|
|
0
|
|
|
|
Reply
|
Jonathan
|
4/6/2010 11:50:21 PM
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote
cite="mid:4fe2e3dc-8a2a-431b-8aa7-d4f4d56dc8c4@k13g2000yqe.googlegroups.com"
type="cite">
<blockquote type="cite">
<p>And at this point in the thread we find a problem statement of
another underlying different real problem:</p>
</blockquote>
<p>How is that different from my original post? </p>
</blockquote>
<p>Come now! Surely even you yourself can spot the difference between</p>
<blockquote type="cite">
<p>Now, I am trying to make this into a generic Command Prompt
automation suite, so I can quickly throw together scripts that send
commands to a Command Prompt and interrogate the screen, not limited to
STDIO either, I want this to work with screen-drawing applicatons,
eventually I want to write a Nethack bot with it.</p>
</blockquote>
<p>and</p>
<blockquote type="cite">
<p>Is there any way of getting a handle to the console of a
Command Prompt application? I can get the process ID, because my
Windows program ran the process in the first place, and I have the
window handle. </p>
</blockquote>
<p>and even</p>
<blockquote type="cite">
<p>What I'm actually doing is running a Telnet session,
logging it in, running a couple of commands, then leaving it running.</p>
</blockquote>
<p>.</p>
<blockquote
cite="mid:4fe2e3dc-8a2a-431b-8aa7-d4f4d56dc8c4@k13g2000yqe.googlegroups.com"
type="cite">
<p>
<blockquote type="cite">Then you need to read <a
href="http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/capture-console-win32.html">another
Frequently
Given Answer about that</a>.</blockquote>
<br>
There isn't really an answer in there, though, just a general warning
that the approach is problematic.</p>
</blockquote>
<p>That is an answer. That it involves your putting down the
chocolate-covered banana and stepping away from the European currency
systems is the true problem, here. <br>
</p>
</body>
</html>
|
|
0
|
|
|
|
Reply
|
Jonathan
|
4/7/2010 12:16:41 AM
|
|
Jonathan de Boyne Pollard wrote:
> <blockquote cite="mid:elmr87-77i.ln1@satorlaser.homedns.org" type="cite">
> <blockquote type="cite">
> <p>Please learn about Usenet, and about the <em>actual</em>
> distinction, between text and <em>binaries</em>, that it has. Then
> learn what the 'T' in "HTML" stands for.</p>
> </blockquote>
> <p>Usenet is the thing with the humans, as opposed to the one with
> the tubes, right? ;)</p>
> </blockquote>
> <p>Humans are capable of looking at hypertext and recognizing it as
> text.
Naja, dann kannst Du ja auch "google translator" benutzen um zu verstehen
was ich hier schreibe, oder? Klar kannst Du, aber es ist eine Zumutung.
> And there are large parts of Usenet dedicated to posts that aren't
> directly read by humans. So you might want to think harder about
> that question than you have. As I said: The actual distinction
> on Usenet is between text and binaries.<br>
....oder zwischen Leuten die verstehen was ein Smiley ist und denen die es
nicht tun?
> </p>
> <blockquote cite="mid:elmr87-77i.ln1@satorlaser.homedns.org" type="cite">
> <p>Sorry, but I really don't understand [...]</p>
> </blockquote>
> <p>That's because you don't know enough about Usenet.
Ich poste seit >10 Jahren hier, ich glaube ich kenne mich recht gut aus mit
der Kultur hier.
> The distinction on Usenet is between <em>text</em> and <em>binaries</em>,
> with hyper<em>text</em> falling on the text side of that divide.
Sieh mal, genau das ist das wo meine Meinung eine andere ist. HT ist einfach
nicht nur Text, genauso koennte ich Dir irgendetwas base64-kodiertes
vorwerfen, das ist ja auch nur Text.
> One of the long-since-learned lessons of Usenet (and many other discussion
> networks), moreover, is that markup and metadata are necessary, with
> anything less being unreliable at best. This is, of course, one of
> the reasons that they were invented in the first place. <br> </p>
Du kannst Text sehr wohl formatieren ohne auf HTML zurueckzugreifen. Es gibt
da ein paar Gepflogenheiten z.B. fuer /kursiv/ oder *fett* gedruckte
Woerter, wie z.B. von vielen Wikis verwendet.
> <blockquote cite="mid:elmr87-77i.ln1@satorlaser.homedns.org" type="cite">
> <p>Deliberately violating best practices isn't helpful, it will only
> get you ignored or flamed.</p>
> </blockquote>
> <p>So why then did you deliberately violate the best practice of moving
> a thread to the newsgroups where it is on-topic and out of the
> newsgroups where it isn't? Did you want to be ignored or flamed for
> being unhelpful to the people who subscribed to the newsgroups for
> discussions of reading Usenet expecting that such discussions would be
> found there?</p>
It's meta-topic and thus indeed belongs here. In any case, I have conducted
a websearch on you and found that it is completely useless arguing with
you, as others have found out the hard way before. You're boring and a
nuisance, i.e. best ignored.
Uli
|
|
0
|
|
|
|
Reply
|
Ulrich
|
4/7/2010 7:50:22 AM
|
|
OK, time to re-open this old wound. I think I'm close to getting
something working.
I have one working script written using a tool called AutoHotKey, and
one non-working script written in AutoIt. I don't know AutoHotKey at
all, the scripting language is alien and strange to me so I'm having a
hard time converting it to a working AutoIt script, especially as I'm
not very familiar with the Windows API concepts that it is using.
Here is the working AutoHotKey script (search for n-l-i-d, the script
in his post works fine for me)
http://www.autohotkey.com/forum/topic36465.html
The interesting bits look like this:
if !DllCall("AttachConsole","uint",pid) { ExitApp }
; If it succeeded, console functions now operate on the target
console window.
; Use CreateFile to retrieve a handle to the active console screen
buffer.
hConOut:=DllCall("CreateFile","str","CONOUT$","uint",0xC0000000
,"uint",7,"uint",0,"uint",3,"uint",0,"uint",0)
if hConOut = -1 ; INVALID_HANDLE_VALUE
...
I tried to convert the AttachConsole and CreateFile calls to AutoIt
syntax, which ended up looking like this:
http://www.autoitscript.com/forum/index.php?showtopic=113407
The equivalent bit looks like this:
DllCall( "Kernel32.dll", "int", "AttachConsole", "int", $pCmd )
If @error Then Return SetError(1, 0, -1)
$hConsole = DllCall( "Kernel32.dll", "hwnd",
"CreateFile","str","CONOUT$", "int", 0xC0000000 _
, "int", 7, "int", 0, "int", 3, "int", 0,
"int", 0 )
If $hConsole = -1 Then Return SetError( 2, 0, -1 )
However, the $hConsole return value from the DLL call is empty.
I know this is a long shot, and most people here will not be familiar
with AutoHotkey or AutoIt, but does any of the above ring any bells?
(And please, no "what do you REALLY want to do" replies, I've been
down that road already.)
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
4/23/2010 12:15:47 PM
|
|
I'm damn close to getting this working. Everything's fine until the
Command Prompt window scrolls, and then I get nothing.
If anyone's interested in a Command Prompt automation script, take a
look at this thread:
http://www.autoitscript.com/forum/index.php?showtopic=113588&st=0&gopid=794646&#entry794646
And if you can see why it all stops working when the window scrolls,
let me know, either here or there!
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
4/26/2010 3:56:23 PM
|
|
Me:
> I'm damn close to getting this working. Everything's fine until the
> Command Prompt window scrolls, and then I get nothing.
Fixed this now - I assumed that the rectangle offset was from the top
of the buffer, but it's from the visible window so you need a negative
Y offset to get the stuff that's off the top, not a positive Y offset
to get the stuff that's visible. Yay, I have my chocolate covered
banana at last! My thanks to everyone that discouraged and insulted
me.
Phil Hibbs.
|
|
0
|
|
|
|
Reply
|
Phil
|
4/27/2010 2:00:18 PM
|
|
Phil Hibbs <snarks@gmail.com> wrote in news:9ca1554c-556b-47ec-acb9-
d55089c4d533@x3g2000yqd.googlegroups.com:
> Me:
>> I'm damn close to getting this working. Everything's fine until the
>> Command Prompt window scrolls, and then I get nothing.
>
> Fixed this now - I assumed that the rectangle offset was from the top
> of the buffer, but it's from the visible window so you need a negative
> Y offset to get the stuff that's off the top, not a positive Y offset
> to get the stuff that's visible. Yay, I have my chocolate covered
> banana at last! My thanks to everyone that discouraged and insulted
> me.
Thank you for sharing the problem and the solution too. It's good to know
that it can be done - and how it can be done.
|
|
0
|
|
|
|
Reply
|
Matti
|
4/27/2010 5:18:22 PM
|
|
|
28 Replies
590 Views
(page loaded in 0.352 seconds)
Similiar Articles: Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ...Is there any way of getting a handle to the console of a Command Prompt application? I can get the process ID, because my Windows program ran the pr... How to get process name from HWND or processID or ProcessHandle ...How to get process name from HWND or processID or ProcessHandle ... Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... I can get the process ID, because ... Getting the list of groups given a user id - comp.lang.perl.misc ...Getting the list of groups given a user id - comp.lang.perl.misc ... Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... I can get the process ID, because ... handling special characters in sqlldr - comp.databases.oracle ...Hi, I am trying to load a record(s) in a table which contains a field of text datatype. The records in question contain occasional single qoutes.... bit stuffing and pointers - comp.dcom.sdh-sonetGetting a hConsoleOutput handle - comp.os.ms-windows.programmer ... Good point - I should use the cursor keys then, "{up 3 ... technique that I described in my original ... Problem using EndNote addin with MS Word 2007 - comp.os.ms-windows ...Problem using EndNote addin with MS Word 2007 - comp.os.ms-windows ... So far I have been able to add in some buffering, but it ... Getting a hConsoleOutput handle - comp ... latch warning... - comp.lang.vhdlGetting a hConsoleOutput handle - comp.os.ms-windows.programmer ... latch warning... - comp.lang.vhdl Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... Parent child pipe communication scenario.. - comp.unix.programmer ...Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... If the IO is redirected to a pipe or a file the call ... process directly (either by the loader, or by ... howto read ntpq output directly? - comp.protocols.time.ntp ...Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... The log output is buffered, and can't be read until the Telnet session ... in MSDN for more details on ... How do I get a login screen when I move cursor to a certain place ...How do I get a login screen when I move cursor to a certain place ... Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... Good reasons to move away from ... Empty keyboard buffer - comp.lang.java.guiGetting a hConsoleOutput handle - comp.os.ms-windows.programmer ..... that I described in my original post, > stuffing the commands into the keyboard buffer ... 0, -1 ... VPN ASA Authentication to MS CA - comp.dcom.sys.ciscoHi! Just a quick question related to the configuration of a ASA 5500. I'm deploying a PKI and I would like to be able for my clients to connect f... How to use "telnet" to launch another program on a remote machine ...Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ... Phil Hibbs wrote: > I want to read its [another program ... As M. Steinbach mentioned, you can tell ... Capturing the output of a vim command into a buffer or register ...Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ..... Register ... in my original post, > stuffing the commands into the keyboard buffer ... do want to ... Logon Script using IFMEMBER - Windows 7 PROBLEM! - comp.os.ms ...Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ..... Attempt automatic logon ... to a working AutoIt script, especially as I'm not very familiar with ... Getting a hConsoleOutput handle - comp.os.ms-windows.programmer ...Is there any way of getting a handle to the console of a Command Prompt application? I can get the process ID, because my Windows program ran the pr... Hiding a "caret" in a Win32 console application on Visual C++ ...>// Set the cursor info settings for the Standard Output Handle. >SetConsoleCursorInfo( hConsoleOutput, > &structCursorInfo ); > >// Stay in a loop getting keystrokes until ... 7/23/2012 1:54:55 PM
|