Sign in to follow this  
Followers 0
leuce

How to run piped DOS programs

6 posts in this topic

G'day everyone

I'm trying to let AutoIt execute three programs in a DOS console. I can't seem to figure out the syntax for it, though.

Basically, there are three programs called cut.exe, diff.exe and grep.exe, all in the same folder. I also have files named WSpel.txt and ClipB.txt in that same folder. Without AutoIt, I would use a DOS window and type the following:

diff.exe WSpel.txt ClipB.txt | grep.exe ">" | cut.exe -d" " -f2 > Typos.txt

This would produce a file called Typos.txt with some content in it.

I'd like AutoIt to execute that line for me, in the background, as fast as possible (so opening a DOS window and using "Send" is the last resort here). I was hoping to use Run or RunWait, but it doesn't seem to execute the line. I've tried the following two options, neither of which works:

RunWait ("C:\Kastrool\diff.exe WSpel.txt ClipB.txt | grep.exe "">"" | cut.exe -d"" "" -f2 > Typos.txt", "", @SW_HIDE)

RunWait(@ComSpec & " /c " & "C:\Kastrool\diff.exe WSpel.txt ClipB.txt | grep.exe "">"" | cut.exe -d"" "" -f2 > Typos.txt", "", @SW_HIDE)

Can anyone tell me what the correct syntax is?

Thanks!

Share this post


Link to post
Share on other sites



i dont have the exact answer..

but you can check the "out come" of you line with a messgae box

$String = "C:\Kastrool\diff.exe WSpel.txt ClipB.txt | C:\Kastrool\grep.exe "">"" | C:\Kastrool\cut.exe -d"" "" -f2 > Typos.txt"

MsgBox(0,"", $String)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I'd like AutoIt to execute that line for me, in the background, as fast as possible (so opening a DOS window and using "Send" is the last resort here).

Actually, I have in the past used "Send". What I did was to create a batch file named a.bat and put the DOS stuff in it, and then just send A and ENTER. Can I do it faster and better, though?

Share this post


Link to post
Share on other sites

Try this:

RunWait(@ComSpec & ' /c C:\Kastrool\diff.exe WSpel.txt ClipB.txt | grep.exe ">" | cut.exe -d" " -f2 > Typos.txt', 'C:\Kastrool', @SW_HIDE)

Share this post


Link to post
Share on other sites

look up the run function in the beta help. the help file is located here most likely.

c:\program Files\AutoIt3\beta\AutoIt.chm

in there is the standard_i/o_flag. in my Send/Check Email using SSL/TLS; POP3 & SMTP project i use the beta run to do it. look at my V2 code.

Good Luck!

Share this post


Link to post
Share on other sites

I'm trying to let AutoIt execute three programs in a DOS console.

Thanks for everyone helping out (I've used MHz's syntax eventually). Not that this is likely to be useful, but in the spirit of sharing scripts, here is the completed script for which I wanted to know the original question. Besides the script, you'll also need a spelling dictionary in plaintext (one word per line) called WSpel.txt and the three UnxUtils tools mentioned. The UnxUtils web site is http://unxutils.sourceforge.net/.

The script is uploaded. The UnxUtils isn't uploaded because I don't have their sources to upload as well.

kastrool1.au3

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