Ok, so ... vbs works.
For Garada, test this parameter in curl:
Code: Select all
w '%output{' + InstallerPath + curlOutputTmp + '}Download completed with response code %{http_code}\n'
This is how the code should look now (
I DON'T HAVE TESTED IT!)
Code: Select all
if (fileExists(InstallerPath + curlOutput)) then
DeleteFile(InstallerPath + curlOutput);
curlOutputTmp := curlOutput + '.tmp';
if (fileExists(InstallerPath + curlOutputTmp)) then
DeleteFile(InstallerPath + curlOutputTmp);
sCommand := '-L -w "%output{' + InstallerPath + curlOutputTmp + '}Download completed with response code %{http_code}\n" --output "' + InstallerPath + curlOutput + '" --url "' + address + '" ' + '-H "Accept: text/html, */*" -H "Accept-Language: it" -H "DNT: 1" -H "Priority: u=0, i" -H "Sec-Ch-Ua: \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\"" -H "Sec-Ch-Ua-Mobile: ?0" -H "Sec-Ch-Ua-Platform: \"Windows\"" -H "Sec-Fetch-Dest: Document" -H "Sec-Fetch-Mode: Navigate" -H "Sec-Fetch-Site: None" -H "Sec-Fetch-User: ?1" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: ' + curlUserAgent + '"';
Sleep(delayBetweenRequest);
Launch(curlPath, sCommand);
cnt := 0;
while ((not FileExists(InstallerPath + curlOutputTmp)) AND (cnt < 200)) Do
begin
cnt := cnt + 1;
Sleep(50);
end;
DeleteFile(InstallerPath + curlOutputTmp);
if (fileExists(InstallerPath + curlOutput)) then
begin
fileContent := TStringList.Create;
fileContent.LoadFromFile(InstallerPath + curlOutput);
[...]
How all this should work: Curl create InstallerPath + curlOutput file and SLOWLY it writes html in the file. Only AFTER the file is closed, Curl create another file, InstallerPath + curlOutputTmp and it writes something inside (Download completed with response code 200). When this file is created you can be 100% sure InstallerPath + curlOutput is closed and ready so you can use it.
Remember: this should work, I tested it but I deleted all the code so maybe you have to fix something with escaping, ', ", % or ... I don't remember now.
I did other test at your curl-only version but I don't like the prompt window (I got the same problem in mine curl-only version, that's why I deleted it). For a curl-only option I think we should wait for a new version of AMC where @antp will add an option to Launch command to hide its window.