Jump to content

ControlClick weirdness


 Share

Recommended Posts

I have a very simple script that works mostly well...but i've had some weird behaviors I'm hoping you can help with. This is my first time using AutoIt, but it seems very straightforward...

The problem is near the end...The very last dialog (code has "&Finish" in it), does not always fire...and the script seems to indicate it is still running. I think it's "waiting" for the window to become active, and I've double checked the code to make sure the window title and text is correct and has proper capitilization. (I copy/paste from AutoIT window tool).

What's weird, is sometimes it presses the button just fine...and sometimes doesn't...The app is an install program, and basically i'm just automating the "next" clicks and stuff. Very very straightforward.

The loop you see at the bottom is because sometimes the "next" button is not enabled when the window becomes active, so I put a slight delay in it.

Any help is appreciated.

======================

Run( "Z:\VMWARE\VMware Workstation 4.5\VMware-workstation-4.5.2-8848.exe")

WinWaitActive("VMware Workstation", "&Next >")

PressControl("VMware Workstation", "&Next >", 2317)

WinWaitActive("VMware Workstation", "Yes, I &accept the terms in the license agreement")

PressControl("VMware Workstation", "Yes, I &accept the terms in the license agreement", 2242)

PressControl("VMware Workstation", "&Next >", 2317)

WinWaitActive("VMware Workstation", "Destination Folder")

PressControl("VMware Workstation", "&Next >", 2317)

WinWaitActive("VMware Workstation", "&Install")

PressControl("VMware Workstation", "&Install", 2364)

WinWaitActive("VMware Workstation Installation")

PressControl("VMware Workstation Installation", "", 7)

WinWaitActive("Rename Virtual Disks")

PressControl("Rename Virtual Disks", "", 1002)

WinWaitActive("VMware Workstation", "User Name:")

PressControl("VMware Workstation", "", 865)

ControlSetText("VMware Workstation", "", 865, "<license key removed>")

PressControl("VMware Workstation", "", 2411)

WinWaitActive("VMware Workstation", "&Finish")

PressControl("VMware Workstation", "&Finish", 2338)

Func PressControl($tit, $txt, $id)

$maxtime = 15000

$curtime = 0

While ControlCommand($tit, $txt, $id, "IsEnabled", "") <> 1

Sleep(200)

$curtime += 200

if $curtime >= $maxtime Then

ExitLoop

EndIf

WEnd

ControlClick($tit, $txt, $id)

EndFunc

Link to comment
Share on other sites

Hmm, tricky to know what the issue is with VMWare failing to install. You may want to try the easier method instead?

$pathToVMWare = 'Z:\VMWARE\VMware Workstation 4.5\VMware-workstation-4.5.2-8848.exe'
RunWait('"' & $pathToVMWare & '" /s /v"/qn SERIALNUMBER=<license-key-removed>"')

:lmao:

Link to comment
Share on other sites

Well that worked out a little easier, thank you sir.

However! AutoIt doesn't seem to return from runWait...after the silent install was finished, the icon in the system tray continued to blink and it said the script was paused...I had to manually right click on it and hit exit..This is on an XP Service Pack 2 machine, nothing special...

Not sure what that is all about...but at least the install is easier to script.

However, a correction: the previous script was installing vmware just fine, but the final screen, which says "finish" was not pressing the button...just don't know why. :lmao:

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