sammy1983 Posted March 21, 2014 Share Posted March 21, 2014 (edited) Hi, I have a table showing Calendar with 3 colors. I need to click on one box showing bgcolor as "ffcc00". Please refer the screenshot. In this case, I want to click on date 26. I am able to retrieve the dates using below code but I want to click on it if bgcolor is "FFCC00" $sHTML = _IEDocReadHTML($oIE) $Test = StringRegExp($sHTML, '(?i)">(\d+)</(?i)a>', 3) For $a = 0 To UBound($Test ) - 1 $Date = $Test[$a] MsgBox(0, "", $Date) Next Please help. Edited March 21, 2014 by sammy1983 Link to comment Share on other sites More sharing options...
JohnOne Posted March 21, 2014 Share Posted March 21, 2014 Only way you're going to get any worthwhile help is to post link to webpage, or show full runnable code with relevant html source. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
sammy1983 Posted March 21, 2014 Author Share Posted March 21, 2014 (edited) Hey John, Once again, this is an in-house tool and you will not be able to access it. However, below is the HTML code. Let me know if this is not sufficient enough. <td bgcolor="#ffcc00"><font face="Verdana" size="1"> <a title="13" onclick="javascrip:document.getElementById('CAL_pal').value='2014-03-26';" href="javascript:void(0)">26</a></font></td> My code as of now is this: expandcollapse popupWhile 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Closes the script if user decides not to proceed Exit Case $msg = $Proceed GUISetState(@SW_HIDE) $oIE = _IECreate("URL") _IENavigate($oIE, "URL") _IELoadWait($oIE, 1000) $oHWND = _IEPropertyGet($oIE, "hwnd") WinSetState($oHWND, "", @SW_MAXIMIZE) WinActivate($oHWND) $username = _IEGetObjByName($oIE, "username") _IEFormElementSetValue($username, GUICtrlRead($UN)) $password = _IEGetObjByName($oIE, "passwd") _IEFormElementSetValue($password, GUICtrlRead($PW)) ; Below code will find elements with no "Name" of "Id" $oLinks = _IETagNameGetCollection($oIE, "input") For $oLink In $oLinks If String($oLink.type) = "submit" And String($oLink.value) = "Login" Then _IEAction($oLink, "click") _Toast_Hide() ExitLoop EndIf Next _IELoadWait($oIE, 1000) _IENavigate($oIE, "URL/YOC/Tracker/Deployment_Tracker/calendar/new.php") $sHTML = _IEDocReadHTML($oIE) $Test = StringRegExp($sHTML, '(?i)">(\d+)</(?i)a>', 3) For $a = 0 To UBound($Test) - 1 $Date= $Test[$a] MsgBox(0, "", $Date) Next Exit EndSelect WEnd Edited March 21, 2014 by sammy1983 Link to comment Share on other sites More sharing options...
JohnOne Posted March 21, 2014 Share Posted March 21, 2014 Not really enough to work with, you see it's not enough to read all the html to be able to click on an element. You need to drill down to it as you appear to earlier in your code leading to "_IEAction($oLink, "click")". You will probably have to look at the _IETableGetCollection func. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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