masterchipo wrote: 2025-08-29 11:49:34
Ahora se ha hecho tanto lío que me he perdido entre tantas enlaces, ya no sé cuál es.
El enlace con los archivos es este:
https://mega.nz/file/YQsxBRyD#NODP1tG5p ... 12vUkqMg08
Y si prefieres un AMC portable y ya configurado, Radagast compartió este:
viewtopic.php?p=92851#p92851
Rubendis wrote: 2025-08-29 13:27:11
Y te agradezco y espero con ansias tu version sin VBS.. mas info no puedo enviarte, quiero enviar una imagen de pantalla , pero no encuentro la forma cuando pincho imagen sale esto....
![Image]()
....en vez de abrir mis archivos para subirla.
NOTA: esta versión es un prueba para el usuario Rubendis, no está pensada para uso general
Te dejo por aquí la versión que no usa el VBS, hará la llamada directa a CURL y se puede ver unos momentos como se abre y cierra.
Si tienes problemas para copiar el texto y pegarlo en el archivo "ExternalCurlHandler.pas" me avisas y preparo una descarga.
Otra cosa aparte: cuando da error, solo dice error o da algún dato más?
Code: Select all
unit ExternalCurlHandler;
uses StringUtils7552;
const
UseVBS = False; // Use Visual Basic Script to hide curl windows, disable if you do not want to or cannot use VBS (p.e. Linux)
tmpDir = ''; // (optional) if you want get your scripts directory clean, set here your tmp working dir, example C:\Users\YOURWINDOWSUSER\AppData\Local\Temp\
delayBetweenRequest = 2001;
curlPath = 'curl.exe'; // if you use Windows 7 or 8 download curl.exe for Windows (it's free) and set here the right path
vbsScript = 'ExternalCurlHandler.vbs';
curlOutput = 'curlOutput.html';
curlUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36';
TimeOut = 10000; // Time to wait for response in ms
var
InstallerPath: string;
function GetPage5Advanced(address: string; referer: string; cookies: string; content: string; headers: string): string;
var
cnt: integer;
fileContent: TStringList;
curlOutputResult: string;
sCommand: string;
begin
Result := '';
// Create VBS file if not exists
if setupScript then
begin
// Delete temporal files
if fileExists(InstallerPath + curlOutput) then
DeleteFile(InstallerPath + curlOutput);
curlOutputResult := curlOutput + '.result';
if fileExists(InstallerPath + curlOutputResult) then
DeleteFile(InstallerPath + curlOutputResult);
// CURL parameters:
// Create info file with return codes and possible errors, it's created after page is downloaded
sCommand := '-w "%output{' + InstallerPath + curlOutputResult + '}%{url}\nExitCode: %{exitcode}\nErrorMsg: %{errormsg}\nResponseCode: %{http_code}"';
// Download page and save to file
sCommand := sCommand + ' -L --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 + '"';
//test slow connection, don't uncomment
//sCommand := '--limit-rate 1 ' + sCommand;
Sleep(delayBetweenRequest);
if UseVBS then
begin
// Launch CURL. Change " for #1 as VBS uses " for parameters. The VBS script undone the changes.
Launch('wscript.exe', '"' +InstallerPath + vbsScript + '" "' + curlPath + '" ' + StringReplace(sCommand, '"', #1));
end
else
Launch(curlPath, sCommand);
// Wait for end info file or timeout
cnt := 0;
while (not FileExists(InstallerPath + curlOutputResult)) and (cnt < TimeOut div 50) do
begin
cnt := cnt + 1;
Sleep(50);
end;
// if info file exists
if (fileExists(InstallerPath + curlOutputResult)) then
begin
fileContent := TStringList.Create;
try
// Read and delete info file
fileContent.LoadFromFile(InstallerPath + curlOutputResult);
DeleteFile(InstallerPath + curlOutputResult);
// if return error
if TextBetween(fileContent.Text, 'ErrorMsg: ', #13) <> '' then
ShowError('Error downloading page.' + #13 + fileContent.Text)
else if (fileExists(InstallerPath + curlOutput)) then // if downloaded page exits
begin
// Read and delete downloaded page
fileContent.LoadFromFile(InstallerPath + curlOutput);
DeleteFile(InstallerPath + curlOutput);
// Return page
Result := fileContent.Text;
//if Pos('</html>', Result) < 1 then
// ShowError('TRIM!!!');
end
else // no error, no download, no timeout...
ShowError('The page did not download');
finally
fileContent.Free;
end;
end
else // if not: timeout
ShowError('Internal Timeout!!');
end
else
begin
Sleep(delayBetweenRequest);
Result := GetPage5(address, referer, cookies, content, headers);
end;
end;
function setupScript: boolean;
var
ScriptContent: TStringList;
begin
Result := False;
// initialize working path
if (tmpDir <> '') then
InstallerPath := tmpDir
else
InstallerPath := dirScripts;
InstallerPath := IncludeTrailingPathDelimiter(InstallerPath);
// Create a generic VBS script that
// open a command with parameters in hidden window
if UseVBS then
if (not FileExists(InstallerPath + vbsScript)) then
begin
ScriptContent := TStringList.Create;
ScriptContent.Add('Dim Args()');
ScriptContent.Add('ReDim Args(WScript.Arguments.Count - 1)');
ScriptContent.Add('Args(0) = """" & WScript.Arguments(0) & """"');
ScriptContent.Add('For i = 1 To WScript.Arguments.Count - 1');
ScriptContent.Add(' Args(i) = Replace(WScript.Arguments(i), chr(1), chr(34))');
ScriptContent.Add('Next');
ScriptContent.Add('CreateObject("Wscript.Shell").Run Join(Args), 0, False');
ScriptContent.SaveToFile(InstallerPath + vbsScript);
ScriptContent.Free;
end;
Result := true;
end;
begin
end.