Results 1 to 6 of 6

Thread: Download multiple files / pages from internet?

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Download multiple files / pages from internet?

    Imagine you have to download multiple pages from internet. Some files, some pages, some FTP ...
    Here an example you can amend as you prefer.

    Create a text file with the following lines and name it "Sites.txt".
    It will contain the list of the downloads you need to perform. Just an example:
    [code=thinbasic]http://www.thinbasic.com/
    http://www.codingmonkeys.com
    ftp://ftp.suse.com/pub/projects/tcl/README
    [/code]

    And this is the thinBasic script
    [code=thinbasic] Uses "File" '---Load File module needed for File_Load function
    Uses "iNet" '---Load iNet module needed for iNet_UrlDownload function

    '---Loads all file lines
    DIM Sites AS STRING = File_Load(App_SourcePath & "Sites.txt")

    '---Determine the number of lines
    DIM nLines AS LONG = PARSECOUNT(Sites, $CRLF)

    '---This function will parse the input string for $CRLF delimiters
    ' filling and dimensioning sLines array
    DIM sLines() AS STRING
    PARSE Sites, sLines, $CRLF

    '---Now scan the array in order to find whatever string
    ' If string is found, corresponding line will be appended
    ' to output buffer
    DIM Count AS LONG
    DIM Ret AS LONG
    FOR Count = 1 TO nLines
    Ret = INET_URLDownLoad(sLines(Count), APP_SOURCEPATH + "FileOut" & Count & ".txt")
    IF Ret <> %TRUE THEN
    msgbox(0, "Error code for line " & Count & ": " + Ret)
    END IF
    NEXT

    '---End
    MSGBOX 0, "End of the script"
    [/code]

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    Member matthew's Avatar
    Join Date
    Mar 2007
    Location
    England
    Age
    47
    Posts
    489
    Rep Power
    66

    Re: Download multiple files / pages from internet?

    That's really good, I never knew that thinBASIC could do those kind of things.
    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

  3. #3

    Re: Download multiple files / pages from internet?

    Hi Matthew,

    there are a lot of things that ThinBASIC is able to do easily, unfortunatly it take a lot of time develop, document and maintain them so often there ins't time left to show how to ... make with ThinBasic.
    I think that it should be a very good thing have an online script repository where user can search script ready to use or code to adapt, but for now this ins't our first priority target.

    Ciao,
    Roberto
    http://www.thinbasic.com

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: Download multiple files / pages from internet?

    That is a great idea Roberto, and maybe a wiki should be used for this. You guys can have all the help keywords as an outline and then users who scripts that would be good examples of useage of those keywords could put up their scripts.

    Or setup a way to upload a script and have a utility that scans all the keywords used and uses them as tags to help find useage of that command.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: Download multiple files / pages from internet?

    Hi guys,

    I think there is way to do it, but it has not been used for ages:
    http://scripts.thinbasic.com/


    Bye,
    Petr

    EDIT: Eros was faster in other thread
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: Download multiple files / pages from internet?

    Yes, I think the scripts repository should be used for this. I will try to add stuff too!

Similar Threads

  1. Do you need to download multiple files / pages from internet?
    By ErosOlmi in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 16-10-2006, 10:46

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •