Hello,
I'm trying to use NSIS to do 2 functions with a single installer.
1) Install my program, and stop
2) Update my program, and launch it with a parameter.
I was hoping to do something like that :
setup.exe, without arguments, will install my program and stop
setup.exe parameter, will update (reinstall) my program and launch "program.exe parameter" at the end of the installation.
I don't know how to check a condition in order to launch / don't launch my program, and I don't know how to read a parameter and launch a program with this parameter as argument.
How NSIS can do this ?
Thanks for your help
Reading command line parameter at runtime
9 posts
Re: Reading command line parameter at runtime
Why don't you try searching the forums for 'command line parameters'?
Why don't you try searching the forums for 'command line parameters'?
and search NSIS documentation for 'command line parameters'
Sorry, I didn't understand how GetParameters / GetOptions worked.
Now, I can see how to detect if it's an update or an install, but how can I pass the parameter value to the program ?
Actually, I'm launching a program with the following lines :
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\MyApp.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "test"
!insertmacro MUI_PAGE_FINISH
I don't know how to use a variable as parameter.
Now, I can see how to detect if it's an update or an install, but how can I pass the parameter value to the program ?
Actually, I'm launching a program with the following lines :
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\MyApp.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "test"
!insertmacro MUI_PAGE_FINISH
I don't know how to use a variable as parameter.
Var myvar
!define MUI_FINISHPAGE_RUN_PARAMETERS "$myvar"
StrCpy myvar "value"
!define MUI_FINISHPAGE_RUN_PARAMETERS "$myvar"
StrCpy myvar "value"
Hi Wizou,
I am also having trouble using variable at runtime. Seem like it has to be a static variable in order for it to work. Below is what I am trying to do, but $Country have to be pre-defined.
Is there anyway it can be variable like how I want it?
Thanks!
===
Var Country
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "..\doc\${Country}\license.rtf"
Function CountrySelectionLeave
${NSD_LB_GetSelection} $ListBox $0
StrCpy $Country $0
FunctionEnd
I am also having trouble using variable at runtime. Seem like it has to be a static variable in order for it to work. Below is what I am trying to do, but $Country have to be pre-defined.
Is there anyway it can be variable like how I want it?
Thanks!
===
Var Country
; License page
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "..\doc\${Country}\license.rtf"
Function CountrySelectionLeave
${NSD_LB_GetSelection} $ListBox $0
StrCpy $Country $0
FunctionEnd
!insertmacro MUI_PAGE_LICENSE "..\doc\${Country}\license.rtf"Either it is a variable $Country, or it is a define ${Country}. It's one or the other, you can't have it both ways.
(...)
StrCpy $Country $0
@jdt2oo7: You can't select the license text file at runtime (except through multilanguage) because NSIS has to know about those files at compile-time in order to compress them inside the installer.
Your problem is more about the display of a text determined at runtime, and I see you have already opened a different forum thread for that.
Be careful with the various way of using $ in NSIS :
${xxx} refers to a !define xxx (constant at compile-time)
$(xxx) refers to a LangString xxx (translation)
$xxx refers to a Var xxx (variable)
$%xxx% refers to a Windows/DOS environment variable (defined at compile-time)
Your problem is more about the display of a text determined at runtime, and I see you have already opened a different forum thread for that.
Be careful with the various way of using $ in NSIS :
${xxx} refers to a !define xxx (constant at compile-time)
$(xxx) refers to a LangString xxx (translation)
$xxx refers to a Var xxx (variable)
$%xxx% refers to a Windows/DOS environment variable (defined at compile-time)
Thanks for your responses, MSG and Wizou!