How to create a check if the program is installed?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • dzaggiel
    Junior Member
    • May 2018
    • 9

    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:

    code:
    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.
  • Anders
    Moderator
    • Jun 2002
    • 5638

    #2
    What is the problem?
    IntOp $PostCount $PostCount + 1

    Comment

    • dzaggiel
      Junior Member
      • May 2018
      • 9

      #3
      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.

      Comment

      • Anders
        Moderator
        • Jun 2002
        • 5638

        #4
        You can just create that registry value and run it and see what happens.
        IntOp $PostCount $PostCount + 1

        Comment

        • dzaggiel
          Junior Member
          • May 2018
          • 9

          #5
          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.

          Comment

          • Anders
            Moderator
            • Jun 2002
            • 5638

            #6
            But during testing you can just create a/the key and test.
            IntOp $PostCount $PostCount + 1

            Comment

            • dzaggiel
              Junior Member
              • May 2018
              • 9

              #7
              But what does the creation of the same location have to do with it? How will it help me?

              Comment

              • dzaggiel
                Junior Member
                • May 2018
                • 9

                #8
                I was tried this command to watch what value have this variable but receives a blank message.


                What am I doing wrong?

                Comment

                • Anders
                  Moderator
                  • Jun 2002
                  • 5638

                  #9
                  From the docs:

                  The error flag will be set and $x will be set to an empty string ("") if the string is not present.
                  IntOp $PostCount $PostCount + 1

                  Comment

                  • dzaggiel
                    Junior Member
                    • May 2018
                    • 9

                    #10
                    Well, only that the location exists so the string is true.

                    So what's wrong?

                    Comment

                    • dzaggiel
                      Junior Member
                      • May 2018
                      • 9

                      #11
                      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?

                      Comment

                      • dzaggiel
                        Junior Member
                        • May 2018
                        • 9

                        #12

                        Comment

                        • Anders
                          Moderator
                          • Jun 2002
                          • 5638

                          #13
                          Don't call CopyFiles if you don't want to copy something
                          IntOp $PostCount $PostCount + 1

                          Comment

                          • dzaggiel
                            Junior Member
                            • May 2018
                            • 9

                            #14
                            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 ;]

                            Comment

                            Working...
                            X