Jump to content

Recommended Posts

Posted

Hi

Pretty new to AutoIt but enjoying it so far, struggling with an install of the latest 0.9.9.2 beta of TVersity, my very basic script looks like this:

CODE
Run("setup_0_9_9_2.exe")

WinActivate("TVersity", "Media")

WinWaitActive("TVersity", "Media")

AutoItSetOption("SendKeyDelay", 400)

Send("{ENTER 3}")

WinActivate("TVersity","run")

WinWaitActive("TVersity","run")

Send("{LEFT}")

Send("{ENTER}")

WinActivate("TVersity","rebooting")

WinWaitActive("TVersity","rebooting")

Send("{ENTER}")

WinActivate("TVersity","Completing")

WinWaitActive("TVersity","Completing")

Send("{ENTER}")

but refuses to detect this window:

Posted Image

Any help would be appreciated, the window tool tells me I should be ok on the text and title match

Si

Posted

Welcome to the forum...

You took an interesting approach here:

AutoItSetOption("SendKeyDelay", 400)

Send("{ENTER 3}")

You will be sending ENTER 3 times about 400 milliseconds apart even if the window of interest is not present or ready to receive the ENTER.

You would be better off having a WinWaitActive line for each window that comes up during the install. It is also best to use "Window text" that is unique to the window of interest.

I tend to do a bit of over kill - I use a WinWait, WinActivate, WinWaitActive for each window... but that is just me.

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

Posted

You can also try using the au3Recorder 3.1 that is included in the full SciTe package. To start it in SciTe, use Alt+F6. Let it record how you do the install, then see the code. You may need to clean the code up a bit after you run the recorder, but it should save you a load of time.

Cool thanks will try that

Regarding the previous post, I had a WinActive then a WinWaitActivebefore the first {ENTER 3} though, I'm guessing you mised that?

Si

Posted

...Regarding the previous post, I had a WinActive then a WinWaitActivebefore the first {ENTER 3} though, I'm guessing you mised that?...

Nope, I did not miss that. :-)

I was suggesting that you add more of them - a set before each ENTER that you send... and maybe add WinWait before the WinActivate.

Here is my guess for what is happening with your code:

You start the exe with this

Run("setup_0_9_9_2.exe")

This next line of code executes milliseconds after the exe has launched...

...long before there is any window to for it to act on.

WinActivate("TVersity", "Media")

The script halts until a Window is active with that partial title and partial window text

WinWaitActive("TVersity", "Media")

You slow the rate at which all subsequent keys are sent

AutoItSetOption("SendKeyDelay", 400)

You send ENTER 3 times 400 milliseconds apart

Send("{ENTER 3}")

The first enter acts on the window that the script was waiting for in the WinWaitActive line of code. The other 2 ENTERS go somewhere. Maybe 400 milliseconds is enough to catch the next two screens - I was just suggesting sending one ENTER and then make the script wait for the next window without depending on a set amount of time between windows.

This next line of code executes milliseconds after the last ENTER was sent...

...maybe too soon...

...maybe no window to act on yet.

WinActivate("TVersity","run")

The script is back to waiting...

WinWaitActive("TVersity","run")

Use the recorder Volly suggested and you may find that it attempts to halt the script for each window.

Enjoy AutoIt.

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

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