Jump to content

[Solved] InetRead


Recommended Posts

I have been playing around with InetGet, this example code i found in the help files here:

Local $sData = InetRead("http://www.autoitscript.com/autoit3/files/beta/update.dat")
Local $nBytesRead = @extended
MsgBox(4096, "", "Bytes read: " & $nBytesRead & @CRLF & @CRLF & BinaryToString($sData))

I have tried a handful of different techniques, but to no avail, What I need is to find the Value of a particular key. The ini file that this script directs you to looks like this:

[AutoIt]

version=3.3.6.1

index=http://www.autoitscript.com/autoit3/downloads.php

setup=http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.3.6.1-setup.exe

filesize=8406664

filetime=20100416085023

[AutoItBeta]

version=3.3.5.6

index=http://www.autoitscript.com/autoit3/files/beta/autoit/

setup=http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.3.5.6-beta-setup.exe

filesize=8136680

filetime=20100228170411

If needed to get the value '3.3.6.1' from key 'version' from section 'AutoIT'

How would I do this?

Edit:

...Or is this possible? if not, is there a way to download and save the file on my pc, than I could use IniRead to get my info?

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

Local $sFilename = @TempDir & "\autoit_version.dat"
Local $nBytesRead = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", $sFilename, 1)
Local $sVersion = IniRead($sFilename, "AutoIt", "version", -1)
FileDelete($sFilename)
ConsoleWrite("Bytes read: " & $nBytesRead & @CRLF & $sVersion & @CRLF)

That is perfect, Thanks!

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

If needed to get the value '3.3.6.1' from key 'version' from section 'AutoIT'

How would I do this?

If you don't want to save the file this code should works but I think saving the file and use IniRead is a better solution:

$sData = BinaryToString(InetRead("http://www.autoitscript.com/autoit3/files/beta/update.dat"))
$aData=StringSplit($sData,chr(10))
$aData=StringSplit(StringStripCR($aData[2]),"=")
MsgBox(0,"","Autoit version is: " & $aData[2])

Regards,

sahsanu

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