Here is the whole "scratch book" drawing I am workiing on.
I tried all this with wget, curl and powershell and currently working with a download script from spriggy. Since powershell works well, I found there was a problem with windows 7 fresh install, because you need I believe PS5+. The command that allows you to download doesn't work on earlier versions, and I wanted this to work on fresh installs. I could have used the curl/wget but each had their own problems (mostly security and SSL issues) and besides, I wanted a self contained version, thus spriggy idea. But that was problematic. Example I did another win7 fresh install, and the download no longer works. Not sure whats missing and why it worked on the other win7 but not my fresh one.
Still looking for a progress bar -
I did see another site appget.net that has a progress bar and looks identical to what I was trying to do. Just saw it 2 days ago and tried it out. Perfect. LOL. puts mine to shame /sigh
here is their source code:
https://github.com/appget/appget/tree/master/srchavent looked at it,as I do not use or even looked at c-sharp.
So now just using it as a learning too. I still want to see if i can get this to do downloads without having to resort to 3rd party and use all QB64 natively
Take a look and see what you think
you can use the database here
https://appgetmgr.com/db/app.txtsave it as app.db
Const REL
= "210709.0519" Const DATABASE
= "app.db" Const DOWNLOAD_FOLDER
= "dl\" Const APP_NAME
= "AppGet Manager"
'create a download dir if not exists
' act on param sent
appGetHeader
'*** D O W N L O A D I N G F I L E
'*** Strip the filename off the end
'*** "file" is appended at the back of mediafire files.
thisAppLink
= Mid$(thisAppLink
, 1, Len(thisAppLink
) - 5)
LWRITELN "`2Downloading ... [ `0" + filename + " ]"
LWRITELN "`#URL: `%" + thisAppLink
'*** download it...
'Shell "cd " + DOWNLOAD_FOLDER + " && curl -LO -k " + thisAppLink + " && cd .."
'Shell "cd " + DOWNLOAD_FOLDER + " && Powershell -Command Invoke-WebRequest -Uri " + thisAppLink + " -Outfile " + filename + " && cd .."
LWRITELN "`6Downloading now, one moment . . ."
appTxt = FileDownload(thisAppLink, "dl/" + filename)
Print "Problem retreiving " + filename
+ " from " + thisAppLink
LWRITELN "`0Success! `6Your file has been saved to `%.\DL\ "
LWRITELN "`7If you do not see " + filename + "installing, check the taskbar below"
'check to see if it is an archive 7z,zip,rar,arj.exe
'*** originall was going to clean up, but save downloaded files
'Kill DOWNLOAD_FOLDER + filename
appGetHeader
LWRITELN "`!Usage: appget command [`%appname...]"
LWRITELN "`3Available commands:"
LWRITELN " `%d - `7download appname (or partial search)"
LWRITELN "`7Example:"
LWRITELN "`2appget `$d `0notepad`7"
' $include: 'utils.bi'
FileDownload
= URLDownloadToFileA
(0, URL
+ Chr$(0), File
+ Chr$(0), 0, 0)
'*** see page for variable types
'*** in order to work must be defined as offset
'*** https://www.qb64.org/wiki/Variable_Types
'If _FileExists("app.db") Then Kill "app.db"
LWRITE "`8Reading remote database...."
'*** download it...
'check to see if there is an existing one
appTxt = FileDownload(REMOTE_DB, "app.db") ' download the db and save it to "APP.DB"
Print "AppTxt Val = "; appTxt
LWRITELN "`4*** `2ISSUE RET RIEVING DATABASE `4***`7"
LWRITELN "`8Location: " + REMOTE_DB + "`7"
'Shell _Hide "rename app.txt app.db"
LWRITELN "`%Done!"
downloadDB
'If Not _FileExists(DATABASE) Then findApp = "": Exit Function
recNum = 1
appGetHeader
openDB
recCount = recCount + 1
'Remove the trailing "," if there is one.
'Sometimes I use a spread sheet to organize and when exporting it
'adds aother ","
EXPLODE aline, ",", d()
LWRITE "`8[`%"
LWRITE "`8] `3"
LWRITE " `8ver. `7"
matches(recNum) = d(2)
recNum = recNum + 1
Kill "app.db" ' Make sure each db is downloaded fresh
Print "Scanned "; recCount;
" files..." Print appname;
" not found. Put in a request"
LWRITELN
"`8[ `@0 `8] `4Cancel":
Print Line Input "Select id of app to install: "; appSelectStr: recNum
= Val(appSelectStr
) findApp$ = matches(recNum)
LWRITELN "`3- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
LWRITELN "`!" + APP_NAME + " x64 (Windows)`3 rel: `#" + REL
LWRITELN "`3- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
Required for pretty colored text :-)
'======================================================
'--- THIS IS A POPULAR COLOR ROUTINE BASED ON THE
'--- SETH ABLE L.O.R.D. BBS GAME COLOR FORMATTING
'=====================================================
' CHECK FOR A COLOR CHANGE
i = i + 1
i = i + 1
LWRITE (TXT$)