PDA

View Full Version : Download multiple files / pages from internet?



ErosOlmi
18-03-2007, 10:21
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:

http://www.thinbasic.com/
http://www.codingmonkeys.com
ftp://ftp.suse.com/pub/projects/tcl/README


And this is the thinBasic script

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"

matthew
18-03-2007, 10:44
That's really good, I never knew that thinBASIC could do those kind of things. :)

RobertoBianchi
18-03-2007, 18:47
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

kryton9
18-03-2007, 22:28
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.

Petr Schreiber
19-03-2007, 09:12
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 :)

Michael Hartlef
19-03-2007, 09:30
Yes, I think the scripts repository should be used for this. I will try to add stuff too!