HISE Logo Forum
    • Categories
    • Register
    • Login

    Automatic Installer for Windows: Inno Setup Script

    Scheduled Pinned Locked Moved Blog Entries
    8 Posts 4 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bendursoB
      bendurso
      last edited by bendurso

      Hello!

      I thought that maybe for some this Inno Setup script could be useful. It installs the plugin + samples automatically on the user's computer.

      It does the following:

      1. Asks the user where they have their VST3 plugins folder. {commoncf}\VST3 is selected by default, but the user can change it.
      2. It then asks where you want to install the samples.
      3. And finally it creates the LinkWindows file with the chosen location of the samples.

      (In this case I also added the file "AudioResources.dat" so that it is automatically installed in the userappdata folder)

      In this way, the user simply opens the plugin and already has everything configured.

      Paying attention to the * symbol at the end of the source file location because it includes the folders inside the selected folder. For example, inside the "D:\Downtown Grand Piano\Samples Folder*" location I have the folder called Downtown Grand Piano Samples. Inno Setup will include the folder inside “Samples Folder”, which is "Downtown Grand Piano Samples" (You can check the Inno Setup documentation if you need to understand this better.)
      Then the linkWindows file is autogenerated with the location chosen by the user + \Downtown Grand Piano Samples at the end.

      (I received help from GPT to automatically generate the linkWindows file, although it took me some time to make it work properly)

      [Files]
      Source: "D:\Downtown Grand Piano\AudioResources.dat"; DestDir: "{userappdata}\ZAK Sound\Downtown Grand Piano"; 
      Source: "D:\Downtown Grand Piano\VST3 File\*"; DestDir: "{code:GetVst3Directory}"; Flags: recursesubdirs
      Source: "D:\Downtown Grand Piano\Samples Folder\*"; DestDir: "{code:GetSampleDirectory}"; Flags: recursesubdirs createallsubdirs
      
      [Code]
      var
        Vst3DirectoryPage: TInputDirWizardPage;
        SampleDirectoryPage: TInputDirWizardPage;
      
      procedure InitializeWizard;
      begin
          SampleDirectoryPage := CreateInputDirPage(wpSelectDir, 'Select Samples Directory', 'Where would you like to install the samples?', 'Select the location where you want to install the samples (2.58GB). You can use an external drive if you have one.', False, '');
          SampleDirectoryPage.Add('');
          SampleDirectoryPage.Values[0] := ExpandConstant('{commoncf}\VST3\Downtown Grand Piano');
          
          Vst3DirectoryPage := CreateInputDirPage(wpSelectDir, 'Select VST3 Directory', 'Where would you like to install the VST3 file?', 'Select the default location of your VST3 plugins. In most cases, there is no need to make any changes.', False, 'Size: 29MB');
          Vst3DirectoryPage.Add('');
          Vst3DirectoryPage.Values[0] := ExpandConstant('{commoncf}\VST3');
      
       end;
      
      function GetVst3Directory(Param: String): String;
      begin
        Result := Vst3DirectoryPage.Values[0];
      end;
      
      function GetSampleDirectory(Param: String): String;
      begin
        Result := SampleDirectoryPage.Values[0];
      end;
      
      
      procedure CurStepChanged(CurStep: TSetupStep);
      var
        LinkWindowsFilePath: string;
        LinkWindowsFileContent: string;
        SampleDirectory: string;
        BaseDirectory: string;
      begin
        if CurStep = ssInstall then
        begin
          BaseDirectory := ExpandConstant('{userappdata}\ZAK Sound\Downtown Grand Piano');
          ForceDirectories(BaseDirectory);
      
          LinkWindowsFilePath := BaseDirectory + '\LinkWindows';
          if FileExists(LinkWindowsFilePath) then
            DeleteFile(LinkWindowsFilePath);
      
          SampleDirectory := GetSampleDirectory('');
      
          LinkWindowsFileContent := SampleDirectory + '\Downtown Grand Piano Samples';
      
          SaveStringToFile(LinkWindowsFilePath, LinkWindowsFileContent, False);
      
      S 1 Reply Last reply Reply Quote 5
      • S
        Sawer @bendurso
        last edited by

        @bendurso Thanks! That looks soo cool!! Can this be applied also for mac? Using packages for instance?

        Matt_SFM bendursoB 2 Replies Last reply Reply Quote 0
        • Matt_SFM
          Matt_SF @Sawer
          last edited by

          @Sawer No InnoSetup is PC only

          Develop branch
          Win10 & VS17 / Ventura & Xcode 14. 3

          1 Reply Last reply Reply Quote 1
          • bendursoB
            bendurso @Sawer
            last edited by bendurso

            @Sawer Packages doesn't allow the user to select the installation folder (as far as I know)

            S 1 Reply Last reply Reply Quote 0
            • S
              Sawer @bendurso
              last edited by Sawer

              @bendurso Ok, will dig into that. In any case thanks so much for the InnoSetup Version.

              1 Reply Last reply Reply Quote 1
              • O
                obolig
                last edited by

                This is super helpful! I implemented this with one of my projects and was able to have the installer place the samples in the desired location. When I open the VST, the samples are not connected.

                Is this automatic connection associated to the "AudioResources.dat" that is not included? Or is it something else?

                Thank you for your help

                bendursoB 1 Reply Last reply Reply Quote 0
                • bendursoB
                  bendurso @obolig
                  last edited by

                  @obolig The link of the plugin with the samples folder is made by the "LinkWindows" file inside {userappdata}\Your Brand\Your Plugin. This script creates that file.

                  When the user selects the directory, the scripts creates the file with this text location + "/Plugin Samples" (in my case /Downtown Grand Piano Samples).

                  Check the LinkWindows file created by the script (after running the installer) and you should find if there's some error.

                  O 1 Reply Last reply Reply Quote 1
                  • O
                    obolig @bendurso
                    last edited by

                    @bendurso Thank You! This helped me resolve the issue. I wrote the prompt for the LinkWindows file to look inside of the samples folder instead of the samples folder itself. Everything is working great now.

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post

                    47

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    101.9k

                    Posts