Jump to content
Sign in to follow this  
Frit

Getting variables from texts and Math

Recommended Posts

Frit

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?

Share this post


Link to post
Share on other sites
Valuater

#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

Share this post


Link to post
Share on other sites
Frit

Oh Gosh! I'm a little lost there...

I'm going to read it all and try to understand how does it works.

I don't know all the functions and what do they do.

Share this post


Link to post
Share on other sites
Frit

"error reading the file IE.au3"

:S

I haven't read it all, maybe I didn't change some variables, etc..

Share this post


Link to post
Share on other sites
Valuater

you have to get&place the IE.au3 file in the Beta\include folder

and make sure you are running the beta version of autoit

in SciTE ... press Tools > Run Beta

8)


NEWHeader1.png

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  

×