pascalscript

Replace placeholder in an installed text file with input entered by user

隐身守侯 提交于 2019-11-27 23:22:20
As part of an Inno Setup built installer, I want to output the text field that the user enters into the installer to a text file. So far I have the below: [Code] var PrimaryServerPage: TInputQueryWizardPage; PrimaryAddress: String; procedure InitializeWizard; begin PrimaryServerPage := CreateInputQueryPage(wpWelcome, 'Primary Server Details', 'Where is you application installed?', 'Please specify the IP address or hostname of your Primary Server, ' + 'then click Next.'); PrimaryServerPage.Add('Primary Server IP/Hostname:', false); PrimaryAddress := PrimaryServerPage.Values[0]; SaveStringToFile

Determine Windows version in Inno Setup

不羁的心 提交于 2019-11-27 23:21:50
I'm using Inno Setup to change the recycle bin in the OS. I need to make some cases for if the user is running Windows 7 or Windows XP. I try using: if not FileExists(winDir + '\System32\imageres.dll') then if not FileExists(winDir + '\System32\shell32.dll') then installError(3); But it seems like it can't find imageres.dll or shell32.dll even though I've verified they exist. What am I doing wrong? Or can I check the Windows version another way? You should use the GetWindowsVersionEx function. It fills a TWindowsVersion record: TWindowsVersion = record Major: Cardinal; // Major version number

Inno Setup: Working with JSON

余生长醉 提交于 2019-11-27 23:11:53
How can I load and work with JSON config file during install time? I can read string from file and write it, but if I want to change some value in config file, I have to use VBScript.RegExp COM object (which is good, but painful and slow to develop). Current method: ExtractTemporaryFile('config.json'); filename := ExpandConstant('{tmp}\config.json'); LoadStringFromFile(filename, conf); objRegExp := CreateOleObject('VBScript.RegExp'); objRegExp.Pattern := 'test'; conf := objRegExp.Replace(conf, 'test_replace'); SaveStringToFile(filenameOut, conf, False); Is there a better way to do this? All I

Inno Setup Get progress from .NET Framework 4.5 (or higher) installer to update progress bar position

冷暖自知 提交于 2019-11-27 21:44:37
I am currently installing .NET Framework 4.6.2 as a prerequisite in the PrepareToInstall event function so that I can obtain the exit code, set the NeedsReboot status, or abort if installation fails. My code is below and this is all working fine. var PrepareToInstallLabel: TNewStaticText; PrepareToInstallProgressBar: TNewProgressBar; intDotNetResultCode: Integer; CancelWithoutPrompt, AbortInstall: Boolean; function InitializeSetup(): Boolean; begin Result := True; OverwriteDB := False; CancelWithoutPrompt := False; AbortInstall := False; end; function PrepareToInstall(var NeedsRestart: Boolean

Uninstallation order

大城市里の小女人 提交于 2019-11-27 18:53:42
问题 Can I find somewhere actual order, in which events and sections are executed during uninstall? For example, will UninstallDelete occur earlier than usPostUninstall uninstall step? Inno Setup has "Installation order" article in manual, but it looks more like compilation order, not execution. 回答1: The uninstallation order is an opposite of the installation order, just as the manual says (and it is really the installation order, not a compilation order). It's simply because there's no programmed

How do read and set the value of a checkbox in an InnoSetup wizard page?

一笑奈何 提交于 2019-11-27 16:31:59
问题 I have added a checkbox to the "Additional Tasks" page of an InnoSetup script with [Tasks] Name: "StartMenuEntry" ; Description: "Start my app when Windows starts" ; GroupDescription: "Windows Startup"; MinVersion: 4,4; I want to initialize this checkbox when the wpSelectTasks page shows, and read the value when the Next button is clicked. I can't work out how to access the checkbox `checked' value. function NextButtonClick(CurPageID: Integer): Boolean; var SelectTasksPage : TWizardPage ;

Use two/multiple selected directories from custom page in Files section

雨燕双飞 提交于 2019-11-27 15:56:05
I need create custom page of two destination. I've done: #define MyAppName "TESTPROG" [Setup] AppName={#MyAppName} DefaultDirName=C:\test\{#MyAppName} DefaultGroupName={#MyAppName} [Code] var Page: TInputDirWizardPage; DataDir: String; procedure InitializeWizard; begin Page := CreateInputDirPage(wpWelcome, 'Select Personal Data Location', 'Where should personal data files be stored?', 'Personal data files will be stored in the following folder.'#13#10#13#10 + 'To continue, click Next. ' + 'If you would like to select a different folder, click Browse.', False, 'New Folder'); Page.Add('Local APP

Run a [Code] or PowerShell script in Inno Setup compiler

。_饼干妹妹 提交于 2019-11-27 15:51:52
Is there a way to run a [Code] procedure or PowerShell script in the Inno Setup compiler before the installation executable is generated? You may get better answers, if you explain what you need to run the code for. Anyway... One way is to compile the script on command-line from a batch file: powershell -file precompile.ps1 ISCC.exe setup.iss powershell -file postcompile.ps1 (or you can call ISCC.exe from the PowerShell script itself) Another way to run some script before compilation is using Exec preprocessor function . #expr Exec("precompile.bat") or #expr Exec("powershell -file precompile

Writing binary file in Inno Setup

∥☆過路亽.° 提交于 2019-11-27 15:23:25
How does one write to a binary file in Inno Setup script? It's a configuration file I want to edit in the PrepareToInstall step. The problem is that I'm looking at the support functions: TStream = class(TObject) function Read(Buffer: String; Count: Longint): Longint; function Write(Buffer: String; Count: Longint): Longint; function Seek(Offset: Longint; Origin: Word): Longint; procedure ReadBuffer(Buffer: String; Count: Longint); procedure WriteBuffer(Buffer: String; Count: Longint); function CopyFrom(Source: TStream; Count: Longint): Longint; property Position: Longint; read write; property

How to check with Inno Setup, if a process is running at a Windows 2008 R2 64bit?

女生的网名这么多〃 提交于 2019-11-27 14:49:32
问题 I've read the following post. My Code looks exactly the same, but does not work: Inno Setup Checking for running process I copied the example from http://www.vincenzo.net/isxkb/index.php?title=PSVince But the example doesn't work either, even if I change the code like this: [Code] function IsModuleLoaded(modulename: AnsiString): Boolean; external 'IsModuleLoaded@files:psvince.dll stdcall'; The code always returns false (the program is not running, even it is running). Tested at Windows 2008