Jump to content

read web


Recommended Posts

Hi,

have you tried something like:

InetGet("http://home.scarlet.be/~bc161921/verification.txt", @TempDir & "\test.txt", 1, 1)

While @InetGetActive
  TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)
  Sleep(250)
Wend

MsgBox(0, "Bytes read", @InetGetBytesRead)

;or

#include <INet.au3>
ConsoleWrite(_INetGetSource('http://home.scarlet.be/~bc161921/verification.txt'))

Cannot test it yet, cause our Proxy doesn't allow this. :D

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

maybe try running in beta mode. (beta version)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

got it solved but takig a complete different route now...

here's my script:

InetGet("http://home.scarlet.be/~bc161921/verification.txt", @TempDir & "\test.txt", 1, 1)

While @InetGetActive
  Sleep(250)
Wend

$file = FileOpen( @TempDir & "\test.txt", 0)
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
Wend

FileClose($file)
FileDelete(@TempDir & "\test.txt")

afaik, I'm using the beta version. Downloaded it, and extracted it to my autoit program folder.

Link to comment
Share on other sites

HI,

complete different? That was the first solution. :D Nevermind, glad - you got it.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

uuuh? :D

first solution? that one didn't display me the info that I needed but pointed me to where I needed to go. Thx for that th.meger.

Now I still have a small problem. If you look at the code you will see what the problem is.

I need the 2 values to compare and that aint happening.

I tried adding a variable with Dim but that didn't do it.

I think I still need some scripting lessons from the pro's...

$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld","InstallLocation")
$alltext = FileRead($workingdir & "\settings.cfg", FileGetSize($workingdir & "\settings.cfg"))
$alltextArray = StringSplit($alltext, @CRLF)            ; array, one line per item
For $i = 1 to $alltextArray[0]
    $verified1 =StringSplit($alltextArray[$i], " : ", 1)    ; split lines
    if $verified1[0] > 1 Then                                ; Skip blank lines
        If $verified1[1] = "NETWORK_LOBBYLOGIN" Then
            MsgBox(4096, "Test", $verified1[2])
        EndIf
    EndIf
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InetGet("http://home.scarlet.be/~bc161921/verification.txt", @TempDir & "\test.txt", 1, 1)

While @InetGetActive
  Sleep(250)
Wend

$file = FileOpen( @TempDir & "\test.txt", 0)
While 1
    $verification2 = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $verification2)
Wend

FileClose($file)
FileDelete(@TempDir & "\test.txt")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if $verified1[2] = $verification2 then MsgBox(0,"BINGO", "user rights for you")
if $verified1[2] = not $verification2 then MsgBox(0,"BUSTED", "no user rights for you")

If I use $verified1[2] it gives me a ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: error...

If I use $verified1 then I don't get a msgbox in the end with a answer...

Link to comment
Share on other sites

Hi,

does this help?

$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld", "InstallLocation")
$alltext = FileRead($workingdir & "\settings.cfg", FileGetSize($workingdir & "\settings.cfg"))
$alltextArray = StringSplit($alltext, @CRLF)            ; array, one line per item
For $i = 1 To $alltextArray[0]
    $verified1 = StringSplit($alltextArray[$i], " : ", 1)    ; split lines
    If $verified1[0] > 1 Then                                ; Skip blank lines
        If $verified1[1] = "NETWORK_LOBBYLOGIN" Then
            MsgBox(4096, "Test", $verified1[2])
        EndIf
    EndIf
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InetGet("http://home.scarlet.be/~bc161921/verification.txt", @TempDir & "\test.txt", 1, 1)

While @InetGetActive
    Sleep(250)
WEnd

$file = FileOpen(@TempDir & "\test.txt", 0)
While 1
    $verification2 = FileReadLine($file)
    If @error = -1 Then ExitLoop
    If $verified1[2] = $verification2 Then
        MsgBox(0, "BINGO", "user rights for you")
    Else
        MsgBox(0, "BUSTED", "no user rights for you")
    EndIf
    ;MsgBox(0, "Line read:", $verification2)
WEnd
FileClose($file)
FileDelete(@TempDir & "\test.txt")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

If I use $verified1[2] it gives me a ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: error...

If I use $verified1 then I don't get a msgbox in the end with a answer...

however this I can solve if I change the first part of the script to :

$verification1 = FileReadLine($workingdir & "\settings.cfg", 37)
$verification1 = StringTrimLeft($verification1,21)
oÝ÷ Ù»­#fëmxnV§Mú½êâ~'¶*'Úö¥¹è§¶×î[®*mÆÞºÚ"µÍÌÍÝÛÜÚ[ÙHYÔXY
    ][ÝÒÑVWÐÕTSÕTÑTÌLÔÛÙØIÌLÐØØÛ[Z[Y[  ÌLÔØXÜY[ÛÜ    ][ÝË  ][ÝÒ[Ý[ØØ][Û][ÝÊBÌÍÝYXØ][ÛHH[TXY[J ÌÍÝÛÜÚ[Ù [È ][ÝÉÌLÜÙ][ÜËÙÉ][ÝËÍÊBÌÍÝYXØ][ÛHHÝ[Õ[SY
    ÌÍÝYXØ][ÛKJBÙÐÞ
    ][ÝÝYXØ][ÛN][ÝË   ÌÍÝYXØ][ÛJHÈIÝÈÒÂÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂ[]Ù]
    ][ÝÚËÚÛYKØØ]KßÌMNLKÝYXØ][Û  ][ÝË[ [È ][ÝÉÌLÝÝ   ][ÝËKJBÚ[H[]Ù]XÝ]BÛY
L
BÙ[ÌÍÙ[HH[SÜ[[ [È ][ÝÉÌLÝÝ   ][ÝË
BÚ[HB  ÌÍÝYXØ][ÛH[TXY[J   ÌÍÙ[JBYÜHLH[^]ÛÜÙÐÞ
    ][ÝÝYXØ][Û][ÝË    ÌÍÝYXØ][ÛHÈIÝÈÒÂÙ[[PÛÜÙJ  ÌÍÙ[JB[Q[]J[ [È ][ÝÉÌLÝÝ   ][ÝÊBÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÂÙÐÞ
    ][ÝÝYXØ][ÛN][ÝË   ÌÍÝYXØ][ÛJHÈIÝÈÒÂÙÐÞ
    ][ÝÝYXØ][Û][ÝË    ÌÍÝYXØ][ÛHÈIÝÈ[È[YOÏÂRY  ÌÍÝYXØ][ÛHH    ÌÍÝYXØ][Û[ÙÐÞ
    ][ÝÐSÓÉ][ÝË   ][ÝÝÙYÚÈÜ[ÝI][ÝÊB[ÙBÙÐÞ
    ][ÝÐTÕQ  ][ÝË  ][ÝÛÈÙYÚÈÜ[ÝI][ÝÊB[Y

and so I always get the 2nd msgbox...

Link to comment
Share on other sites

HI,

is this better?

$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld","InstallLocation")
$verification1 = FileReadLine($workingdir & "\settings.cfg", 37)
$verification1 = StringTrimLeft($verification1,21)
MsgBox(0, "verification1:", $verification1) ; => OK
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include <INet.au3>
$file = FileOpen( @TempDir & "\test.txt", 0)
FileWrite($file,_INetGetSource('http://home.scarlet.be/~bc161921/verification.txt'))
While 1
    $verification2 = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "verification2:", $verification2) ; => OK
Wend
FileClose($file)
FileDelete(@TempDir & "\test.txt")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MsgBox(0, "verification1:", $verification1) ; => OK
MsgBox(0, "verification2:", $verification2) ; => blank value??

    If $verification1 = $verification2 Then
       MsgBox(0, "BINGO", "user rights for you")
    Else
       MsgBox(0, "BUSTED", "no user rights for you")
   EndIf

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

hey meger,

it did keep me giving problems but I managed to solve it out.

here's what I'm currently using and it works very well.

#include <file.au3>
$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld","InstallLocation")
$verification1 = FileReadLine($workingdir & "\settings.cfg", 37)
$verification1 = StringTrimLeft($verification1,21)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InetGet("http://home.scarlet.be/~bc161921/verification.txt", @TempDir & "\test.txt", 1, 1)
While @InetGetActive
Sleep(250)
Wend
$file = FileOpen( @TempDir & "\test.txt", 0)
$totalofLines = _FileCountLines(@TempDir & "\test.txt")
$linereadnumber = 1
$verification2 = FileReadLine($file, $linereadnumber)
Do
    If $verification1 <> $verification2 Then
    $linereadnumber = $linereadnumber + 1
    $verification2 = FileReadLine($file, $linereadnumber)
    EndIf
until $linereadnumber = $totalofLines or $verification1 = $verification2
If $linereadnumber = $totalofLines and $verification1 <> $verification2 Then
    MsgBox(0, "BUSTED", "no user rights for you")
    Else
    MsgBox(0, "BINGO", "user rights for you")
EndIf
FileClose($file)
FileDelete(@TempDir & "\test.txt")

i continued to receive errors since I couldn't tell which line in the txt-file needed to be searched for and that _FileCountLines just solved my problem.

as you can see, a different approach, and we got it solved.

thx meger, you're added to the creditslist also now.

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