Jump to content

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


Recommended Posts

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
Link to comment
Share on other sites

  • 4 years later...

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
Link to comment
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
Link to comment
Share on other sites

  • 1 year later...

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:

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...