Blog Post

Small Basic Blog
1 MIN READ

Small Basic: Network Object

NonkiTakahashi's avatar
NonkiTakahashi
Iron Contributor
Feb 12, 2019
First published on MSDN on Nov 17, 2014

Authored by Nonki Takahashi


Today I will talk about Network Object in Small Basic programming language.


Network Object is very simple.  There are only two operations.  That's all.  One is DownloadFile().  The other is GetWebPageContents().


Network.DownloadFile() downloads a network file into your PC's temporary folder.  The downloaded file name will become such like C:\Users\Nonki\AppData\Local\Temp\tmpFD3C.tmp .  You can download HTML, PNG, JPG and so on.  This operation allow some programs using network files to be run offline after once run online.


Network.GetWebPageContents() gets HTML and text from network.  I made a sample program Blog Article List as CPP576 .  This program makes a list of articles in this blog.



Network object runs only as desktop program from Small Basic IDE (not in browser).

Published Feb 12, 2019
Version 1.0

2 Comments

  • GuillermoR115's avatar
    GuillermoR115
    Copper Contributor

    I got it. I used "GraphicsWindow.DrawText(50, 345, "One file downloaded as"+path)" instead of "TextWindow.WriteLine("One file downloaded as " + path)"

    Now, I have the address where the file was downloaded. I hope this helps others. I spent one day or more trying to figure this out.

  • GuillermoR115's avatar
    GuillermoR115
    Copper Contributor

    I have not been able to make the Network.DownloadFile()work at all. I get nothing.

    I even copied this:

    EnterBox = Controls.AddButton("All Tables", 10,10)
    LF = Text.GetCharacter(10)
    url = "http://technet.microsoft.com"
    txt = Network.GetWebPageContents(url)
    eol = Text.GetIndexOf(txt, 10)
    TextWindow.WriteLine(Text.GetSubText(txt, 1, eol - 1))
    path = Network.DownloadFile(url)
    TextWindow.WriteLine("One file downloaded as " + path)
    Directly from a tutorial. It returns nothing. The WriteLine shows One file downloaded as and nothing else.

    Am I doing something wrong? I copied it directly. Am I missing a library?

    Thanks.