Skip to content
⌘ NSIS Forum Archive

How to create a check if the program is installed?

14 posts

dzaggiel#

How to create a check if the program is installed?

Hey, I'm learning the NSIS program, I'm trying to do an installer that checks if a program is installed. Unfortunately, no luck. I would like to do a condition that checks for specific registers if is exist that sets it as the default for installation and omits the window with the choice of installation path. If there is no such entry in the registry, it does not skip windows with the choice of the installation path.

I've tried a few tips but I still have a problem.
My code looks like this:

Function findDirectory
ClearErrors
ReadRegStr $0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 409720" "InstallLocation"
${IF} ${Errors}
MessageBox MB_OK "Not exist"
${ELSE}
${IF} $0 == ""
MessageBox MB_OK "Exist and is empty"
${ELSE}
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 409720" "InstallLocation" ""
${ENDIF}
${ENDIF}
FunctionEnd
I am asking for help because I can not deal with it.
dzaggiel#
The problem is that I do not know how to create what I want. Can you help me? The code above only theoretically checks if there is a location in the registry, I think.
dzaggiel#
No, my installer is an add-on to the game so I want to check if the game is installed. I do not want to create a location I want to find the installed game location from the registry and create a condition.
dzaggiel#
I was tried this command to watch what value have this variable but receives a blank message.


What am I doing wrong?
Anders#
From the docs:

The error flag will be set and $x will be set to an empty string ("") if the string is not present.
dzaggiel#
I created something like that and it works.



But when installing, the windows copy window appears. Is there any way that this window would not show up?
dzaggiel#
I used Filecopy but now i using CopyFiles /silent. I need copyfiles to copy original files as backup. So ok nobody help me thanks a lot ;]