Jump to content

Autoit help needed


Recommended Posts

Hi ,

I am new to Autoit. I just downloaded and installed it. I just wrote a small script to make it automate.

While running this script its sometimes saying that "RUNCLOSENOdm.prg" not found and some times saying that ecm.prg not found. means that it is taking e from "ope" and making cm.prg as ecm.prg. I want you to help me regarding this issues. I have a total of 25 files which I need to make them automate so that it saves my time.

Below is the program that I wrote. Please have a look at that and help me. Any suggestions are accepted.

Run("C:\Program Files\blah.exe")

WinWaitActive("Welcome to blah")

Send("O")

Send("C C:\Users\eSpace\Desktop\Studies\New\prg")

Send("{ENTER}")

Send("ae.prg")

Send("{ENTER}")

Send("{ALT}+F")

Send("RUN")

WinWait("dfPower")

Send("{ALT}+F")

Send("CLOSE")

Send("NO")

WinWaitActive("dfPower")

Send("{ALT}+F")

Send("Ope")

Send("cm.prg")

Send("{ENTER}")

Send("{ALT}+F")

Send("RUN")

WinWait("dfPower")

Send("{ALT}+F")

Send("CLOSE")

Send("NO")

WinWaitActive("dfPower")

Send("{ALT}+F")

Send("Ope")

Send("dm.prg")

Send("{ENTER}")

Send("{ALT}+F")

Send("RUN")

WinWait("dfPower")

Send("{ALT}+F")

Send("CLOSE")

Send("NO")

WinWaitActive("dfPower")

Send("{ALT}+F")

Send("Ope")

Send("ds.prg")

Send("{ENTER}")

Send("{ALT}+F")

Send("RUN")

WinWait("dfPower")

Send("{ALT}+F")

Send("CLOSE")

Send("NO")

Please help me.

And i am attaching two different files that i wrote the script. Please have a look at them.

Can we use function in Autoit, so that i can reduce the size of my script. What i need to do is I need to open the file run the file and close the filewithout saving so i am sending "NO" and open next file run and close without saving. I need to do this for 25 files everyday.

Arun

new1.au3

new2.au3

Link to comment
Share on other sites

First, post your code in [code][/code] tags.

Secondly, put a short sleep between your Send() functions if things are going too fast for the app:

Send("Ope")
Sleep(100)
Send("cm.prg")

If you don't do that AutoIt will execute next send within a couple milliseconds of the previous one.

To avoid having dozens of Sleep() functions, you could wrap it in a function of your own like this:

_Send("Ope")
_Send("cm.prg")

Func _Sleep($sText, $iWait = 100)
    Send($sText)
    Sleep($iWait)
EndFunc

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi PsaltyDS,

Thank you for your quick reply.

I tried to put sleep(100) after every Send() function. The same error occurs if I am giving more than 3 files. Before also the same error occurs. Ca you write a simple script for this that uses the functions. When I include more than 3 files its giving me the error like "RUNCLOSENOOpds.prg" not found. Attached is the updated and modified script. For every file only the name of the file changes in Open(ae.prg). Instead of ae there will be someother names for the remaining files. I want to run all the 25 files at a time.

At the time of running the file it takes more time so i included Sleep(1000) at that place.

Please help me. If you want i can give the script for all 25 files. I prepared a script for all the 25 files also. But I am executing one by one to know where the error occurs. When I seperate the files an include 3 files in one Autoit file then all are running fine.

Arun

new1.au3

Link to comment
Share on other sites

First off, is "No" sent as a text string a valid answer to the window?

If you have 2 buttons on that window; One button says "Yes" and the other says "No" then I can almost guarantee that "No" is not valid as a response.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi GEOSoft,

Thanks for your quick reply.

Actually my application looks like this.

First when we execute the .exe file a window appears with four buttons. "Interactive", "Open Batch", "Skip", "Exit". By default the cursor is in Interactive button. So I am sending "Ope" to open a file. Then I send the name of the file as "ae.prg" and send enter to open the file. Then we need to go to file and hit Run. So i am sending "{ALT}+F" and then "RUN" to run the file. After running the file we need to close that file then it asks us to whether to save the file with "Yes" and "No" buttons. So I am sending "NO" to not to savr the file. Then opening another file so I am sending "{ALT}+F" and "Ope" to open the next file and the process continues for the files.

And one more question. Can we call another .au3 file in the existing .au3 file. If so can you please tell me the syntax.

I think you understood my problem. So any help is appreciated.

Arun

Link to comment
Share on other sites

As George was telling you, the text in a button is usually NOT the same thing as the hotkey for it. Most often, an "Open" button would be triggered by Send("!o"), which translates to Alt-o.

The way to find out is with the AutoIt Window Info Tool (AU3Info.exe). Use it to examine the buttons and see if the text is something like "&Open Batch". The ampersand "&" character precedes the actual hot key.

You could also improve the reliability and accuracy of your scripts by never using Send() if you can help it. Use ControlSend(), or for buttons ControlClick() is event better, because they allow you to target a specific window and control instead of blindly sending text to whatever happens to focus on the desktop.

The information you need to make that work well comes from the AU3Info tool.

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi PsaltyDS,

I used ControlSend() and ControlClick() but its not working. So can you please write a small program to the problem I have so that I will edit te filenames and run the script. First it needs to open an application (.exe). As soon as it open that .exe file it opens up the window with 4 buttons named "Interactive", Open Batch", "Skip", "Exit". By default the cursor is on "Interactive". Now I want to click on "Open Batch". So that one window opens up. Now we need to give the path of th file to open that specified file. Then we need to go to File--> Run. So the the opened file wlll RUN. While running one small window appears saying that "Processing" with Cancel Button. But I dont want to click on that button. As soon as the running is completed that window will automatically close. Now I need to open another file and go to File-->Run to run another file. This process needs to be repeated for 25 files.

So now can anyone please write a small script for running one or 2 files. Actually I wrote a small script and that is attached. Now I want to automate the whole process to execute all the 25 files. Actually you can edit the file that is attached. I want to automate the process because for every 2 days I need to run these files.

Any help is appreciated.

Arun

a.au3

Link to comment
Share on other sites

Hi all,

I have a small issue while writing a script to automate the process of runnign 25 files in which it has some button click events.

First it needs to open an application (.exe). As soon as it open that .exe file it opens up the window with 4 buttons named "Interactive", Open Batch", "Skip", "Exit". By default the cursor is on "Interactive". Now I want to click on "Open Batch". So that one window opens up. Now we need to give the path of th file to open that specified file. Then we need to go to File--> Run. So the the opened file wlll RUN. While running one small window appears saying that "Processing" with Cancel Button. But I dont want to click on that button. As soon as the running is completed that window will automatically close. Now I need to open another file and go to File-->Run to run another file. This process needs to be repeated for 25 files.

So now can anyone please write a small script for running one or 2 files. Actually I wrote a small script and that is attached. Now I want to automate the whole process to execute all the 25 files. Actually you can edit the file that is attached. I want to automate the process because for every 2 days I need to run these files.

Any help is appreciated.

a.au3

Link to comment
Share on other sites

Two spots where the problem occurs and both have the same signature to the problem.

Send("{ALT}+F")
 Send("RUN")
 WinWait("dfPower")
 Send("{ALT}+F")
 Send("CLOSE")
 Send("NO")
 WinWaitActive("dfPower")
 Send("{ALT}+F")
 Send("Ope")
 Send("dm.prg")

Gives "RUNCLOSENOdm.prg".

Then this one:

Send("{ALT}+F")
 Send("Ope")
 Send("cm.prg")

Gives "ecm.prg".

Note how 'Send("Ope")' is only sending the 'e' in both cases? This means that whatever (File menu?) 'Send("{ALT}+F")' is opening the 'O' and 'p' are acting as commands. For instance if Explorer is active 'Send("{ALT}+FO")' opens the file menu and selects the Open option. I have no clue what is actually active in your case and it can differs somewhat for ever program that might be active. For Explorer it can even depend of whether the is a selected file in the folder. The evidence suggest you have given indicate that 'Send("Ope")' is operating the file menu in some cases and what follows is not what you expect.

Perhaps changing your 'WinWait()' to 'WinWaitActive()' is the problem, as 'WinWait()' does not require the program to be active yet while 'Send()' does. But that is as far as I can take it with details of the app and controls on the window of that app.

I just noticed, there is no 'Send("{ALT}+F")'. It is 'Send("!F")'. Otherwise there is '{LALT}', '{RALT}', '{ALTDOWN}', and '{ALTUP}', but no '{ALT}'. So 'Send("{ALT}+F")' is useless.

Link to comment
Share on other sites

or maby WinMenuSelectItem() if its for standard win menu?

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

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