Skip to content
⌘ NSIS Forum Archive

Newbie: 2 in 1

6 posts

Dumperbg#

Newbie: 2 in 1

Hello, i'm newbie in this and i need somebody help me.
I've made 2 files (A and B) with NSIS and i'd like to merge them into one main installer (C). This installer will be silent and should do something like this:
check registry for a key (K), and if the key exist - extract and run file A. If the key not exist - extract and run file B.

Here is my script:

!; MUI 1.67 compatible ------
!include LogicLib.nsh

Name "My_app"
OutFile "My_app.exe"
SilentInstall silent

Section
ReadRegSTR $0 HKLM "SOFTWARE\....\......" "Some value"
${If} $0 < 2
SetOutPath $TEMP
File A.exe
ExecWait $TEMP\A.exe
${Else}
SetOutPath $TEMP
File B.exe
ExecWait $TEMP\B.exe
${EndIf}
SectionEnd

Section -Post
Delete $TEMP\A.exe
Delete $TEMP\B.exe
SectionEnd

Please, tell me what's wrong 🙄
Regards
Anders#
other than no quotes on paths, I don't see any issues. What is the actual problem? (You are not passing install paths to A/B but you did not say anything about that)
Dumperbg#
The installaton path is defined in files A.exe and B.exe. They are compilled and working.
I want to merge this two .exe files into one installer. I'll try to explain my idea:
When run this installer, first he have to check registry for a key. If the key exist, extract to temp folder and run only file A.exe, if the key doesn.t exist - extract to temp folder and run only file B.exe. Actualy the installation depending on this key. This key define which file must be extracted and started.
MSG#
Anders meant something along the lines of: What is the problem with your current C script? I agree with him that it looks pretty ok. Do you get any compiler errors? If not, try adding some MessageBox debug messages in your C script to see what the contents of your variables are, during runtime.
Dumperbg#
The script (C) working without erors, but compiled installer doesn't work. When I run it, only file A.exe is starting. I mean that installer doesn't verify the registry, to deside which file(A or B) have to extract and run
Afrow UK#
Check the value read from the registry using a MessageBox then.

Edit: You do realise that code will check if the read value is less than 2?

Stu