mikelee33 Posted January 26, 2009 Posted January 26, 2009 I simply can not get the syntax correct to utilize '&&' in the following line: RunWait (@comspec & ' /k ' &$prog &' '&$option&' '&GUICtrlRead($file)''&&'echo Finished!') I think I'm close, but I'm not certain. Many thanks for any direction. Mike
KaFu Posted January 26, 2009 Posted January 26, 2009 You're trying to issue multiple commands to @comspec, right? Never got that working this way. The only way I succeeded was like shown in my Example 'Pipe to @ComSpec'. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
rasim Posted January 26, 2009 Posted January 26, 2009 (edited) Try this: RunWait(@ComSpec & ' /k ' & $prog & ' ' & $option & ' ' & GUICtrlRead($file) & ' & & echo Finished!') Edited January 26, 2009 by rasim
rasim Posted January 26, 2009 Posted January 26, 2009 Never got that working this way.Below code also not work for you? RunWait(@ComSpec & " /k dir /b c: && Echo. && Echo finished")
Inverted Posted January 26, 2009 Posted January 26, 2009 Below code also not work for you? RunWait(@ComSpec & " /k dir /b c: && Echo. && Echo finished")This works great, nicely done !
KaFu Posted January 26, 2009 Posted January 26, 2009 (edited) Below code also not work for you? RunWait(@ComSpec & " /k dir /b c: && Echo. && Echo finished") Yeah, you're right , works for me this way. Forgot that he's running it without pipes. What didn't work for me was piping several commands to stdout using one instance of @comspec that way (e.g. to chcp): #include <Constants.au3> $foo = Run(@ComSpec & " /k dir /b c: && Echo. && Echo finished", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) $line = "" While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend MsgBox(0,"","Finished" & @crlf & @crlf & @crlf & $line) $foo = Run(@ComSpec, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo, "dir /b c:" & @CRLF) StdinWrite($foo, "echo. Echo finished" & @CRLF) StdinWrite($foo, "exit" & @CRLF); send exit command to trigger stdout $line = "" While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend MsgBox(0,"","Finished" & @crlf & @crlf & @crlf & $line) Edited January 26, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
mikelee33 Posted January 26, 2009 Author Posted January 26, 2009 Try this: RunWait(@ComSpec & ' /k ' & $prog & ' ' & $option & ' ' & GUICtrlRead($file) & ' & & echo Finished!') Sorry, no, that didn't work for me. The first command executed, but not the echo. Your second example: RunWait(@ComSpec & " /k dir /b c: && Echo. && Echo finished") does work as you've written it but when I apply that approach it didn't work. Might it be how the first program terminates that causes an issue with how the second executes?
rasim Posted January 27, 2009 Posted January 27, 2009 @KaFuYour first example contain error, you not indicate a working directory @mikelee33Sorry, no, that didn't work for me. The first command executed, but not the echo.Your second example: RunWait(@ComSpec & " /k dir /b c: && Echo. && Echo finished") does work as you've written it but when I apply that approach it didn't work. Might it be how the first program terminates that causes an issue with how the second executes?Meaning:Command1 && Command2; Run second command if first command executed successfully Command1 || Command2; Run second command if first command executed unsuccessfully
KaFu Posted January 27, 2009 Posted January 27, 2009 (edited) You're right... but you'll have also to append an Exit to trigger the stdout, then it works both ways, you'll live while you learn ... #include <Constants.au3> ; Example 1 $foo = Run(@ComSpec, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($foo, "dir /b c:" & @CRLF) StdinWrite($foo, "echo. Echo finished" & @CRLF) StdinWrite($foo, "exit" & @CRLF); send exit command to trigger stdout $line = "" While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend MsgBox(0,"","Finished" & @crlf & @crlf & @crlf & $line) ; Example 2 $foo = Run(@ComSpec & " /k dir /b c: && Echo. && Echo finished && Exit", 'c:\', @SW_HIDE, $STDOUT_CHILD) $line = "" While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend MsgBox(0,"","Finished" & @crlf & @crlf & @crlf & $line) (updated my example 'Pipe to @ComSpec') Best Regards Edited January 27, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
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