sammy1983 Posted May 1, 2016 Share Posted May 1, 2016 Hi All, Recently, MichaelHB helped me in doing _IEAttach an already opened pop up IE window. Also, he assisted in retrieving the content of that IE window using the below code. Local $aIE[1] $aIE[0] = 0 Local $i = 1, $oIE While 1 $oIE = _IEAttach("", "instance", $i) If @error = $_IEStatus_NoMatch Then ExitLoop ReDim $aIE[$i + 1] $aIE[$i] = $oIE $aIE[0] = $i $i += 1 WEnd ConsoleWrite("Number of browser instances in the array: " & $aIE[0] & @CRLF & @CRLF) ConsoleWrite(">-------------------------------------------------------------" & @CRLF) For $i = 1 To $aIE[0] ConsoleWrite("IE instance number: " & $i & " / URL: " & _IEPropertyGet($aIE[$i], "locationurl") & @CRLF & @CRLF) ConsoleWrite(_IEPropertyGet($aIE[$i], "outerhtml") & @CRLF) ConsoleWrite(">-------------------------------------------------------------" & @CRLF & @CRLF) Next The above code retrieves the number of opened IE windows and its HTML content. I tweaked the code per my requirement like the below but I am unable to perform StringRegExp. I need the text appearing between <option> .... </option> tags. <option value="52125844">52125844 (Technical Specialist, Band:04, Subband:00, CC:INE1O, Incentive:0 from:2016-03-01)</option> $j = _IEPropertyGet($aIE[$i], "outerhtml") $array1 = StringRegExp($j, '(?i)<option value="(.*?)">(.*?)</option>', 3) For $n = 0 To UBound($array1) - 1 $PosID = array1[$n] MsgBox(0, "", $PosID) Next Any help here? Link to comment Share on other sites More sharing options...
mikell Posted May 1, 2016 Share Posted May 1, 2016 Your regex works if only one group ;$j = _IEPropertyGet($aIE[$i], "outerhtml") $j = '<option value="52125844">52125844 (Technical Specialist, Band:04, Subband:00, CC:INE1O, Incentive:0 from:2016-03-01)</option>' $array1 = StringRegExp($j, '(?is)<option value.*?>(.*?)</option>', 3) For $n = 0 To UBound($array1) - 1 $PosID = $array1[$n] MsgBox(0, "", $PosID) Next 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