Jump to content

Automating Project Documentation Build


Recommended Posts

AutoIT Experts,

I'm attempting to use AutoIT to (what else?) automate the generation of project release documentation from other Windows-based software tools. I run pre-defined reports with CA's ERwin data modeler, load the data into an Oracle database, then use a series of SQL queries to generate ASCII-delimited data files which will be loaded into pre-formatted Excel spreadsheets. The manual process is time consuming, subject to all manner of user error, and tedious.

I've taken the baby steps of being able to start ERwin and log into the Oracle database (we've got the Model Manager version of ERwin which uses Oracle as its data repository for the data model's data). But now I'd need a more precise way of selecting a known named item from a list, in this case my current data model name. How do I do this?

For example, if there's a subwindow named "Data Model List," which looks like this:

==========

| Datamodel 1 |

| Datamodel 2 |

| Datamodel 3 |

==========

-- and I know that I want "Datamodel 2", I can do it in some such braindead way:

WinActivate("Data Model List")

send("{DOWN 2}"}

send("{ENTER}")

I'd rather use a more dynamic approach in which I somehow send the string "Datamodel 2". But to what? and how? I'm not familiar enough with AutoIT to know how to do this, or even if it's possible. Can anyone show me the dynamic code that says, "Select the item which is named 'Datamodel2'"?

Link to comment
Share on other sites

Welcome to the forums.

Read up on ControlCommand and hope that your app will respond to them.

ControlCommand("WindowTitle", "WindowText", "ListBox1", "SelectString", "Datamodel 2")oÝ÷ Øíz¼¨¹«$ëh"Ûh±é^rÛazX§zâ׫zËr¢çëjëh×6ControlCommand("WindowTitle", "WindowText", "ListBox1", "GetCurrentSelection", "") <> "Datamodel 2" Then ...opps
to double check the selection.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Thank you for the reply.

Unfortunately, regardless of how I attempt to reference the control -- by ID, or using any of the other references (class, instance, etc.) --

I can't get the control to respond. Here's what I've attempted to use:

If ControlCommand("Open", "", 30270, "SelectString", $DMName) then

OR:

If ControlCommand("Open", "AllFusion MM Libraries", "[CLASS:SysListView32; INSTANCE:1]", "SelectString", "JPMIS_CBRN_Data_Model_1-7_03-14-08") then

Is there a definitive way to check for sure that the control simply doesn't respond? I've found that on occasion it's the lint in my own navel, and after I correct my syntax, it works just fine.

Meanwhile, the braindead technique of using a series of non-dynamic SENDs works.

Link to comment
Share on other sites

...Is there a definitive way to check for sure that the control simply doesn't respond?...

Not that I know of.

I have an app that does not respond to SelectString - but does work with GetCurrentSelection... so I do/controlsend down/until GetCurrentSelection = whatIwant

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Thank you for further direction -- I've been able to make more progress.

My next stumbling block is that the script seemingly continues execution without halting for the data modeling tool to load the correct data model file after sending an "ENTER" on locating the correct name in the list. Using some "wait" function e.g., WinWaitActive, doesn't seem to help. If I insert sleep(45000) immediately after the "ENTER", the file will load, but after it's loaded, I then need to wait the 45 seconds, too, strangely enough.

Is there a way to halt script execution (besides a sleep call) until an action is complete?

Link to comment
Share on other sites

...Is there a way to halt script execution (besides a sleep call) until an action is complete?

Open up one AutoIt Window Info tool.

Manually get to the point where the script would press ENTER.

Freeze the AutoIt Window Info tool via Ctrl-Alt-F

Manually press ENTER on the app of interest.

Wait until the data has loaded.

Start a second instance of the AutoIt Window Info tool.

Place the second instance of the AutoIt Window Info tool over the app of interest and freeze the tool via the menu tool bar.

(Options > Freeze)

Compare the info in the two tools and hope that you find some window text change that can help in a WinWait line of code. If not, then maybe a the item selected in your ListView loses focus once the data loads - you could do/sleep/until ControlListView - GetSelected = ""

...grasping at straws...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Open up one AutoIt Window Info tool.

Manually get to the point where the script would press ENTER.

Freeze the AutoIt Window Info tool via Ctrl-Alt-F

Manually press ENTER on the app of interest.

Wait until the data has loaded.

Start a second instance of the AutoIt Window Info tool.

Place the second instance of the AutoIt Window Info tool over the app of interest and freeze the tool via the menu tool bar.

(Options > Freeze)

Compare the info in the two tools and hope that you find some window text change that can help in a WinWait line of code. If not, then maybe a the item selected in your ListView loses focus once the data loads - you could do/sleep/until ControlListView - GetSelected = ""

...grasping at straws...

I'm grasping pretty good, too.

But now that I have the script to run ERwin reports functional, I need to find a way to execute it like a Unix process "in the background" to preclude inadvertent user error or interruption. Does this even have any meaning for a Windows GUI-based application? If so, how can it be done?

Link to comment
Share on other sites

...But now that I have the script to run ERwin reports functional,...

Good to hear.

...preclude inadvertent user error or interruption...

The simplest method, but sometimes least desirable, is BlockInput.

Others have tried a full screen Splash text or image screen to make it obvious that the user should leave things alone for the duration of the script.

Then there is the whole WinSetState to hidden realm.

I run some scripts inside a Virtual Machine. That allows me to do other things while the script runs for hours. This is not exactly a method that I would suggest for a script that is to be distributed to others, but it works well for me.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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