Kidney Posted December 5, 2013 Share Posted December 5, 2013 So for my work i have to fill out call reports and im trying to make a script to automate that. Currently i have it to the point where it can successfully navigate to the call reports. However, when i check for the call report for today, and the call report isnt there, i have to go to the BACKUP call reports and then check for the call report for today. If i were to go from the "Home page" to the back up call reports page, it works just fine. If i go to the FT/PT call reports (we only have call reports for the days that we r scheduled to work) and then try to go to the backup call report page, (there is a call report for every day, no matter the schedule) it opens up the page in a new tab and then the script fails. $oDivBACKUP = _IEGetObjById($oIE, "a_p5429_26615") $oDivPT = _IEGetObjById($oIE, "a_p5422_25984") $result = LoadCallReport($oDivPT, $Date) ConsoleWrite($result & @CRLF) If IsInt($result) Then $MsgReturn = MsgBox(4, "Call report Not Found", "Could not find the call report for today. Would you like to search in the backup call reports?") If $MsgReturn = 6 Then $oDivBACKUP = _IEGetObjById($oIE, "a_p5429_26615") $result = LoadCallReport($oDivBACKUP, $Date) EndIf EndIf Func LoadCallReport($oDivEmployeeType, $Date) _IEAction($oDivEmployeeType, "click") _IELoadWait($oIE) $oiFrame = _IEFrameGetObjByName($oIE, "main") If @error then ConsoleWrite(@error & @CRLF) $oFrame = _IEFrameGetObjByName($oiFrame, "fra_Main") If @error then ConsoleWrite(@error & @CRLF) _IELoadWait($oIE) Sleep(2000) Local $oTable = _IETableGetCollection($oFrame, 4) Local $aTableData = _IETableWriteToArray($oTable, True) ConsoleWrite($Date & @CRLF) For $i = 1 to UBound($aTableData) - 1 $result = StringInStr($aTableData[$i][1], $Date) If $result > 0 Then Return $aTableData[$i][1] Next EndFunc Im not geting any errors in the console and i double checked the page source to see if anything changes between the home screen and the FT/PT page but everything is the same. anyone know why this could happen?? Link to comment Share on other sites More sharing options...
Valuater Posted December 5, 2013 Share Posted December 5, 2013 Not enough info to completely test this so... Suggestions 1 use the "Home Page" because you said it works fine 2 use _IEAttach() for the new page... then continue the script 3 use _IEErrorHandlerRegister([) and you may get more info... see help file 8) Link to comment Share on other sites More sharing options...
Kidney Posted December 6, 2013 Author Share Posted December 6, 2013 so i did more testing and it turns out that no matter where i am on the website it always makes a new tab. But this isnt the case when i use my mouse. only when i use this script. 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