Post by xxgeek on Jul 21, 2021 19:49:52 GMT
This writes 2 temp scripts and a temp file(for the destination path) to the folder it is run from.
Save the bas file to a folder of it's own before running.
It works with url's(links) that allow access, but wscript will error if no access allowed.
Now works with Small files and Large files like iso's of Linux distros
I used a different method (the curl command) to get the download.
The file downloaded will be in the same dir as this file is run from.
Please don't rush to give feedback. I come back and test what I post and fix problems without the feedback. Thanks
Save the bas file to a folder of it's own before running.
It works with url's(links) that allow access, but wscript will error if no access allowed.
Now works with Small files and Large files like iso's of Linux distros
I used a different method (the curl command) to get the download.
The file downloaded will be in the same dir as this file is run from.
Please don't rush to give feedback. I come back and test what I post and fix problems without the feedback. Thanks
'Title - JB File Downloader
'Author xxgeek - a member of the Just Basic forums - Visit https://justbasiccom.proboards.com
'Purpose - To download a single file
' I used these links for testing
' https://download.sysinternals.com/files/Autoruns.zip -
' https://muug.ca/mirror/linuxmint/iso/stable/20.2/linuxmint-20.2-cinnamon-64bit.iso
' https://mirror.csclub.uwaterloo.ca/linuxmint/stable/20.2/linuxmint-20.2-cinnamon-64bit.iso
' All links worked well
nomainwin
WindowWidth = 400
WindowHeight = 220
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
statictext #main.jbforums, "Visit https://justbasiccom.proboards.com/", 70, 175, 450, 15
statictext #main.header, "File Downloader for Just Basic v2.0", 30, 10, 350, 35
statictext #main.paste, "Paste (or Type) Link to File Below", 100, 55, 250, 20
button #main.default, "Download File", [progrun],UL 125, 130, 150, 35
textbox #main.file, 20, 80, 350, 30
'Set Font's for this window, statictext, and buttons
open "JB File Downloader" for dialog_nf as #main
#main, "trapclose [quit.main]"
#main, "font Arial 10 bold"
#main.file, "!font Arial 10 bold"
#main.header, "!font Arial 14 bold"
#main.default, "!font Arial bold 12"
#main.paste, "!font Arial 12 bold"
#main.file, "!setfocus"
wait
'run curl to get the file - Download will be in same folder as this running bas file
[progrun]
#main.file "!contents? file$"
q$ = chr$(34) 'quotes - used to create quotes in copied text
run "curl -O ";q$;file$;q$
'inform user where file will be downloaded to
notice file$;" Close this Notice when Download Completes. Your Downloaded File will be in ";chr$(13);chr$(13);DefaultDir$
close #main
end
[quit.main]
close #main
end