During install I try to copy existing files from a folder defined in the registry. I use some user constants to find this folder.
Yet the constant doesn't seem to be expanded (is that a word?) and get the error unknown constant '#RegKey'.
Is there a way around this or do I have to code something in Pascal?
#define Version "2.0"
#define RegKey "MyExe v" + Version
[Setup]
// various stuff
[Files]
Source: {reg:HKLM64\SOFTWARE\MyCompanyData\{#RegKey},Path|\MyCompanyData\MyExe v1.0}\*; DestDir: {app}; Flags:external recursesubdirs onlyifdoesntexist
So sorry, pebkac, typing mistake in reg key :( And got deceived by the above mentioned glitch in the IDE Inno Setup - inconsistent (preprocessor / debugger) behavior for string variable with defined symbol inside
Thanks Martin for your help
Related
I have a problem when defining a file in the Inno Setup Files section. Some times when I use {src} constant and compile it I get an error that says the file doesn't exist.
Source: "{src}\dontReadMe.txt"; DestDir: "{tmp}";
And here is what I get:
That happened more when I use Flags dontcopy;.
Look at {src} in the path why it's there.
As the documentation for Source parameter says:
Constants may only be used when the external flag is specified, because the compiler does not do any constant translating itself.
Is there a way to dynamically fill the [Dirs] and [Files] sections of an Inno Setup script?
Here is what I am trying to do:
during the install process, the user will select foo (foo matches a repository to get from our SCM)
Setup will run a batch to checkout foo from our SCM
then the content of foo must be added to the [Dirs] and [Files] sections of the script
Everything works fine except for the last step. I searched around and couldn't find explanations on how to do this. I have the feeling that my script should embed all the repositories of our SCM to then be able to copy only the selected ones to the destination directory.
Thanks for your help!
Regards,
See Inno Setup Prompt for external file location.
And add the recursesubdirs flag.
You may also need the createallsubdirs flag (assuming from your reference to the [Dirs] section).
[Files]
Source: "{code:GetScmPath}"; DestDir: "{app}"; \
Flags: external recursesubdirs createallsubdirs
[Code]
function GetScmPath(Param: string): string;
begin
Result := { make it return path to the checked out files }
end;
I have an issue with ExtractTemporaryFiles while extracting *.sql files
I don't always have SQL scripts inside [Files] section to extract as mentioned below. My problem is ExtractTemporaryFiles('*.sql') raises an exception if no sql files are included with the installation.
Internal error: ExtractTemporaryFiles: No files matching "*.sql" found.
I can use try:except or another ugly way like, including a dummy.sql with the installation always. So I can make sure ExtractTemporaryFiles has a file to extract it always.
But I want to know What is the best way of avoiding exception in this case?
[Files]
Source: "Input\SQLSCRIPTS\*"; DestDir: "SQLSCRIPTS"; Flags: ignoreversion dontcopy skipifsourcedoesntexist
You can use a preprocessor to conditionally skip the ExtractTemporaryFiles call:
#if FindFirst("Input\SQLSCRIPTS\*.sql", 0)
ExtractTemporaryFiles('*.sql');
#endif
I try to use the macros / variables in the following way, but then I get an error. Can you advice please?
#define AnnotateDir "C:\Users\new_skin\Annotate\project"
#define AnnotateUserInstallAppData "{userappdata}\Annotate3"
[Files]
Source: {AnnotateDir}\bin\gm_annotate.exe; DestDir: {app}; Flags: ignoreversion external
You are missing # char before the variable name which is used to emit defined variable value during script preprocessing stage. You can fix your script this way:
#define AnnotateDir "C:\Users\new_skin\Annotate\project"
[Files]
Source: {#AnnotateDir}\bin\gm_annotate.exe; DestDir: {app}; Flags: ignoreversion external
It looks quite misleading, but e.g. the {app} constant will remain after preprocessing whilst your defined variable will be replaced by its value, so that's why they have different notation in script.
I am programming my Inno Setup Compiler that I was asking about earlier but had encountered a problem . How do I let the Installer add a Read me File?? I am using Inno Setup Compiler 5.5.3 and uses the following command "AppReadmeFile=C:\Users\Cordre\Desktop\D_C Databasis Tools\Read me.txt" in Inno but if I install the program their is no Read Me file in the Program files.
The text document does exist and is called correctly double checked that.
Is their any other command that I also have to use?
From the documentation on AppReadmeFile:
This string, which may be a URL, is displayed on the "Support" dialog
of the Add/Remove Programs Control Panel applet in Windows 2000/XP and
later. The value may include constants.
This directive has nothing to do with a README file in the Program Files directory. If you want a copy of the README in the Program Files directory, you'd need to add it to the [Files] section. For example:
[Files]
Source: "MyReadme.txt"; DestDir: "{app}"; Flags: ignoreversion
You can also add an icon to the file using the [Icons] section. According to the documentation, a sample Icons entry would be:
Name: "{group}\My Program"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"