Jump to content

DOS Program HELP!


Jo M
 Share

Recommended Posts

Hi,

I am very new to AutoIT (today!)

I wanted to use AutoIT to take data from a DOS Program I have, edit it within TextPAD with a macro I have that already works so that it can then be copied and pasted directly for analysis within EXCEL. This needs doing many times and AutoIT should save me getting RSI!

All I need to do with the DOS program is to send it a series of keystokes, with delays inbetween some for the program to "work". AutoIT Window Info showed me the Windows name but when I used it in the script I got an Error "Error:Unknown function name". I noticed that Task Manager shows the actual process name as "ntvdm.exe" (from the System 32 Folder, I am running Windows XP Pro) I tried the script with this instead but got the Error "Error:Unable to parse line"

I have searched the help file for some good while and can find nothing relevant. The only help seems to be for simple DOS commands with switches etc, NOT for DOS programs that require input and give output.

I hope someone out there can help. Regards Jo M

Edited by Jo M
Link to comment
Share on other sites

Look at the beta version of autoit.

Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Parameters

filename The name of the executable (EXE, BAT, COM, or PIF) to run.

workingdir [optional] The working directory.

flag [optional] The "show" flag of the executed program:

@SW_HIDE = Hidden window

@SW_MINIMIZE = Minimized window

@SW_MAXIMIZE = Maximized window

standard_i/o_flag [optional] Provide a meaningful handle to one or more STD I/O streams of the child process.

1 ($STDIN_CHILD) = Provide a handle to the child's STDIN stream

2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream

4 ($STDERR_CHILD) = Provide a handle to the child's STDERR stream

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

Look at the beta version of autoit.

I don't see how this helps me?

I'm already running the program (as it needs a little setting up which can't be written into the script) I'm trying to switch to it using GUISwitch ("Program Name"). I just discovered that since the name has spaces in it I have to use quotes to enclose it for it to work. That's OK DOS works like that. However a new problem has surfaced!

Now the script proceeds, but only once I click on the DOS window manually!!! I'm now wondering if the GUISwitch fuction only works for GUI Programs i.e. NOT FOR DOS???

Any ideas anyone? Regards Jo M

Link to comment
Share on other sites

LOL ROFL. Sorry, but I can't begin to tell you of all your mistakes and errors. Here are a few:

#1. Autoit cannot interact with dos programs unless it launches it directly, and only using the standard_i/o_flag

#2. GuiSwitch is not for a window, it is not for a dos program, it is not for anything except the autoit GUI that is why the name of the function begins with GUI.

#3. "Unknown function name" means that you are just typing the name of the window in without using it in a function.

You really seriously need to sit down for a while with the examples first, then look at the code behind them. Then before asking again, look at the helpfile and see if you can figure it out for yourself.

I am definately not trying to be rude, but you haven't even shown that you have read the helpfile, much less have enough "beginners knowlege" to even start this script. The reason you have so many errors is that you are trying to run before you can walk.

Invest the time to learn this language correctly before trying to jump in the deep end. We are (almost) all glad to help those in need of a little push in the right direction, but you need to show some initiative yourself.

Happy reading!

Who else would I be?
Link to comment
Share on other sites

I have entered the "standard_i/o_flag", into the help file and the result was, guess what "No Topics Found".

It is certainly strange that you claim that I have not used the help file!!

Why not tell me how to USE this "standard_i/o_flag" instead of just going on about how I don't know about it! Sure I don't know about it. That's why I'm asking.......DOOOH!

Regards Jo M

Edited by Jo M
Link to comment
Share on other sites

instead of asking (more like demanding) you should read the helpfile again.

i suggest you read a few posts back and see that he was talking about the RUN command.

@this-is-me

no, i dont, hes talking jibirish.

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

LOL ROFL. Sorry, but I can't begin to tell you of all your mistakes and errors. Here are a few:

#1. Autoit cannot interact with dos programs unless it launches it directly, and only using the standard_i/o_flag

#2. GuiSwitch is not for a window, it is not for a dos program, it is not for anything except the autoit GUI that is why the name of the function begins with GUI.

#3. "Unknown function name" means that you are just typing the name of the window in without using it in a function.

You really seriously need to sit down for a while with the examples first, then look at the code behind them. Then before asking again, look at the helpfile and see if you can figure it out for yourself.

I am definately not trying to be rude, but you haven't even shown that you have read the helpfile, much less have enough "beginners knowlege" to even start this script. The reason you have so many errors is that you are trying to run before you can walk.

Invest the time to learn this language correctly before trying to jump in the deep end. We are (almost) all glad to help those in need of a little push in the right direction, but you need to show some initiative yourself.

Happy reading!

I HAVE managed to get AutoIT to interact with my DOS program!!!!

My remaining problem is with the GUISwitch ("Program") function. So far I cannot get it to actually switch from the one program to the other. I am having to manually select the program then the script proceeds fine. I have since my last post found that this is NOT a problem with DOS but with all three of the programs involved. The DOS program, TextPad and Excel.

To give a specific example when trying to switch to TextPad I used the following code.

GUISwitch ("TextPad - [L:\E.TXT]")

WinWaitActive("TextPad - [L:\E.TXT]")

I added the WinWaitActive part as it didn't work and I thought it might need little time. Still not working. Rather than saying that I'm doing so many things wrong. This is the only part of my script which is not know working. Have you any ideas on this?

Regards Jo M

Link to comment
Share on other sites

do you mean WinActivate ?

Hi, Yes it seems that it was WinActivate that I needed. It works for my DOS Prog and for Excel but TextPad is still being very difficult and requiring a manual click on it to allow the script to proceed!

Very strange! Any ideas?

Regards Jo M

Link to comment
Share on other sites

It seems that you have not listened to what I said anyway, so why try to talk to you. You don't have the beta and you don't have the beta helpfile so you don't have a standard_i/o_flag. Also, if you don't start listening to the help that those who are experienced in the language are giving you, you won't be getting help at all.

Now that I have let out a little steam, if you really want to get your script working, I suggest that you STOP, reread my posts, follow the instructions I have given, and then if you are still stuck we will be happy to answer your questions.

EDIT: Would you please also explain to me what you mean by

it needs a little setting up which can't be written into the script

What you wanted (I assume from your description of the problem) is for autoit to read the text output from the dos program you have and then for autoit to react to this with another command. Is this correct?

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

Jo M,

Sorry for your moderately shitty welcome to the AutoIt community.

In the current version of the AutoIt3 beta release A.K.A. 3.1.1++ there has been modification of the Run function and the addition of a group of functions that can read the console output (both messages and error messages, if your console app distinguishes between the two) of "DOS" apps into AutoIt string data, which can be assigned to variables or whatever. There is also functionality for providing input to apps that can understand "piped" input.

However, I don't know if any of this is what you need.

The functions that I'm describing are good for DOS apps that direct their output to the screen, like DIR or IPCONFIG or whatever. Judging by the title of your app's window it sends its output to a file rather than the screen, am I correct?

In any case, correct or not, can you give an example of a common DOS app that works most like your app? e.g. FTP, EDIT.COM, TinyFugue, something like that...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

To give a specific example when trying to switch to TextPad I used the following code.

GUISwitch ("TextPad - [L:\E.TXT]")

WinWaitActive("TextPad - [L:\E.TXT]")

I added the WinWaitActive part as it didn't work and I thought it might need little time. Still not working. Rather than saying that I'm doing so many things wrong. This is the only part of my script which is not know working. Have you any ideas on this?

your kidding right???

he didn't say you had to ADD WinWaitActive.

if you want to activate a window then Winactive it don't use GUISwitch AT ALL

WinActivate ( "title" [, "text"] ) <--- see ?? so it just should be: WinActivate ( "TextPad - [L:\E.TXT]" )

it might be handy to change the WinTitleMatchMode to 2, so you don't have to know the WHOLE title, just TextPad would be fine then.

also you MUST have the latest autoit to use that i/o functions

i hope this was of help

greetings zeroZshadow, The RTFM master ;)

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

I Think you need to activate the DOS window before you use the Send function with WninActivate()

Thanks GioVit, your idea (and wOuter's) were the simple ideas that actually worked.

I have used WinActivate successfully now in the script and got it all working! My last problem with TextPAD was my own problem. As my DOS program was writing to the text file on each run through the loop there was a dialogue box about re-loading the file! Once I seperated the {ENTER} and pointed it correctly to the dialogue box it all started working a dream!!!

In just three hours I have just done 21 runs of the script. Previously I could only do a maximum of two of these analysis a day (to avoid RSI!)

Yes DaveF, I have had a moderaltely shitty introduction to AutoIT's Forum! But not your fault. "this-is-me" has repeatedly given the wrong advice and in a really nasty unhelpful way!

AutoIT does it would seem work with DOS Programs!

WinActivate was what I needed!

I had read quite a bit of the helpfile before posting here!

I have made some mistakes, and I didn't know quite a lot - but I did listen to those who bothered to try to help. As a result in less than 24 hours I have my script up and working a dream. Thanks to those of you who helped!

I never made any "demands" for help. Posting here was just a way of "asking" for help. Look back at my posts! Do you see any words that make any demands?

It would seem that some people just want to bask in their own glory and putting other people down seems to be their only way of feeling good about themselves? That's just SAD!

Regards to all (bar "this-is-me") : Jo M

Link to comment
Share on other sites

man thats rude, this-is-me gave VERY good advice.. you just didn't listen and flamed him without thinking.

ur just dumb enough no think your smart ;)

see ya n00b

@this-is-me:

don't u agree ?

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

@Jo M, make it seem as though I am a villian. I am not. I gave you sound advice that if followed would have resulted in your script being much more refined and performing the job it currently does in much less time and with much less effort. If you doubt me, just look at the post counts. With the exception of larry, there is no other person in this thread who has had more experience on these messageboards than I. When I attempted to help you "get the ball rolling" by pointing out the mistakes you could correct, you promptly began to insult my intelligence and communication skills. You realised later that at least some of my advice was correct (see GuiSwitch), and yet you still continued to act as though I was no person to listen to. I was not attempting to be rude to you (as I stated in my second post) until I was met with an idea that whatever I said was wrong, and you rejected any idea I proposed wholeheartedly. If my assumption is correct, even this paragraph will have no effect on you and you will continue to go along in your incorrect assumption that the way you created your script was the best way. One day, probably a long time from now, you will see that the information I gave you was correct and you will remember this conversation. In the mean time, all I ask for you to do is to listen to those with more experience than you.

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

When I attempted to help you "get the ball rolling" by pointing out the mistakes you could correct, you promptly began to insult my intelligence and communication skills.

Just LOOK at the content of the posts in this thread and the order of them and anybody can see that I was politely asking of help, making a few mistakes and correcting them until YOU started getting very rude. I even reported your post at the time! I don't care about your experience. There is no excuse for your rudeness!

When I complain about your rudeness and unwillingness to actually help rather than criticise. I get called again!

The speed of my script is largely a function of the rather enormous amount of number crunching that is going on! Plus the "waits" I have put in to allow the program to do its several stages without complaining with a "bleep". Then there is my AV and Anti Trojan Setup! I am currently experimenting with reducing the "waits" until I get it running as fast as may be.

Yes you said that GuiSwitch was wrong. But you refused to explain how to implement your ideas! Look back at you post to see! Now that I have successfully used OTHER peoples ideas in this thread to solve my problem you have to claim that "your way would have been better".

Since you have NEVER PROPERLY EXPLAINED HOW YOUR IDEA COULD BE IMPLEMENTED I think that that is really really RICH!

DISGUSTED Jo M

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...