Topic: Updater for software

Hi all. Is there a way to create a button to check a new version of  my software? Or if I start the program it check if there is a new version? I prefer the auto check if it's possible

Re: Updater for software

To implement such functionality, you will need a lot of code, for example, this:

procedure CheckAndUpdate( AShowIfNotFound: boolean );
// проверить обновления и обновить
var
  tmpNewVersion:string;
begin
  case CheckNewVersion(tmpNewVersion) of
  CU_ERROR: ShowMessage( S_.UPD_ERROR.Caption ); // общая ошибка
  CU_NEW_VERSION_AVALIABLE: begin // доступна новая версия, доступно автообновление
    if MessageBox( Format( S_.UPD_NEW_VER.Caption, [tmpNewVersion] ), S_.INFORMATION.Caption, MB_YESNO + MB_ICONINFORMATION ) = IDYES then
      GetNewVersion(tmpNewVersion);
  end;
  CU_NO_UPDATES_FOUND: if AShowIfNotFound then ShowMessage( S_.UPD_NO_UPDATES_FOUND.Caption ); // обновления не найдены
  CU_MANUAL_UPDATE: begin // ручное обновление
    if MessageBox( Format( S_.UPD_MANUAL_UPDATE.Caption, [tmpNewVersion] ), S_.INFORMATION.Caption, MB_YESNO + MB_ICONINFORMATION ) = IDYES then
        OpenURL( S_.ACT_URL_HELP.Caption ); // возможно, понадобится отдельный ресурс, пока используется один и тот, же, что для описания программы
  end;
  CU_CHECK_INTERNET:ShowMessage( S_.UPD_CHECK_CONNECTION.Caption ); // нет соединения с сайтом
  end;
end;

...and this

function CheckNewVersion(var ANewVersion:string ): integer;
// проверка наличия новой версии. извлечение номера новой версии
var
  tmpFile: string; // для загрузки описания обновления
  tmpList: TStringList; // сценарий обновления
  tmpBuld: string; // последний релиз
  tmpCompVer: array of string; // список версий, с которыми совместима последняя версия
  i: integer;
  tmpCurVer: string;
  tmpURL: string;
begin
  Result := CU_ERROR;
  tmpCurVer := APP_VERSION+'.'+APP_BUILD; // текущая версия приложения
  tmpFile := GetTmpFileName('.txt');
  try
    //
    if DebugMode then
      tmpURL := URL_DEBUG_DOWNLOAD + UPDATE_SCENARIO_FILENAME
    else
      tmpURL := URL_DOWNLOAD + UPDATE_SCENARIO_FILENAME;
    // скачать файл с описанием обновления
    try
      HTTPGetFile(tmpURL, tmpFile, True );
    except
      Result := CU_CHECK_INTERNET;
      exit;
    end;
    tmpList := TStringList.Create;
    tmpList.LoadFromFile(tmpFile);
    ANewVersion := tmpList.Values( UT_LAST_VERSION ); // версия в формате <Major>.<Minor>.<Build>
    //
    tmpBuld := ANewVersion;
    delete(tmpBuld,1,pos('.',tmpBuld ));
    delete(tmpBuld,1,pos('.',tmpBuld ));
    // сравниваем билды
    if StrToInt(tmpBuld) > StrToInt(APP_BUILD) then
    begin // найдена новая версия
      Result := CU_MANUAL_UPDATE;
      tmpCompVer := SplitString( tmpList.Values( UT_COMPATIBLE_VERSIONS ), ',' );
      for i := 0 to Length(tmpCompVer) - 1 do
        if tmpCompVer[i] = tmpCurVer then
        begin
          Result := CU_NEW_VERSION_AVALIABLE; // версия может быть загружена автоматически
          break;
        end;
    end
    else
      Result := CU_NO_UPDATES_FOUND; // ничего не найдено
    // зачистка
    tmpList.Free
    //
  finally
    DeleteFile(tmpFile); // удалить временный
  end;
end;

...and more.


You will also need your own website, where you will need to place a text information file. In this file, store scripts for versioning and updating them.

Визуальное программирование: блог и телеграм-канал.

Re: Updater for software

hello k245
any new about dmitry??

Re: Updater for software

StateOne wrote:

hello k245
any new about dmitry??

I'm sorry, but I don't have any news about him. The last time we talked on Skype was in January of this year. He's online, so he's most likely alive smile

Визуальное программирование: блог и телеграм-канал.

Re: Updater for software

Thanks' k245, I will study it

Re: Updater for software

k245 wrote:
StateOne wrote:

hello k245
any new about dmitry??

I'm sorry, but I don't have any news about him. The last time we talked on Skype was in January of this year. He's online, so he's most likely alive smile

thanks K245
we need Dmitiry's presence on foram... can anyone send this message to dmitry...

Re: Updater for software

Hi k245 a question for you. How can I use the google drive for that or the google word. Can you send an example?

Re: Updater for software

v_pozidis wrote:

Hi k245 a question for you. How can I use the google drive for that or the google word. Can you send an example?

About years ago, Google closed the possibility of direct access to its files, so you won’t be able to get a file from a Google drive by simply downloading it. Requires the use of the API. I don't have a solution. Authorization seems especially difficult to me. But perhaps other forum members will be able to share their experience in this direction.

Визуальное программирование: блог и телеграм-канал.

9 (edited by v_pozidis 2022-03-29 08:01:40)

Re: Updater for software

ok k245 thank's for your help
I have a script which works in Visual Basic (2008 Express). The file that I use is from the Google Word, it;s not an uploaded file.
Can I send you the script and "translate" it in pascal ? I do not have this knowledge


k245 wrote:
v_pozidis wrote:

Hi k245 a question for you. How can I use the google drive for that or the google word. Can you send an example?

About years ago, Google closed the possibility of direct access to its files, so you won’t be able to get a file from a Google drive by simply downloading it. Requires the use of the API. I don't have a solution. Authorization seems especially difficult to me. But perhaps other forum members will be able to share their experience in this direction.

Re: Updater for software

v_pozidis wrote:

ok k245 thank's for your help
I have a script which works in Visual Basic (2008 Express). The file that I use is from the Google Word, it;s not an uploaded file.
Can I send you the script and "translate" it in pascal ? I do not have this knowledge

I can try )))

Визуальное программирование: блог и телеграм-канал.

Re: Updater for software

k245 wrote:
v_pozidis wrote:

ok k245 thank's for your help
I have a script which works in Visual Basic (2008 Express). The file that I use is from the Google Word, it;s not an uploaded file.
Can I send you the script and "translate" it in pascal ? I do not have this knowledge

I can try )))

Thanks' k245. I will send it to you in a view hours. I am currently at work. Please  keep a watch in the forum

12 (edited by v_pozidis 2022-03-29 15:08:36)

Re: Updater for software

In my google account I have a doc file using the google Word and the connection link is public for all. The name of the file is vertest. the file has only a text in it   If you could  "translate" it in pascal . I place the following procedure also in a text file to read it better.


This is the script written in Visual Basic 2008

Private Sub LinkLabel3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked

        On Error GoTo erweb1

        Dim web As New WebClient
        Dim Update As String = web.DownloadString("https://docs.google.com/document/d/1J5czjH1cyhHSGc2ZVhWL8qGNU7j6hrTQhTS6c5ZWlIk/edit?usp=sharing")

        If Update.Contains(Application.ProductVersion) Then
            MsgBox("No new version found.", MsgBoxStyle.Information)
            anavathisi = False

        Else
            MsgBox("New version found.", MsgBoxStyle.Information)
            anavathisi = True
        End If


        Exit Sub
erweb1:
        MsgBox("No connection")
        Exit Sub


    End Sub

Post's attachments

Attachment icon checkupdate.txt 774 b, 150 downloads since 2022-03-29 

Re: Updater for software

v_pozidis wrote:

In my google account I have a doc file using the google Word and the connection link is public for all. The name of the file is vertest. the file has only a text in it   If you could  "translate" it in pascal . I place the following procedure also in a text file to read it better.


This is the script written in Visual Basic 2008

Private Sub LinkLabel3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked

        On Error GoTo erweb1

        Dim web As New WebClient
        Dim Update As String = web.DownloadString("https://docs.google.com/document/d/1J5czjH1cyhHSGc2ZVhWL8qGNU7j6hrTQhTS6c5ZWlIk/edit?usp=sharing")

        If Update.Contains(Application.ProductVersion) Then
            MsgBox("No new version found.", MsgBoxStyle.Information)
            anavathisi = False

        Else
            MsgBox("New version found.", MsgBoxStyle.Information)
            anavathisi = True
        End If


        Exit Sub
erweb1:
        MsgBox("No connection")
        Exit Sub


    End Sub

Nothing will come of it, since MVDB does not have a WebClient component or its equivalent.

Визуальное программирование: блог и телеграм-канал.

Re: Updater for software

k245 wrote:
v_pozidis wrote:

In my google account I have a doc file using the google Word and the connection link is public for all. The name of the file is vertest. the file has only a text in it   If you could  "translate" it in pascal . I place the following procedure also in a text file to read it better.


This is the script written in Visual Basic 2008

Private Sub LinkLabel3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked

        On Error GoTo erweb1

        Dim web As New WebClient
        Dim Update As String = web.DownloadString("https://docs.google.com/document/d/1J5czjH1cyhHSGc2ZVhWL8qGNU7j6hrTQhTS6c5ZWlIk/edit?usp=sharing")

        If Update.Contains(Application.ProductVersion) Then
            MsgBox("No new version found.", MsgBoxStyle.Information)
            anavathisi = False

        Else
            MsgBox("New version found.", MsgBoxStyle.Information)
            anavathisi = True
        End If


        Exit Sub
erweb1:
        MsgBox("No connection")
        Exit Sub


    End Sub

Nothing will come of it, since MVDB does not have a WebClient component or its equivalent.


Thank's for the try