Jump to content

Reading text


Recommended Posts

I'm still working on my yahoo script and now i want to know how much mail do i have and how much spam.

For the mail i 've used a _IEPropertyGet() to read the title and extract the informations but for the spam i'm stuck, i need to extract the 21and the source look like this

<div role="wairole:presentation" style="position: relative;">

<div id="_test_%40B%40Bulk_icon" class="folderIcon" style="background-position: -51px 0px; left: 17px; top: -2px; position: absolute; display: inline;"/>

<span id="_test_%40B%40Bulk" class="folderNameElem axsTreeitem axsSelected" style="left: 36px; background-color: rgb(211, 231, 247); color: rgb(59, 85, 135);" role="wairole:treeitem">Spam</span>

<span class="offScreen">, </span>

<span class="folderNameElem folderCount" style="left: 36px;">(21)</span>

<span id="_test_empty_probably_spam_folder" class="foldersPaneQuickLink" cmd="folders:emptyBulk" title="Permanently delete all messages in the Spam folder" onclick="ce(event,this);">Empty</span>

</div>

Can you give me some tips please ?

Thanks !

Edited by cent
Link to comment
Share on other sites

This is a StringRegEx question and unfortunately I'm not one of the few who understand it.

If you do, you basically need to come up with a pattern that filters <span class="folderNameElem folderCount" style="left: 36px;"> and </span>, and return the value between the <span></span>.

Something like this I guess (best I can come up with);

<span class=\"folderNameElem.*?>(.*?)</span>
Edited by aslani

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
Share on other sites

There may be a more elegant pattern, but this works:

$aRegExp = StringRegExp($sHTML,"(?:folderCount.+?\50)(\d*)",1)

Here's how you interpret it:

Group 1 (?:folderCount.+?\50)

?: means the first pattern won't be captured.

folderCount is a search for the exact text.

.+? is a wildcard search. (Smallest match)

\50 is the octal representation of the ascii character "(".

Group 2 (\d*)

\d* matches a number of any length.

<span class="folderNameElem folderCount" style="left: 36px;">(21)</span>

The rest of the text in gray is ignored because none of it matches the pattern.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Skruge

Thank you for nice example, but where you found this \50 parameter?

Use Asc("(") to get the ascii value of the parenthesis character.

From there I converted 40 decimal to 50 octal.

; Octal - \50
  $sCharPattern = StringFormat("\\%o" , Asc("("))
  
; Hex - \x28
$sCharPattern = "\x" & Hex(Asc("("),2)
@Edit: StringFormat for Octal conversion Edited by Skruge

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

hope this helps

I saved the html code in the file $URL

Edited...

$URL = @ScriptDir & "\source.html"
    $oIE=ObjCreate("InternetExplorer.Application.1")
    With $oIE
        .Visible=1
        .Silent=1           ; Don't show IE's dialog boxes
        .Navigate($URL) 
        EndWith
        While $oIE.busy
    WEnd
    $spanTarget = $oIE.document.getElementsByTagName("span")
    For $span in $spanTarget
            ConsoleWrite($span.innerHTML & @CRLF)
    Next
    $oIE = 0oÝ÷ Ú·­º¹ìr^J¦ãMµã_ܡײ¢ç©l¢ë¢ë^¬tÌ.Ú zÛayéí·­j§v'ò¢êÞjYrÁ©í¶z­²)©æ®¶­s`6æ6ÇVFRfÇC´RæS2fwC° b33c¶ôRÒôT7&VFRb33cµU$ b33c·7åF&vWBÒb33c¶ôRæFö7VÖVçBævWDVÆVÖVçG4'FtæÖRgV÷C·7âgV÷C² f÷"b33c·7ââb33c·7åF&vW@ 6öç6öÆUw&FRb33c·7âæææW$DÔÂfײ5$Äb æW@ b33c¶ôRÒ

Cheers

Edited by Marcuzzo18

[font="Century Gothic"]quisnam est quantum stultus , balatro vel balatro quisnam insistovolubilis in solum rideo risi risum----------------------------------------------------------------------------------------------------------------------------Portable Command Line Tool[/font]

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