Jump to content
sammy1983

Exctract data from 'onclick'

Recommended Posts

sammy1983

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&amp;foldertype=openreqs&amp;folderid=69586&amp;reqid=20827&amp;foldername='+replaceSpace('16013BR-')+'&amp;reqstatus=5&amp;hidreqcpage=1&amp;hidselectlang=en&amp;calledfrom=quicksearchreqpage&amp;hidstatus=quicksearch&amp;hidreqsortfield=datedisplayed&amp;hidreqsortorder=desc&amp;languageid='+document.forms[0].hidselectlang.value+'&amp;hidformid='+document.forms[0].hidformid.value+'&amp;hidQuickAutoReq='+document.forms[0].hidQuickAutoReq.value+'&amp;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 by sammy1983

Share this post


Link to post
Share on other sites
sammy1983

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)

 

Share this post


Link to post
Share on other sites
sammy1983
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 by sammy1983

Share this post


Link to post
Share on other sites
sammy1983
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

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×