Jump to content

Using Autoit to automate a task of executing multiple files from the GUI of a windows application


Recommended Posts

Hello,

 

This is what I am attempting to do - 

 

I have a software which takes in a bunch of values and gives corresponding results. The values can be saved in a text file with some other commands. The software runs this text file as a batch file and exports the results too.

 

Every time to execute the file I have to -

  • go to the software,
  • select a particular option from a sub-menu (Like "File" -> "Run as batch file",
  • I get a pop-up window which asks me to select the text file,
  • I then select the file
  • when I open the required file I get two more pop-up windows for which I just need to press "Ok". 

 

I have more than 200 files with different names - M(i)_S(m)_(n). Where (i), (m) and (n) are different integers. Based on the combination I get about 240 files equally distributed in two folders

 

How do I use Autoit to automate this task? Assuming I have a very basic understanding of programming (in C++ ).Any guidance would be appreciated. Thank you.

Link to comment
Share on other sites

You could start out by reading the help file, specially (RunWait, WinGetHandle, ControlSend), write a simple script to run the program and try to interact with the windows you get, post your code here if you face any problems and you will get all the help you need.

P.S: Welcome to the forums :)

Link to comment
Share on other sites

You could start out by reading the help file, specially (RunWait, WinGetHandle, ControlSend), write a simple script to run the program and try to interact with the windows you get, post your code here if you face any problems and you will get all the help you need.

P.S: Welcome to the forums :)

 

Thank you @Palestinian. Well based on your suggestions I looked around a lot. And I came up with the following -

#include <MsgBoxConstants.au3>
#include <WinAPISys.au3>
Example()

Func Example()

    Run("C:\Program Files (x86)\software name")

    WinWaitActive("Introduction")
    Send("!O")
    WinClose("Introduction")

    WinWaitActive("software - untitled")
    Send("!TF")
        Local $hWnd = WinWait("Open", "", 2)
        ControlSetText($hWnd ,"","Edit1","M1_S1_1_v")
        Send("!O")
        Send("{ENTER 2}")
EndFunc

 

Okay I know putting "software name" and "software - untitled" is n't really helpful but let's go with that.

So the steps that I encounter as of now are - 

  1. Open the software. A pop-up window shows up.
  2. Press Ok to open the software.
  3. Press alt+T and then alt+F to "click" the sub-menu. This opens up a dialog box wherein I have to select the needed File.
  4. I enter the name of the file in the "File Name" text box. 
  5. I press "Open"
  6. I press "Enter" for the two pop-ups.

The issues I have now - 

  • When I click on the sub-menu to open up the "Open Dialog Box" the folder that shows up is the folder I used last. How do I specify the folder when it opens? Like I said I have two folders and I can't merge them.
  • I need to be able to loop through all the files. How do I do this based on the file names. So I basically loop steps 3 to 6 while step 4 has different file names.

 

Thanks again!

Edited by sj90
Link to comment
Share on other sites

You could use preinstalled AutoIt Window Info that comes with AutoIt to recognize the controls inside the application so you can get the script to interact with them, if that doesn't work, you could try >IUIAutomation, regarding the files names you could use _FileListToArray and then search through for the ones you need.

Link to comment
Share on other sites

You could use preinstalled AutoIt Window Info that comes with AutoIt to recognize the controls inside the application so you can get the script to interact with them, if that doesn't work, you could try >IUIAutomation, regarding the files names you could use _FileListToArray and then search through for the ones you need.

 

I updated my previous post. Didn't realize you had already commented. And yes I am checking out _FileListToArray. Thanks again!

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