Jump to content

Remove item from _IEBodyReadText


Bert
 Share

Recommended Posts

I'm using _IEBodyReadText to get the text off a webpage, then stripping off what I don't need to get a list:

$page = _IEBodyReadText($oIE)
    $sIs = StringInStr($page, "Contact")
    $depotST_left = StringTrimLeft($page, $sIs+8)

I end up with a list of names that looks fine in a msgbox. However, I need to add this list to a combo list. I want to make a list to allow the user to select their name. Here is the rub: When I try to use GUIctrlsetdata, the combo has all the items on one line like this:

Those little blocks are the problem. They act like a carrage return, but they do not respond to anything that will let me remove them. StringStripCR doesn't work, nor does StringStripWS. I need to get this data into the combo as a list.

I tried this which removes the block thing and puts them in a list, but it also removes all spacing, which won't work either. The first and last name run together:

$page = _IEBodyReadText($oIE)
    $sIs = StringInStr($page, "Contact")
    $depotST_left = StringTrimLeft($page, $sIs+8)
    $depotST_SR = StringReplace($depotST_left, @cr, "|")
    $depotST_RP = StringStripWS($depotST_SR, 8)

If I could figure out a way to do a stringsplit between each first and last name, I may be in business. Anyone got a idea on how to solve this one?

Oh, the webpage source code - here is a snippit of the code:

<tr valign="top"><td colspan="6" nowrap><a href="/webpage/webpage/webpage?OpenView&Start=1&Count=1000&Expand=1#1" target="_self"><img src="/icons/expand.gif" border="0" height="16" width="16" alt="Show details for Aaron Adler"></a><b><font size="2" face="Arial">Aaron Adler</font></b></td><td></td></tr>

<tr valign="top"><td colspan="6" nowrap><a href="/webpage/webpage/webpage?OpenView&Start=1&Count=1000&Expand=2#2" target="_self"><img src="/icons/expand.gif" border="0" height="16" width="16" alt="Show details for Abosede George"></a><b><font size="2" face="Arial">Abosede George</font></b></td><td></td></tr>

<tr valign="top"><td colspan="6" nowrap><a href="/webpage/webpage/webpage?OpenView&Start=1&Count=1000&Expand=3#3" target="_self"><img src="/icons/expand.gif" border="0" height="16" width="16" alt="Show details for Adam Heustess"></a><b><font size="2" face="Arial">Adam Heustess</font></b></td><td></td></tr>
Link to comment
Share on other sites

#include <String.au3>
#include <Array.au3>
$s = '<tr valign="top"><td colspan="6" nowrap><a href="/webpage/webpage/webpage?OpenView&Start=1&Count=1000&Expand=1#1" target="_self"><img src="/icons/expand.gif" border="0" height="16" width="16" alt="Show details for Aaron Adler"></a><b><font size="2" face="Arial">Aaron Adler</font></b></td><td></td></tr> <tr valign="top"><td colspan="6" nowrap><a href="/webpage/webpage/webpage?OpenView&Start=1&Count=1000&Expand=2#2" target="_self"><img src="/icons/expand.gif" border="0" height="16" width="16" alt="Show details for Abosede George"></a><b><font size="2" face="Arial">Abosede George</font></b></td><td></td></tr><tr valign="top"><td colspan="6" nowrap><a href="/webpage/webpage/webpage?OpenView&Start=1&Count=1000&Expand=3#3" target="_self"><img src="/icons/expand.gif" border="0" height="16" width="16" alt="Show details for Adam Heustess"></a><b><font size="2" face="Arial">Adam Heustess</font></b></td><td></td></tr>'
$NameArray = _StringBetween($s,'Show details for ','">');Get all Strings Between those strings
If IsArray($NameArray) Then 
    _ArrayDisplay($NameArray); For Debug
    $String = ""
    For $Cnt = 0 To UBound($NameArray) - 1 ; Loop the array
        $String = $String & $NameArray[$Cnt] & "|";Add Name to String
    Next
    ConsoleWrite($String)
Else
    ConsoleWrite("No Elements!")
EndIf

is this what you are looking for?

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"
Link to comment
Share on other sites

_IETableWriteToArray would drop all of the names nicely into an array that you could index into...

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...