Jump to content
Sign in to follow this  
pezo89

how to check two Div numbers against one another?

Recommended Posts

pezo89

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
 
 
 
 

Share this post


Link to post
Share on other sites
mikell

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

Share this post


Link to post
Share on other sites
pezo89

Thanks alot Mikell!

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
Sign in to follow this  

×