Jump to content

Getting variables from texts and Math


Frit
 Share

Recommended Posts

First of all, I want to excuse me about the number of topics I've created.

I want Autoit to take "numbers from a text" (in this case, from a html document), turn them into variables, play some math on them and fill dialog boxes with the results.

It seems to be easy, but the point is: I don't know which numbers there will be (just the words besides them). And I also don't know how to use math on Autoit.

All codes will be welcome.

Thanks

p.s.: Don't you think I'm posting too much?

Link to comment
Share on other sites

#include <IE.au3>

$oIE = _IECreate ()
_IENavigate ($oIE, "YOUR WEB ADDRESS")

$Find = "YOUR WORD BESIDE THE NUMBERS"

$After = "THE WORDS AFTER THE NUMBERS" 


$body = _IEBodyReadHTML ($oIE)
$sloc = @TempDir & "\stest.txt"
FileDelete($sloc)
FileWrite($sloc, $sbody)
$sfile = FileOpen($sloc, 0)
While 2
    $sline = FileReadLine($sfile)
    If @error Then
        MsgBox(262208, "Fail", "The string was NOT found   ")
        FileClose($sfile)
        Exit
    EndIf
    If StringInStr($sline, $Find) Then
        MsgBox(64, "Success", "The string " & $Find & " was found   ", 5)
        $Found = stringbetween($sline, $Find, $after)
        MsgBox(64, "Found", "The string is" & $Found & "    ", 5)
    EndIf
WEnd


Func stringbetween($str, $start, $end)
    $pos = StringInStr($str, $start)
    If Not @error Then
        $str = StringTrimLeft($str, $pos + StringLen($start) - 1)
        $pos = StringInStr($str, $end)
        If Not @error Then
            $str = StringTrimRight($str, StringLen($str) - $pos + 1)
            Return $str
        EndIf
    EndIf
EndFunc ;==>stringbetween

8)

NEWHeader1.png

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