sammy1983 Posted March 22, 2016 Posted March 22, 2016 (edited) Hi folks, I am working on an automation, however, I am clueless on how to retrieve the "folderid" and "reqid" from the below code. Need help. As of now I haven't written any code because I have done many automation using StringInStr but this one I am just lost. Need a code to extract the above field data. Will the below do it? Local $sHTML = _IEDocReadHTML($oIE) StringRegExp($sHTML, '(?i)a>\s*(.*?)\s*</(?i)a>', 3) and then StringTrimLeft/Right functions <a onmouseout="window.status = '';return true" href="" target="garbage" onmouseover="window.status='List candidates for job req %1'.replace(/%1/, '16013BR'); return true;" onclick="parent.location.href='/GridEnhancements.UserInterface/candidateList.aspx?pagename=foldercontents&foldertype=openreqs&folderid=69586&reqid=20827&foldername='+replaceSpace('16013BR-')+'&reqstatus=5&hidreqcpage=1&hidselectlang=en&calledfrom=quicksearchreqpage&hidstatus=quicksearch&hidreqsortfield=datedisplayed&hidreqsortorder=desc&languageid='+document.forms[0].hidselectlang.value+'&hidformid='+document.forms[0].hidformid.value+'&hidQuickAutoReq='+document.forms[0].hidQuickAutoReq.value+'&ismyreq=yes';return false;"><img border="0" alt="View candidates" src="/jetstream/500/presentation/1033/images/jetstream/icon_folderr.gif"></a> Thanks in advance. Edited March 22, 2016 by sammy1983
Dgameman1 Posted March 22, 2016 Posted March 22, 2016 $sHTML = _IEDocReadHTML($oIE) $FolderID = StringRegExp($sHTML, "folderid=(.*?)&", 1) MsgBox("", "", $FolderID[0]) $ReqID = StringRegExp($sHTML, "reqid=(.*?)&", 1) MsgBox("", "", $ReqID[0])
sammy1983 Posted March 22, 2016 Author Posted March 22, 2016 Thanks Dgameman1, but I am not getting any popup. I appended your code. Am I doing anything wrong? #include-once #include <IE.au3> #include <Date.au3> #include <String.au3> #include <Array.au3> #include <Debug.au3> #include <Excel.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Local $oIE, $FolderID, $ReqID $oIE = _IECreate("http:\\www.abc.com") ; dummy URL Sleep(3000) $sHTML = _IEDocReadHTML($oIE) $array = StringRegExp($sHTML, "folderid=(.*?)&", 1) For $m = 0 To UBound($array) - 1 $FolderID = $array[$m] MsgBox(0, "", $FolderID) Next Sleep(3000) _IEQuit($oIE)
sammy1983 Posted March 22, 2016 Author Posted March 22, 2016 (edited) 36 minutes ago, sammy1983 said: <td id="gridContent_rc_0_3" class="ig_5d1a935_9"> <div style="height: 50px;overflow: hidden;vertical-align:middle;"> <div style="position:relative;margin-top:12px;"> <a onclick="parent.location.href='pagename=foldercontents&foldertype=openreqs&folderid=69586&reqid=20827&foldername='+replaceSpace('16013BR-')+'&reqstatus=5&hidreqcpage=1&hidselectlang=en&calledfrom=quicksearchreqpage&hidstatus=quicksearch&hidreqsortfield=datedisplayed&hidreqsortorder=desc&languageid='+document.forms[0].hidselectlang.value+'&hidformid='+document.forms[0].hidformid.value+'&hidQuickAutoReq='+document.forms[0].hidQuickAutoReq.value+'&ismyreq=yes';return false;" onmouseover="window.status='List candidates for job req %1'.replace(/%1/, '16013BR'); return true;" target="garbage" href="" onmouseout="window.status = '';return true"> <div></div> </div> </div> </td> This is the complete HTML code which has folderid and reqid. Please assist. Also, this seems to be inside a Frame. <iframe id="gridContentFrame" width="400px" height="450px" frameborder="0" name="gridContentFrame" scrolling="no" src="/jetstream/500/presentation/template/html/include/blank.html" style="height: 209px; width: 1389px; visibility: visible;"> Edited March 22, 2016 by sammy1983
Juvigy Posted March 22, 2016 Posted March 22, 2016 First find the correct frame(check for frame ID or NAME or both): $oFrames = _IEFrameGetCollection ($oIE) For $element in $oFrames Consolewrite($element.Innerhtml & @CRLF) Next Then do the : $array = StringRegExp($element.innerhtml, "folderid=(.*?)&", 1)
sammy1983 Posted March 22, 2016 Author Posted March 22, 2016 14 minutes ago, Juvigy said: First find the correct frame(check for frame ID or NAME or both): $oFrames = _IEFrameGetCollection ($oIE) For $element in $oFrames Consolewrite($element.Innerhtml & @CRLF) Next Then do the : $array = StringRegExp($element.innerhtml, "folderid=(.*?)&", 1) Thanks Juvigy. I searched manually and found the frame name to be "gridContentFrame". <iframe id="gridContentFrame" width="400px" height="450px" frameborder="0" name="gridContentFrame" scrolling="no" src="/jetstream/500/presentation/template/html/include/blank.html" style="height: 209px; width: 1389px; visibility: visible;"> So the code should be like this? $sHTML = _IEDocReadHTML($oIE) $array = StringRegExp("gridContentFrame", "folderid=(.*?)&", 1) For $m = 0 To UBound($array) - 1 $FolderID = $array[$m] MsgBox(0, "", $FolderID) Next
sammy1983 Posted March 23, 2016 Author Posted March 23, 2016 After few permutations, finally figured it out. Here is the final code. $oFrames = _IEFrameGetObjByName($oIE, "gridContentFrame") $sHTML = _IEDocReadHTML($oFrames) $array = StringRegExp($sHTML, "folderid=(.*?)&", 1) For $m = 0 To UBound($array) - 1 $FolderID = $array[$m] MsgBox(0, "", $FolderID) Next
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