Jump to content

Recommended Posts

Posted (edited)

This is just an example i wanted to do.

There is a script that opened internet explorer.

Then 2 windows will popup, one at a time

But the popup windows will randomly titled with any of 3 possibility.

Possible Title are: "Java update" / "Information" / "Security"

If the first popped either:

"Java update", Press Tab and enter.

"Information", Press Tab x 2 and enter.

"Security", Enter phrase ABC and enter.

and then repeat one more time, but won't be the first pop up windows.


How to write a script to check the possible pop up windows after internet explorer opened and it's relevant actions to automate?

Edited by Peter2004
Link to post
Share on other sites
Posted (edited)

Dealing with a set of random occurring windows can probably only be dealt with best-effort.  As far as the if then logic goes, you will need to have an if statement for each possible window.  You could also add more (or less) additional logic to track each dialog window action if you only want them run at most once.

I might approach it with something like this:

Local $iDialogWindowActionCount
Local Enum $eDialogWindowName, $eDialogWindowAction, $eActionPerformed
Local $aDialogWindowList[][3] = [["Java update",'Send("keys")',False], ["Information",'Send("different keys")',False], ["Security",'Send("more different keys")',False]]
Local $iDialogWindowCount = UBound($aDialogWindowList)
Local $iDialogWindowActionCount = 0

;Loop until Two of the Three Dialog Windows were found and acted upon
While $iDialogWindowActionCount < 2
    ;For Each Dialog Window to Check For
    For $iDialogWindow = 0 to $iDialogWindowCount-1
        ;Check if dialog window action already performed and skip if it was
        If Not $aDialogWindowList[$iDialogWindow][$eActionPerformed]
            ;Check for Dialog Window existence
            If WinExists($aDialogWindowList[$iDialogWindow][$eDialogWindowName]) Then
                ;Activate found dialog window
                ;Perform dialog window action
                ;Mark and track dialog window action performed
                $aDialogWindowList[$iDialogWindow][$eDialogWindowName] = True
                $iDialogWindowActionCount += 1
        ;Slow down process & keep CPU from being too busy


Edited by spudw2k
Link to post
Share on other sites

@wolflakeYou are not wrong, but you can also define arrays with the (in this case first) dimension blank.  I tend to do this when I want to have some flexibility with adding elements to the array without having to statically define how many elements are in it. It is just a shorthand approach.  I'm not sure if there is a performance issue with this, but I am not aware of there being one.

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

    No registered users viewing this page.

  • Create New...