Jump to content
Sign in to follow this  

Selecting Text from a custom list.

Recommended Posts

Hi Everyone,

I am new to Autoit, and programming so please be patient. I have scoured the forums looking for a solution to my problem, but to no avail.

What I am trying to do is this:

I have an application which imports data into a database using the applications own import manager. However, there are many different databases in the same instance, and the Import Manager once activated connects to the last database the user connected to.

I am trying to write a script which will automate the connection to the correct database using the applications own forms / windows / controls. However, I get to a point where I open the available databases, but cannot make a selection in the list, the actual controls are not picked up, and using the string reference doesn't seem to work, or I am doing it wrong, which is more likely. 

My code so far:

#cs ----------------------------------------------------------------------------

 AutoIt Version:
 Author:         CJ Myburgh

 Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

AutoItSetOption ("TrayIconDebug", 1)

Run("C:\Program Files (x86)\SmartPlant\Electrical\Program\SPELImportManager.exe")
   Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
   WinWaitActive("SmartPlant Electrical Import Manager -")

WinMenuSelectItem("SmartPlant Electrical Import Manager -","","&File","&Open","Plant &Group...")
   WinWaitActive("Open Plant Group")

ControlClick("Open Plant Group","","&Select Plant...")

ControlSend("Open Plant Structure -","","[CLASS:TreeView20WndClass]","10071")

It's at the final ControlSend script where I am not succeeding. I am using Control Viewer but the only Control that I can identify is the actual list box, and not the selections themselves.


Any advice will be greatly appreciated. 

Share this post

Link to post
Share on other sites

Hi John,

Yes, I can use arrow keys to make the selection and Enter / Return to select... However, the active selection is dependent on which of the plants were last logged in to. So it wouldn't always be the same key strokes to access the same plant database.  


Share this post

Link to post
Share on other sites

Okay, so I can get it to work using the keystroke method. I overrun the UP arrow to get to the root, at which point I can then consistently count to the project database I want and send ENTER. 

Obviously this is not the most graceful approach, but it works. 

Thanks John. 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...