Jump to content

Recommended Posts

Posted

I have a general question about approach to solve a particular problem - I am using AutoIt to do some validation of applications on virtual machines, and it is working really well. I have a particular issue that I am running into and am hoping to see if anyone has thoughts on the right approach to solve this.

I have cases (the example I'll give here is with Powerpoint) - I have a script that starts Powerpoint, and then loads a very large document. I want to validate that the whole document is loaded and that the document contains a particular string at the end. I also want to be able to detect that the search for the string was successfully found.

The way that I am validating that the application is working properly, and that the document is loaded correctly, is the following:

- Start powerpoint

- Use WinWaitActive to wait for the application

- send alt-f, o to bring up the open dialog

- send the filename desired and alt-o to open

- send ctrl-f to find

- send the text on the last slide of the powerpoint

- (this is how I validate if it found the text - I send {ESC}, then check to see if the "Find" window is still present - if the text is found, it just highlights it, and when the ESC is sent, the find window is closed. If the text isn't found, it generates a dialog window, and the ESC dismisses that, but the "Find" window is still there. By checking for presence or absence of the "Find" window, I can determine if the text was found.)

Now, this works great for smaller documents - everything runs quickly, and I clearly get the correct status from the validation sequence I describe. For the large document, though, I have a general issue - the find is fired before the document is completely loaded - so it doesn't find it in the part of the document that is loaded. I could solve this by putting a reasonable sleep before I try the find, but I am not only using the script to validate that the find worked, but also to get a general measure of performance, how quickly the document loads. If I add a sleep to solve the find problem, I will negate the ability to get measurements of how quickly the document loads.

I am open to other suggestions on how to validate that the document completely and properly loaded - or if anyone has suggestions on how to accomplish what I describe above.

Thanks in advance for any ideas/suggestions!

-Ed

Posted

COM would probably be the best way to tackle this... it is a deep subject, but there is an example of opening a presentation that should not return control to your script until the file is fully open. There are many ways in COM to do the other checks you are trying to make. Google: PowerPoint Object Model MSDN

$oPPT = ObjCreate("Powerpoint.Application")
$oPPT.visible = True
$oPPT.Presentations.Open("C:\IntroducingPowerPoint2007.pptx")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Posted

COM would probably be the best way to tackle this... it is a deep subject, but there is an example of opening a presentation that should not return control to your script until the file is fully open. There are many ways in COM to do the other checks you are trying to make. Google: PowerPoint Object Model MSDN

$oPPT = ObjCreate("Powerpoint.Application")
$oPPT.visible = True
$oPPT.Presentations.Open("C:\IntroducingPowerPoint2007.pptx")

Dale

Ah, good suggestion. I hadn't been thinking about it at that level, that makes sense. I will give that a shot and see how it works for me. That certainly gives me more flexibility.

Thanks!

-Ed

Posted

Hi,

while MouseGetCursor()=1 or MouseGetCursor()=15    ;if the mousecursor has the "hourglass"-style than the application is busy
wend
but i dont know if this will work in any program....

Andy

Thanks, a good suggestion and may work for me in some of the other applications that I need to test - I don't think it will handle the powerpoint case though - it seems that it does the loading in the background and keeps the mouse pointer a regular pointer in the process. I know that some of the other apps leave the hourglass while it is loading, so it will work for those.

Thanks!

-Ed

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...