Peter2004 Posted May 28, 2021 Share Posted May 28, 2021 (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 May 28, 2021 by Peter2004 Link to comment Share on other sites More sharing options...
spudw2k Posted May 28, 2021 Share Posted May 28, 2021 (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 WinActivate($aDialogWindowList[$iDialogWindow][$eDialogWindowName]) ;Perform dialog window action Execute($aDialogWindowList[$iDialogWindow][$eDialogWindowAction]) ;Mark and track dialog window action performed $aDialogWindowList[$iDialogWindow][$eDialogWindowName] = True $iDialogWindowActionCount += 1 EndIf EndIf ;Slow down process & keep CPU from being too busy sleep(10) Next WEnd Edited May 28, 2021 by spudw2k FrancescoDiMuro 1 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Peter2004 Posted May 29, 2021 Author Share Posted May 29, 2021 Thank you so much for the suggestion, i can understand. Let me tryout see it works. Link to comment Share on other sites More sharing options...
wolflake Posted May 29, 2021 Share Posted May 29, 2021 Local $aDialogWindowList[][3] = [["Java update",'Send("keys")',False], ["Information",'Send("different keys")',False], ["Security",'Send("more different keys")',False]] Should be: Local $aDialogWindowList[3][3] = [["Java update",'Send("keys")',False], ["Information",'Send("different keys")',False], ["Security",'Send("more different keys")',False]] For 3 windows. Link to comment Share on other sites More sharing options...
spudw2k Posted May 30, 2021 Share Posted May 30, 2021 @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. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
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