Wendallwoof Posted June 18, 2015 Share Posted June 18, 2015 (edited) Hi all,So I've created a script that rotates between two browser sessions and a local app. Initially the script does the following: opens the local app and uses key strokes to ensure the correct page is displayed. Opens two browsers and logs in with relevant credentials. This part all works fine, so good so far.Essentially what I then need the script to do is rotate between browser session 1, browser session 2 and the local app (order is not relevant to be honest just need it to rotate). The issue is that script appears to rotate from local app to the next browser but then either usually gets stuck (doesnt rotate to the next browser or back to the local app)Any ideas? Passwords and URLS removedexpandcollapse popup#include <IE.au3> #RequireAdmin Run("C:\Users\Integration\AppData\Roaming\Oak Telecom\display\OakWallboard.exe", "", @SW_MAXIMIZE) ; Opens the telephony logging system, Local $displayX = ("Warning"); The error title displayed by the two error windows WinWait($displayX, "", 10) Send("{Enter}") WinWait($displayX, "", 10) Send("{Enter}") ; Enter keystrokes are sent to remove the two error windows that keep appearing when loading Oak Telecom software Func DisplayXTitle() ; Retrieve the window title of the active window. Local $windowTitle = WinGetTitle("[ACTIVE]") WinActivate($windowTitle) EndFunc ;==>DisplayXTitle Sleep(5000) Local $focusSupportPage = _IECreate("http://support.******.co.uk/helpdesk/tickets") $focusSupportHandle = _IEPropertyGet($focusSupportPage, "hwnd") ; Get Handle of the IE window WinSetState($focusSupportHandle, "", @SW_HIDE) ; Minimizes The focus support window in IE Sleep(5000) Local $dropTask = _IECreate("www.droptask.com/projects/54d0d3cf44778b030075c0a8") $dropTaskHandle = _IEPropertyGet($dropTask, "hwnd") ; Get Handle of the IE window WinSetState($dropTaskHandle, "", @SW_HIDE) ; Minimize the drop task IE window $dropTaskUsername = _IEGetObjByName($dropTask, "email") _IEFormElementSetValue($dropTaskUsername, "****@****.co.uk") $dropTaskPassword = _IEGetObjByName($dropTask, "password") _IEFormElementSetValue($dropTaskPassword, "*****") $oForm = _IEFormGetCollection($dropTask, 0) ; Submits IE form _IEFormSubmit($oForm) While 1 DisplayXTitle() MouseClick("left", 690, 15, 1); Set Co-ordinates to 690,15 and clicks once where the drop down option is required to set the Team to integration. MouseClick("left", 161, 87, 1); As above Send("{f11}"); full screen Sleep(120000) Send("{f11}"); full screen Local $windowTitle = WinGetTitle("[ACTIVE]") WinSetState($windowTitle, "", @SW_HIDE) ; Minimizes the Oak window WinSetState($focusSupportHandle, "", @SW_MAXIMIZE); Maximizes The focus support window in IE WinActivate($focusSupportHandle) Send("{f11}"); full screen Sleep(120000) Send("{f11}"); full screen WinSetState($focusSupportHandle, "", @SW_HIDE) ; Minimizes The focus support window in IE WinSetState($dropTaskHandle, "", @SW_MAXIMIZE) ; Mazimize the drop Task IE window WinActivate($dropTaskHandle) Send("{f11}") ; full screen Sleep(120000) Send("{f11}"); full screen WinSetState($dropTaskHandle, "", @SW_HIDE) ; Minimize the drop task IE window WEnd Edited June 18, 2015 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 18, 2015 Moderators Share Posted June 18, 2015 Wendallwoof,When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Shane0000 Posted June 18, 2015 Share Posted June 18, 2015 I ran the below code with no problems. Maybe try a try a loop with WinActive that calls the next window until successful. #include <IE.au3> Local $dropTask = _IECreate("www.google.com/") Local $focusSupportPage = _IECreate("www.msn.com/") WinSetState($dropTask.HWND,"", @SW_Minimize) WinSetState($focusSupportPage.HWND,"", @SW_Minimize) While 1 While Not(WinGetState($dropTask.HWND) = 47) WinSetState($dropTask.HWND,"", @SW_Maximize) WinActivate($dropTask) WEnd Send("{f11}"); full screen Sleep(10000) Send("{f11}"); full screen WinSetState($dropTask.HWND,"", @SW_Minimize) While Not(WinGetState($focusSupportPage.HWND) = 47) WinSetState($focusSupportPage.HWND,"", @SW_Maximize) WinActivate($focusSupportPage) WEnd Send("{f11}"); full screen Sleep(10000) Send("{f11}"); full screen WinSetState($focusSupportPage.HWND,"", @SW_Minimize) WEnd Wendallwoof 1 Link to comment Share on other sites More sharing options...
Wendallwoof Posted June 22, 2015 Author Share Posted June 22, 2015 Worth noting, im using windows 8 (not my choice!). the script works fine on 7 but acts a bit irrationally on 8.Apologies Melba, i'll note that for future posting. The browsers seem to work fine but it must be this local app thats causing me the headache.. Link to comment Share on other sites More sharing options...
Wendallwoof Posted June 22, 2015 Author Share Posted June 22, 2015 also, thank you for your input Shane Shane0000 1 Link to comment Share on other sites More sharing options...
Wendallwoof Posted June 22, 2015 Author Share Posted June 22, 2015 Also what does the 47 relate to in the following line of code? While Not(WinGetState($dropTask.HWND) = 47)Is this a browser status code or such? Link to comment Share on other sites More sharing options...
reb Posted June 22, 2015 Share Posted June 22, 2015 From the help file (I need it all the time)WinGetStateRetrieves the state of a given window.WinGetState ( "title" [, "text"] )ParameterstitleThe title/hWnd/class of the window to get the state. See Title special definition.text[optional] The text of the window to get the state. Default is an empty string. See Text special definition.Return ValueSuccess:a value indicating the state of the window. Multiple values are added together so use BitAND() to examine the part you are interested in: 1 = Window exists 2 = Window is visible 4 = Window is enabled 8 = Window is active 16 = Window is minimized 32 = Window is maximized Wendallwoof 1 MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
Wendallwoof Posted June 22, 2015 Author Share Posted June 22, 2015 Brill, Cheers reb Link to comment Share on other sites More sharing options...
Shane0000 Posted June 22, 2015 Share Posted June 22, 2015 (edited) With a search I found a little code to retrieve the HWND of the application$theWinlist = Winlist() Do For $i = 1 To $theWinlist[0][0] If $theWinlist[$i][0] <> "" Then $iPID2 = WinGetProcess($theWinlist[$i][1]) If $iPID2 = $aPID Then $hWnd2 = $theWinlist[$i][1] ExitLoop EndIf EndIf Next Until $hWnd2 <> 0You should be able to get the HWND like above and use the same loop to call your application to be active, maximized. Edit:$aPID = run("C:\Users\Integration\AppData\Roaming\Oak Telecom\display\OakWallboard.exe", "", @SW_MAXIMIZE) Edited June 22, 2015 by Shane0000 defined $aPID 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