Jump to content
Sign in to follow this  
mrrich06

Get Text From html <b></b> Tag.

Recommended Posts

mrrich06

HTML Code:

--------------------------------------------------------------------------------------------------------------------------------------------------------

<div id="main_content">
<h2>Ping Pong Page</h2>
<div style="border-top: solid 4px #33c75e; position: relative; top: -13px; line-height: 24px;"></div>
 
<div class="green_table">
 
<div class="green_t_inside2">
 
<div class="selectedamount" style="position:relative; float: left; text-align: center; font-size:20px; color:#32c75f; margin: 12px 0 0 0px; width: 40%">
<b>0</b>
Amounts Available
</div>
 
<div style="position:relative; float: left;">
</div>
</div>
--------------------------------------------------------------------------------------------------------------------------------------------------------
 
Now, How would i get the 0 from between the b html tag using autoit.
 
I tried this but it doesn't work::
My AutoIT Code::
 
--------------------------------------------------------------------------------------------------------------------------------------------------------
Local $oListItems = _IETagNameGetCollection ($oIE, "div")
For $oListItem In $oListItems
    Local $odivs = _IETagNameGetCollection($oListItem, 'class')
    For $odiv in $odivs
        Local $dataVin = $odiv.getAttribute("selectedamount")
        If $dataVin <> '' Then
            ConsoleWrite('+ Found it, data-vin: ' & $dataVin & @CRLF)
 
         EndIf
    Next
 Next
Global $oAnchors = _IETagNameGetCollection($odiv, 'b')
MsgBox($MB_OK,"This is ",$oAnchors)
--------------------------------------------------------------------------------------------------------------------------------------------------------
 
Any help will be really great full guys.
Thanks in advance.
 
 

Share this post


Link to post
Share on other sites
guinness

That's some awful HTML mark-up there.

As to your problem...

#include <Array.au3>

Local $aSRE = StringRegExp($sHTML, '<b>[^<]+?</b>', $STR_REGEXPARRAYGLOBALMATCH) ; Read the help file as to what is happening here.
_ArrayDisplay($aSRE)
Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
mrrich06

 

That's some awful HTML mark-up there.

As to your problem...

#include <Array.au3>

Local $aSRE = StringRegExp($sHTML, '<b>[^<]+?</b>', $STR_REGEXPARRAYGLOBALMATCH) ; Read the help file as to what is happening here.
_ArrayDisplay($aSRE)

Respected 

guinness

Thanks for ur reply. I used it like this:

AutoIT Code:

#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <StringConstants.au3>

Global $oIE = _IECreate ("http://tracker.com/login.html")
_IENavigate ($oIE,"http://tracker.com/member/games/coin_flip.html")
Sleep(4000)
Global $Amount2Bet = _IEGetObjById ($oIE,"bet")
_IEFormElementSetValue ($Amount2Bet,"10")

Local $sHTML = _IEBodyReadHTML($oIE)
Local $aSRE = StringRegExp($sHTML, '<b>[^<]+?</b>', $STR_REGEXPARRAYGLOBALMATCH)
_ArrayDisplay($aSRE)

It worked but still there is a problem. That is it displays me the Amount Available but along with other <b></b> tags which includes players name etc. which also has a <b> </b> tags. How do i fix this to get only the Amounts Available. Sorry for my bad english.

Any help would be great full.

Thanks in advance.

HTML Code:

<div class="green_table">
        <div class="green_t_inside2">
            <div class="selectedBalance" style="position:relative; float: left; text-align: center; font-size:20px; color:#32c75f; margin: 12px 0 0 0px; width: 40%">
                <b>0</b> Amounts Available
            </div>
            <div style="position:relative; float: left;">
                <a href="http://tracker.com/member/activation_points.html" class="button_green_sans3" style="margin: 10px 20px 10px 0; text-align:center;">
                    View Activation +25 Points</a>
                (0/8 clicked today)
            </div>

        </div>
</div>

Share this post


Link to post
Share on other sites
guinness

Before we continue, did you read the rules? As this looks a little bit too much like game automation. Am I right?


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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  

×