+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Check if a program is installed before running installation

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Check if a program is installed before running installation

    Hello guys,

    I would like to make the installer check if a component of the installation is already installed in order to avoid having to re-install it and possibly losing program configurations that are already present. Is there a way to do this? The method I would use is check if a process is running or check if folder exists, if it does, skip the installation of that program.

    Thank you!

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if a program is installed before running installation

    Hello,

    Sure, no problem. You can check if the component is already there (e.g. check for a specific file or registry entry, etc.) and then, based on the result of your check, enable/disable the Feature using the "Set Feature State..." script function. Or just put a simple IF/Then Statement around that installation part.

    Friedrich

  3. #3

    Default Re: Check if a program is installed before running installation

    Hello Friedrich,

    I want to do this via the script editor, I click on "Check In-use File" and it asks me for a Variable and a Path name. I understand that the variable must be one I make up so that I can use it in the future for an if/then? And what goes in Path name? Where the file is located?

    Thank you.

    Alejandro.

  4. #4
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if a program is installed before running installation

    Alejandro,

    Only you (the developer) know where the file is located But why use "Check In-Use File...". I thought your intention was to see if a file does exist? The Check In-use File function lets you determine whether a particular file on the destination computer is in use or not! Not what you are trying do do.

    As I understand it, you need "If File/Folder exists..." or "Detect Previous Version..." etc.

    Friedrich

  5. #5
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if a program is installed before running installation

    Similar to this...

    Friedrich
    Attached Images Attached Images  

  6. #6

    Default Re: Check if a program is installed before running installation

    Hello Friedrich,

    This is what my code looks like:



    I don't think that this will work because the Feat says that Always Install, but it always installs it. I looked over the Features but I couldn't find where to disable this Always Instal...

    Regards,

    Alejandro

  7. #7
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if a program is installed before running installation

    Alejandro,

    Your code is not correct.

    1. %%PROGRAMFILES%% is not correct here. You have to use the runtime variable (e.g. %PROGRAMFILESDIR%).

    2. You check if "googledriesync.exe" is in-use (means: running/active/locked). Your %ISINSTALLED% variable value is "1" if the file is in-use, it is "0" if the file is not in-use and "-1" if the file could not be found.

    3. Your If Statement in Line 72 is incorrect (from the technical point-of-view) and does not work.

    BTW, by default, a project has a (non-removable) single feature called "Always Install". All files in this feature are automatically installed regardless of the setup type the user selects. Of course, if you put an If Statement around this line and the Statement resolves to FALSE then it will NOT be installed. But your If Statement in Line 72 is not correct so it does not do what you want here.

    Friedrich

  8. #8

    Default Re: Check if a program is installed before running installation

    Hello Friedrich,

    If I use %PROGRAMFILES% it gives me an error stating that this has not been previously defined. I updated my code to this since you told me all about the 1 - 0 or -1.

    Here is the code updated:


    And here is what the feature is configured to do:


    I'm kind of confused because my "if this then that" is set to: if file googledrivesync.exe is not found, run the installation, else, carry on.

    Thanks,

    Alejandro

  9. #9
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Check if a program is installed before running installation

    Alejandro,

    Unfortunately, your code is still incorrect. %%PROGRAMFILES(x86)%% is wrong. You should use something like this: %PROGRAMFILESDIR% And there is a huge difference between "/" and "\" in Windows. So "/Google/Drive/googledrivesync.exe" is an invalid path specification in Windows.

    It should look like the attached one (quick and dirty demo).

    Friedrich
    Attached Images Attached Images  

  10. #10

    Default Re: Check if a program is installed before running installation

    Hey Friedrich,

    I found that this was getting too complicated and decided to play it out a little different with a simple if-else. If %PROGRAMFILESDIR%\GOOGLE\DRIVE\GOOGLEDRIVESYNC.EXE File or Folder Exists then do nothing, else Install File C:\....googledrivesync.exe Feat Always Install.
    But this doesn't work...

    Here is an image:


    I'm going to email/pm you the project so that you can try it out.

    Regards,

    Alejandro

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •