Sign in to follow this  
Followers 0
Esa-Matti

Send CTRL-C ("^c") Using StdinWrite()

7 posts in this topic

The following does not send a CTRL-C to the console app I am running.

StdinWrite($ConsoleProc,"^c")

All it does is send the string "^c".

The app can only be closed with a CTRL-C.

Any ideas?

Share this post


Link to post
Share on other sites



The following does not send a CTRL-C to the console app I am running.

StdinWrite($ConsoleProc,"^c")

All it does is send the string "^c".

The app can only be closed with a CTRL-C.

Any ideas?

Ctrl-c is hex 0x03, but I don't know if StdInWrite() will accept a hex number for the string. :)

You could try:

StdinWrite($ConsoleProc, 0x03)

...but it may just throw an error. :whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ctrl-c is hex 0x03, but I don't know if StdInWrite() will accept a hex number for the string. :P

You could try:

StdinWrite($ConsoleProc, 0x03)

...but it may just throw an error. :x

Nope, that doesn't work. :shifty: Tried it.

Also tried StdinWrite($ConsoleProc,Hex(0x03))

and StdinWrite($ConsoleProc,BinaryToString(00000011))

and StdinWrite($runping,00000011)

All seem to be sending ^C to the stdin stream... and doing nothing. So.... ???

... still working on it....

Edited by Graywalker

Share this post


Link to post
Share on other sites

Seriously, you had to dig up a post over four years old...?

:P

How about just ControlSend() to the window with an empty control spec?

:x


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Psalty so would you rather have him make a new thread for the same thing? This shows up on the top of google results if you search for it, so I think there is nothing wrong with bumping it until somebody finally finds out how to do it :oops:

I also need this right now and I wonder that after 6 years nobody found a solution! This looks like a favourite problem in other languages too.

And about that controlsend idea - this might work, but have you ever needed to press ctrl+c in a gui application? :bye: This is needed for a console apps of course. Please somebody check this. And yes maybe it was posted somewhere already and I am just bad at searching, so I apologize in advance :doh:

Share this post


Link to post
Share on other sites

And you dig up the same thread after a year of it being dormant with no information that's going to help anyone, instead of starting a new thread and linking to this one? Forum ettiquette looks down on necroing 6 year old threads that don't have anything useful in it, asking if anyone has found a fix for it yet.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Allright I apologize for my misunderstanding of this unwritten forum ettiquette:) Can you please explain to me what is the advantage of making new thread with a link to this one instead of replying directly to it? I think it would just be more difficult for people to read it and see what others already tried and what did not work. I consider failed attempts to be usefull information too...

Edited by LoWang

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0