Jump to content

Recommended Posts

Posted

Hi all,

I'm having the following challenge. I need to update a software regularly (not a game!) and it pops up a message box that's different

  1. if it was already up to date and asks for Ok to be closed vs.
  2. it's not up to date and asks for Ok to be updated

So my hope was I could work around this in the following way:

  1. See if the window title and text indicate it's up to date: exit out by controlclick and start the software
  2. See if title / text indicate it's asking to be updated: controlclick and run the updater and start the software after a delay

So I simplified everything and this would be the baseline:

Run("C:\Program Files\Tool\Updater.exe", "C:\Program Files\Tool\")
If WinWait('Title_1','Already updated') Then
Sleep(2000)
ControlClick("Title_1", "", "Button1")
Sleep (2000)
Run("C:\Program Files\Tool\Software.exe", "C:\Program Files\Tool\")
ElseIf WinWait('Title_2','Do you want to update?') Then
Sleep(2000)
ControlClick("Title_2", "", "Button1")
Sleep(2000)
Run("C:\Program Files\Tool\Software.exe", "C:\Program Files\Tool\")
EndIf

However, it doesn't catch the window at all or interacts with the dialogue if used in the way displayed above. I begin to have the feeling "If then" is incompatible with the WinWait statement - is that correct?

Is there any way around this while using winwait to wait for the popup to appear after the update check was done?

Sidenote:
It works just fine without the If statement - e.g. it does the winwait check successfully and e.g. closes out the dialogue box and starts the software - just that in this way I can only check for either if it's updated or if it's not updated - not both.

Thanks in advance and best regards.

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