displayedname Posted February 11, 2020 Posted February 11, 2020 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 if it was already up to date and asks for Ok to be closed vs. 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: See if the window title and text indicate it's up to date: exit out by controlclick and start the software 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.
FrancescoDiMuro Posted February 11, 2020 Posted February 11, 2020 @displayedname WinWait() returns an handle of the window you are looking for, so you should use IsHWnd() in your If...ElseIf...EndIf statement. In this case, you should be able to perform what you were trying to do Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now