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

indirectly quoting macro in traditional mode
KMP Preprocessing Function
How to detect Apportable with preprocessor flags?
Adjust data vector to have certain variance
Pre-process Laravel 4 view
File iteration with the preprocessor
processing strings of text for neural network input
How to Set Active Target in XCode 4.5+
Preprocessor assertions in arduino
expanding a macro within a macro definition
GNU-M4: Strip empty lines
Escaping space in OpenCL compiler arguments
Does Corona have preprocessor statements so I can execute Lua code for specific devices?
Preprocessing in C++
Truncate string in cpp (preprocessor)
C++ precompiler conditionally include code

Categories

HOME
django
cygwin
microsoftgraph
adal
deep-learning
spark-streaming
cheerio
css3
twig
jsf-2.2
mips
bookmarks
android-json
trac
boto3
nfs
special-characters
syntaxnet
commonjs
gson
libc
symbol
digital-signature
breadth-first-search
visual-glitch
libigl
inno-download-plugin
jquery-callback
ckfinder
pic32
oculus
bioinformatics
iis-express
browser-sync
powershell-ise
card.io
joomla2.5
sql-delete
processwire
xajax
git-rewrite-history
jpad
graphhopper
watchface
postgresql-8.4
android-ibeacon
movilizer
glm-math
bindingnavigator
fwrite
openresty
custom-font
boo
mach-o
monkey
pocketsphinx-android
change-tracking
vcloud-director-rest-api
chromium-os
meteor-packages
qtplugin
burrows-wheeler-transform
embedding
cassia
angular-ui-typeahead
bizagi
exim4
contentcontrol
tfs-workitem
vigenere
intel-c++
fuelcms
google-refine
nsurlsessiondatatask
android-broadcast
shopizer
java-security
document-repository
nodelist
showdialog
cosine-similarity
sip-server
universal-image-loader
personalization
codeplex
clickbank
accesscontrolexception
flex++
android-sdk-2.3
curb
nokia-s40
objectquery
kqueue
node-redis
procedures
promotion-code
catransform3d
winmain
xcelsius
lr
jqote
load-time
easyb
pos-for-.net
murmurhash
lxr
int64
product-management

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