Advertisement
brianfgonzalez

Inno Setup - Custom Computer name prompt.

Oct 28th, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.40 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. WizardStyle=modern
  5. DisableWelcomePage=yes
  6. DisableFinishedPage=yes
  7. DisableProgramGroupPage=yes
  8. DisableReadyPage=yes
  9. DefaultDirName={autopf}\My Program
  10. DefaultGroupName=My Program
  11. ;UninstallDisplayIcon={app}\MyProg.exe
  12. Compression=lzma2
  13. SolidCompression=yes
  14. OutputDir=userdocs:Inno Setup Examples Output
  15.  
  16. [Files]
  17. Source: "*"; DestDir: "{tmp}\"; Flags: ignoreversion recursesubdirs
  18.  
  19. [Code]
  20. var
  21.   CustomQueryPage: TInputQueryWizardPage;
  22.  
  23. procedure AddCustomQueryPage();
  24. begin
  25.   CustomQueryPage := CreateInputQueryPage(
  26.     wpWelcome,
  27.     'Custom message',
  28.     'Custom description',
  29.     'Custom instructions');
  30.  
  31.   { Add items (False means it's not a password edit) }
  32.   CustomQueryPage.Add('Custom Field:', False);
  33. end;
  34.  
  35. procedure InitializeWizard();
  36. begin
  37.   AddCustomQueryPage();
  38. end;
  39.  
  40. procedure CurStepChanged(CurStep: TSetupStep);
  41. begin
  42.   if CurStep = ssPostInstall then
  43.   begin
  44.     { Read custom value }
  45.     MsgBox('Custom Value = ' + CustomQueryPage.Values[0], mbInformation, MB_OK);
  46.     ComputerName: CustomQueryPage.Values[0];
  47.   end;
  48. end;
  49.  
  50. [Run]
  51. ;Filename: "powershell.exe"; \
  52.   ;Parameters: "-ExecutionPolicy Bypass -File ""{tmp}\Toolkit\Deployment-Application.ps1"""; \
  53.   ;WorkingDir: "{tmp}\Toolkit";
  54.  
  55. Filename: "{tmp}\Toolkit\Deploy-Application.exe"; \
  56.   Parameters: '-ComputerName ' + ComputerName; \
  57.   WorkingDir: "{tmp}\Toolkit";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement