Solo pon el codigo en un boton---Recuerda este codigo no es mio es de "San Rafa"
function getNewVersion()
newVersion = HTTP.Submit("http://[WWW.TUSERVER.COM]/version.php",{}, SUBMITWEB_GET, 20, 80, nil, nil);-- hacemos peticion rest al servidor al archivo version.php
appVersionInfo = File.GetVersionInfo(_SourceFolder.."\\".._SourceFilename); -- version actual de la pp
compare = String.CompareFileVersions(appVersionInfo.ProductVersion, tostring(newVersion));--Comparamos versiones
if(compare == -1)then-- hay una nueva actualizacion
--Dialog.Message("Update", "Hay una nueva actualización disponible ", MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1);
if(Dialog.Message("Update", "Hay una nueva actualización disponible ¿Quieres instalarla?", MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1)== IDOK)then
StatusDlg.SetTitle("Descargando . . . ");
StatusDlg.SetMessage("Archivo de actualización . . . ");
StatusDlg.SetMeterRange(0, 65534);
StatusDlg.Show(0, false);
-- descargamos actualizador UPDATE.exe
HTTP.DownloadSecure("https://[WWW.TUSERVER.COM]/[TU_UPDATE.exe]", _DesktopFolder.."\\[TU_UPDATE.exe]", MODE_BINARY, 20, 443, nil, nil, DownloadCallback);
StatusDlg.Hide();
--Comprobamos si hai errores
error = Application.GetLastError();
if error ~= 0 then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
else
Dialog.Message("OK","Descargado, Ejecuta [TU_UPDATE.exe]", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
File.Open(_DesktopFolder, "", SW_SHOWNORMAL);
Application.Exit(0);
end
end
end
end
function DownloadCallback (nDownloaded, nTotal, TransferRate, SecondLeft, SecondsLeftFormat, Message)
-- Convert total and downloaded bytes into formatted strings
sDownloaded = String.GetFormattedSize(nDownloaded, FMTSIZE_AUTOMATIC, true);
sTotal = String.GetFormattedSize(nTotal, FMTSIZE_AUTOMATIC, true);
-- Output time left, formatted.
StatusDlg.SetMessage("Currently downloading file . . . Time Left: " .. SecondsLeftFormat);
-- Output formatted sizes to user through statusdlg status text
StatusDlg.SetStatusText("Downloaded: " .. sDownloaded .. " / " .. sTotal);
-- Set meter position (fraction downloaded * max meter range)
StatusDlg.SetMeterPos((nDownloaded / nTotal) * 65534);
end