Do you know the right method to get the installer path in Inno Setup?
I want to catch that value inside the [Code] section.
{srcexe} will give you the path and filename of the setup.
{src} will give you just the installer path.
You should use the {srcexe} constant. In Pascal scripting, you can obtain the values of constants using the ExpandConstant function, as in
path := ExpandConstant('{srcexe}');
Related
does someone know how i can get the path of an folder in lua?
at the moment i use the path like this: "C:\Users\"..username.."\AppData\Roaming\Wireshark\plugins\RSTP_Dissector\channel_json"
My lua code is in the RSTP_Dissector folder. Does someone know how to work with the files in the channel_json folder without using the whole path like above?
"C:\\Users\\"..username.."\\AppData\\Roaming\\Wireshark\\plugins\\RSTP_Dissector\\channel_json"
From the documentation under "package.path":
A string with the path used by require to search for a Lua loader.
At start-up, Lua initializes this variable with the value of the
environment variable LUA_PATH_5_4 or the environment variable LUA_PATH
or with a default path defined in luaconf.h, if those environment
variables are not defined. A ";;" in the value of the environment
variable is replaced by the default path.
Like package.path = "C:\\Users\\"..username.."\\AppData\\Roaming\\Wireshark\\plugins\\RSTP_Dissector\\?.lua;".. package.path, add this code to the entry program, and you can use the relative path in the "C:\Users\"..username.."\AppData\Roaming\Wireshark\plugins\RSTP_Dissector" directory.
Hope to help you.
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}
I have created an installer using Inno Setup in which I am executing an exe that I created to create a small service inside Windows XP. I need to pass two arguments to the exe - "-install" and the path of the installation directory. I have no way of expanding the constant {app} to pass the actual value inside of {app}. Is there some way of doing this?
Thanks
I do not really understand what you want, but maybe you are seeking the ExpandConstant function?
This should work:
[Run]
Filename: {app}\MyApp.exe; Parameters: "-install {app}";
I've done it before using InnoSetup and it puts the correct value for {app}.
If you are still having problems, please post your code.
In the Delphi IDE, the path to the Delphi installation is specified as $(DELPHI). I am wondering if there is a way to create my own path indicators, such as $(MY_LIBRARY) or something similar. I thought $(DELPHI) was specified as an environment variable, but apparently not. Any ideas? (I'm using Delphi 7)
In Delphi 2010:
select Tools -> Options
select "Environment Variables"
specify either System, either User variable
For Delphi 5 you can add them from windows Environment variables
right click on My computer > properties > advanced > Environment variables
In Delphi 2010:
I know many of the XML tags in the Project.dproj can be used like this. (For exemple, $(DCC_DcuOutput), $(DCC_ExeOutput)...).
Maybe it is possible to add your own XML tags in the file and use them afterward. Though I'm not sure if they'll be preserved by the IDE.
Also of note is when your using the command line compiler, the file RSVARS.BAT located in the BIN directory of the current Delphi installation is what creates some of the environment variables for child processes. (for example BDS and BDSCOMMONDIR).
In Windows 7 (and Vista is similar) click the 'start' button, right-click 'computer', 'properties' and then 'advanced system settings'. Click 'Environment variables' and you're now able to create new ones as global (system), or just for the current user (you). For example 'MyVar'.
Now in a delphi path, refer to MyVar as $(MyVar).
MyVar will now be visible in batch files too as %MyVar%.
There is an alternative workaround -- use SUBST to assign a virtual drive letter to the root of the folder you would be using $(MyFiles) if you could and then just use that.
For Example if you have files in deep directory, you'd go to the command prompt and type:
SUBST M: "C:\users\Me\Delphi Files\My Components"
and then you could refer to it by M:
When I execute delphi 2009 project using MSBuild command line, output always goes to C: drive
C:\MyProjects>MSbuild "C:\MyTestProject\Test.dproj" /t:Build /p:OutDir="C:\Output\bin\"
Why is this happening?
I know the docs say otherwise, but try OutputPath instead of OutDir.
For Delphi projects you need to use DCC_ExeOutput to specify where the EXE should go.
C:\MyProjects>MSbuild "C:\MyTestProject\Test.dproj" /t:Build /p:DCC_ExeOutput="C:\Output\bin\"
Take a look inside Test.dproj for any other options you might want to specify.