Jump to content

how to check two Div numbers against one another?


pezo89
 Share

Recommended Posts

hi, i am just wondering how can i set these two numbers up against eachother?

and the highest number gets written down?

i am a semi-newb when it comes to Au3 coding, and it has been a  year since last time 

 
two nummbers, the Class ID will be the same, just the "%" will change
<div class="positions_sentiment_positionType_percentage positions_sentiment_positionType1_percentage">78%</div>
<div class="positions_sentiment_positionType_percentage positions_sentiment_positionType2_percentage">22%</div>
 
iv been able to exstract the data with this code
 
For $div In $divs
    If $div.className == "positions_sentiment_positionType_percentage positions_sentiment_positionType1_percentage" Then
MsgBox(0,"percentage",$div.innertext)
;::::::::::::::::::::::::::::::::::::::::
EndIf
Next
 
 
 
 
Link to comment
Share on other sites

The _Max func in the integrated udf Math.au3 should work

Else (also works if more than 2 values)

#include <Array.au3>

$str = '<div class="positions_sentiment_positionType_percentage positions_sentiment_positionType1_percentage">78%</div>' & @crlf & _ 
'<div class="positions_sentiment_positionType_percentage positions_sentiment_positionType2_percentage">22%</div>'

$res = StringRegExp($str, '(?s)<div.+?percentage">(\d+)%', 3)
Msgbox(0,"", _ArrayMax($res, 1) & " %")
Edited by mikell
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...