preprocessor


How to set ISPP defines based on default Inno Setup variables?


I was trying to:
#define CommonAppData {commonappdata}
but it yields:
Compiler Error
[ISPP] Expression expected but opening brace ("{") found.
How to achieve this with Inno Setup PreProcessor?
{commonappdata} cannot be expanded at compile time, i.e. when the pre-processor runs because it is only known at runtime: It identifies the common application data directory on the machine where the compiled installer is run.
Maybe if you could clarify how you intend to use that define we might be able to help. If for example what you're really interested in is not the common app data directory on the target machine but the one on the developer machine, then you can probably use this:
#define CommonAppData GetEnv("COMMONAPPDATA")
If however you intend to use that define for populating Inno properties that are themselves capable of expanding the constant at runtime then you should use this:
#define CommonAppData "{commonappdata}"
Hope this helps.
#define is a inno setup pre-processor directive, in a pre-compile phase. It works much like a C pre-processor.
By defining a pre-processor variable, we force the compiler to see a script after the ispp defines are resolved:
Inno Setup Preprocessor (ISPP) is an add-on for Jordan Russell's Inno Setup compiler. More technically speaking, it is an additional layer between GUI (your Inno Setup script) and the compiler, which before passing the text intercepts and modifies it in a way it is told by using special directives in the script text.
That said, I can't find a source in documentation nor have time to digg into the source code, but I'm pretty sure inno setup variables are not available during this pre-compile time.
If you just want the defined variable to contain the string {commonappdata}, use it directly in your source... if you want the defined variable to have the run-time value of commonappdata, it doesn't seem possible to me, because that value is determined at runtime as its current value depends on the target machine (windows version, language, etc.).
If you think it twice, it doesn't make sense to try to use that value at pre-compile or compile time... this is just the whole fact that brings inno setup constants like {commonappdata}, {destdir} and the like to existence... that you can express in a standard way at compile time a unknown but meaningful value, which will be known and evaluated at runtime.
You'll probably need to escape the brace. Something like:
#define CommonAppData {{commonappdata}

Related Links

Defining preprocessor symbols for CLion analyzer
Check multiple conditions at once using m4 preprocessor
XC8 warning: (107) illegal # directive “foo”
Compiling with ocamlbuild and camlp5
How not to output comments using the -C operation in mcpp
C++ Builder File Version not correct
How do you a preprocess statement for #include
Does the preprocessor pass environment variables?
YAML preprocessor / macro processor
Pre-Processing using m4
Is there a practical reason for “#if defined(X) && (X != 0)”?
How to check for presence of a directory in Inno Setup preprocessor?
What are analogs of “#ifdef”, “#ifndef”, “#else”, “#elif”, “#define”, “#undef” in D programming lnaguage?
Image pre-processing in OCR
which is more important, number of variables or subexpressions?
What is the purpose of using #define to define a constant with no value?

Categories

HOME
url-redirection
porting
linkedin
wakanda
rsa
static
ms-access-2016
rom
big-o
3d-reconstruction
gluon-mobile
trac
sendgrid-api-v3
pattern-matching
octave
google-chrome-app
rtf
php-5.6
openbugs
stellar.js
code-generation
atlassian
event-sourcing
mathprog
google-container-registry
replication
asciidoctor-pdf
slidetoggle
jackson-modules
inversion-of-control
handler
spotipy
iis-express
magento-1.8
git-squash
clickjacking
hard-drive
video-capture
nohup
railstutorial.org
odoo-website
skylink
mschart
configurationmanager
rserve
check-mk
seq
flyout
donations
tooleap
dimension
simevents
google-query-language
query-by-example
beanstalk
spring-retry
custom-errors
video-player
binomial-theorem
jdk1.7
branch-and-bound
cwrsync
telepat
rrule
webmatrix-3
angular-gettext
pseudo-class
wxformbuilder
twitter-bootstrap-rails
printdialog
inappsettingskit
poker
diem
booksleeve
saleslogix
objectquery
inkcanvas
jquery-tools
htdocs
commerceserver2007
isapi-extension
sifr
burndowncharts
silverlight-oob
web-application-project
windows-identity
firefox-3
pnrp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App