majnet Posted November 16, 2004 Share Posted November 16, 2004 I'd like generate some data by AutoIt and send them by pipe to another program. Is it posible do that? AutoIt3.exe myscript.au3 | some_program.exe or AutoIt3.exe myscript.au3 > out.txt I always receive empty output. Link to comment Share on other sites More sharing options...
SlimShady Posted November 16, 2004 Share Posted November 16, 2004 That's a good idea.I tested the function ConsoleWrite with the latest beta version and it works.Download here.I ran my test script as follows:%COMSPEC% /c "C:\Program Files\AutoIt3\AutoIt3.exe" C:\Test\test.au3 > C:\Test\Output.txt Link to comment Share on other sites More sharing options...
Valik Posted November 16, 2004 Share Posted November 16, 2004 Slim, it would of been helpful to provide the test script... Link to comment Share on other sites More sharing options...
SlimShady Posted November 16, 2004 Share Posted November 16, 2004 the function ConsoleWriteAllright. Whatever makes you happy.Script:ConsoleWrite("Some text...")Run this:%COMSPEC% /c "C:\Program Files\AutoIt3\AutoIt3.exe" C:\Test\test.au3 > C:\Test\Output.txtreplace "C:\Test\test.au3" with the path to the scriptreplace "C:\Test\Output.txt" with the path to the output file. Link to comment Share on other sites More sharing options...
majnet Posted November 16, 2004 Author Share Posted November 16, 2004 (edited) Thank you ShlimShady! It's exactly what I needed. Edited November 16, 2004 by majnet Link to comment Share on other sites More sharing options...
majnet Posted November 16, 2004 Author Share Posted November 16, 2004 (edited) I have trouble with using ConsoleWrite, because the output is buffering.Is posible create another fuction ConsoleWriteLine, which will write one line to standard output and flush the buffer together? Or function ConsoleFlush would be helpful. Edited November 16, 2004 by majnet Link to comment Share on other sites More sharing options...
Mr.Wizard Posted November 16, 2004 Share Posted November 16, 2004 I got a question, why does ConsoleWrite not write to the console? Load up the console (cmd.exe), navigate to a directory with a script in it that does something like ConsoleWrite("hello") and run the script by typing its name into the console window, and it runs but nothing is output to the console... It would be cool if it did write to the console... I have a catapult. Give me all the money or I will fling an enormous rock at your head. Link to comment Share on other sites More sharing options...
Valik Posted November 16, 2004 Share Posted November 16, 2004 (edited) Mr.Wizard, you obviously didn't read the help file. Your question is answered in bold letters (Imagine that, the help file with an answer to an obvious question!). majnet, what exactly is the problem? I understand that it buffers, but I dont' understand where this is a problem. At some point, it does get flushed, so where does the problem lie? Edited November 16, 2004 by Valik Link to comment Share on other sites More sharing options...
Mr.Wizard Posted November 16, 2004 Share Posted November 16, 2004 It doesn't answer the question, it says it doesn't do it. Why doesn't it do it? Wouldn't it be better if it did? I have a catapult. Give me all the money or I will fling an enormous rock at your head. Link to comment Share on other sites More sharing options...
Valik Posted November 16, 2004 Share Posted November 16, 2004 AutoIt is a Windows application. It does not have a console. Thus, there is no console associated with AutoIt. AutoIt does have a stdout handle which can be written to (Which is what this function does). It, however, is not possible for a console to retrieve this information any more than its possible for AutoIt to send information to it. If AutoIt were a console application, then it could, but its not, its a Windows program, so it can't. It cares not whether the application was launched from Explorer, the Run Dialog, a Windows API function directly in a third-party application or a Console window. Its all the same to a Windows application. The same holds true for a console; it doesn't care what actual subsystem the application its running uses. If its a console application, good, that means things will be set up correctly so that the application can talk to the console. If not, the console doesn't really care. Link to comment Share on other sites More sharing options...
majnet Posted November 16, 2004 Author Share Posted November 16, 2004 (edited) Ok, I try explain what I'm doing and why is it problem, when standard output buffers. I try to use PSFTP, the PUTTY SFTP client, for automatically transfering files to the server. This client is operated from standard input with its commands. My script should catch hot key Ctrl+S, which I use to save files, then find out changed files and send the commands to SFTP klient. I try do something like this: AutoIt3.exe myScript.au3 | psftp.exe <params_for_coneting_to_server> The script is runing as background application. It write the command to the standard output for the SFTP client, when I'm saving the file. However, when the output is buffers, SFTP client read out the commands after end my script Edited November 16, 2004 by majnet Link to comment Share on other sites More sharing options...
SlimShady Posted November 16, 2004 Share Posted November 16, 2004 Change AutoIt3.exe myScript.au3 | psftp.exe <params_for_coneting_to_server> To %COMSPEC% /C AutoIt3.exe myScript.au3 | psftp.exe <params_for_coneting_to_server> Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2004 Developers Share Posted November 16, 2004 (edited) Ok, I try explain what I'm doing and why is it problem, when standard output buffers.The script is runing as background application. It write the command to the standard output for the SFTP client, when I'm saving the file.However, when the output is buffers, SFTP client read out the commands after end my script <{POST_SNAPBACK}>why not have your AutoIt script write the info to a file and then run SFTP in your script to transfer the file ? Edited November 16, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
majnet Posted November 16, 2004 Author Share Posted November 16, 2004 ChangeAutoIt3.exe myScript.au3 | psftp.exe <params_for_coneting_to_server>To%COMSPEC% /C AutoIt3.exe myScript.au3 | psftp.exe <params_for_coneting_to_server><{POST_SNAPBACK}>I think it's the same. First code is good to write to the command line and second is for Run function in script. I used the second code in my script also. But it's not solution for my problem.why not have your AutoIt script write the info to a file and then run SFTP in your script to transfer the file ?<{POST_SNAPBACK}>More easily would be start te the sctript every time when I need.Buth the connection to the server will have slower speed do this every time.Anyway I can do it this way. Link to comment Share on other sites More sharing options...
Valik Posted November 16, 2004 Share Posted November 16, 2004 I was under the impression that piping data first ran application A and then piped the results to application B once application A terminated, not that application A pipes data to application B while application A is running. What that means is, this isn't any buffering issue or anything like that, its the way the command interpreter works. Link to comment Share on other sites More sharing options...
majnet Posted November 17, 2004 Author Share Posted November 17, 2004 What that means is, this isn't any buffering issue or anything like that, its the way the command interpreter works.<{POST_SNAPBACK}>I don't know how is AutoIt implemented, but in C programs I can call fllush(stdout) and the output buffer is then emptied. And this wokrs when it's piping too.Is it really no go somethin like fllush(stdout) make in AutoIt? Link to comment Share on other sites More sharing options...
faldo Posted November 17, 2004 Share Posted November 17, 2004 Could someone plz explain what "pipe" means? maybe give an example? ...sound interesting. Check out my other scripts: RDP antihammer/blacklist generator | Phemex cryptocurrency exchange API Link to comment Share on other sites More sharing options...
Valik Posted November 17, 2004 Share Posted November 17, 2004 I don't know how is AutoIt implemented, but in C programs I can call fllush(stdout) and the output buffer is then emptied. And this wokrs when it's piping too.Is it really no go somethin like fllush(stdout) make in AutoIt?<{POST_SNAPBACK}>I could add an implicit call to fflush(stdout) to the function, I guess. All it is is a very simple printf() wrapper.Jon, I don't really see the point in me sending you anything over one line of code, so I'll just mention here, the next time you update can you add a fflush() after printf() in ConsoleWrite() to try to eliminate this problem? Link to comment Share on other sites More sharing options...
Administrators Jon Posted November 20, 2004 Administrators Share Posted November 20, 2004 Jon, I don't really see the point in me sending you anything over one line of code, so I'll just mention here, the next time you update can you add a fflush() after printf() in ConsoleWrite() to try to eliminate this problem?Added for next upload. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted November 20, 2004 Share Posted November 20, 2004 Added for next upload.<{POST_SNAPBACK}>Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now