gamingmouse Posted September 26, 2009 Share Posted September 26, 2009 As is, the script below will open a console window for a split-second, and then close it. If I change which line is commented out, the console window opens and stays open, as I want. But I need to be able to write to StdIn, so I need to use the line with the 7 option. Why is it closing when I use that option? Thanks, Jonah #include <StaticConstants.au3> #include <Constants.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> $pid = Run(@ComSpec & ' /k', @WorkingDir,@SW_MAXIMIZE,7) ;$pid = Run(@ComSpec & ' /k', @WorkingDir,@SW_MAXIMIZE) Link to comment Share on other sites More sharing options...
TurionAltec Posted September 27, 2009 Share Posted September 27, 2009 The Window opens and stays open either way on my machine A flag of 7 means that Stdin and Stdout are going to be redirected to the script, so there's no sense even having the window visible. Observe this script. Output from the command prompt will be displayed in the message box. In the input box, enter the desired commands: "ipconfig", "dir *.exe", etc. $pid = Run(@ComSpec& ' /k', @WorkingDir, @SW_MAXIMIZE, 7) ;$pid = Run(@ComSpec & ' /k', @WorkingDir,@SW_MAXIMIZE) Dim $data While 1 Sleep(2000) $data = StdoutRead($pid) MsgBox(0, "", $data) $input = InputBox("Command", "Command") StdinWrite($pid, $input & @CRLF) WEnd Link to comment Share on other sites More sharing options...
gamingmouse Posted September 27, 2009 Author Share Posted September 27, 2009 Okay, makes sense. What I really want to do is use my autoit app from the command line. That is, I want my ConsoleWrite to be visible if I run my autoit application from the CL. Right now, they are not. They only show up if I run the program inside autoit editor. Link to comment Share on other sites More sharing options...
TurionAltec Posted September 27, 2009 Share Posted September 27, 2009 (edited) This is how far I got the last time I tried that: http://www.autoitscript.com/forum/index.php?showtopic=72563 Basically you can't make it an interactive console application Though Stdin and Stdout can be hooked up directly to other scripts. EDIT: I see you're talking about ConsoleWrite. That should work if your compile options are set to console. Edited September 27, 2009 by TurionAltec Link to comment Share on other sites More sharing options...
gamingmouse Posted September 27, 2009 Author Share Posted September 27, 2009 Yes, the compiler options worked! Now how can I make the default compiler shortcut from within the editor use that option? (I did it using the converter tool) Thanks! Link to comment Share on other sites More sharing options...
TurionAltec Posted September 27, 2009 Share Posted September 27, 2009 Yes, the compiler options worked! Now how can I make the default compiler shortcut from within the editor use that option? (I did it using the converter tool) Thanks! Put this line at the top of your script: #AutoIt3Wrapper_Change2CUI=y I accessed that by going Tools->compile Checking the "Create CUI" Then Save only, and it added that directive to the script. Link to comment Share on other sites More sharing options...
gamingmouse Posted September 27, 2009 Author Share Posted September 27, 2009 Hmm... Putting that line at the top of my script did not fix it. Also, if I go to Tools -> Compile, nothing pops up where I could add any options. It just compiles immediately. I'm using Version 1.77. Any ideas? Thanks, J Link to comment Share on other sites More sharing options...
TurionAltec Posted September 27, 2009 Share Posted September 27, 2009 Are you using the full version of Scite? http://www.autoitscript.com/autoit3/scite/downloads.shtml 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