Announcement

Collapse
No announcement yet.

Run Program automatically after install?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Run Program automatically after install?

    Hello

    How do I run my program automatically after an install?

    Tried following this guide: http://nsis.sourceforge.net/Run_an_a...ter_an_install but didn't work for me.

    Here is my nsi;

    code:
    !include MUI2.nsh

    Name `Maintenance`
    OutFile `Maintenance Installer.exe`

    BrandingText `Created by Panarchy`

    !insertmacro MUI_PAGE_WELCOME
    !insertmacro MUI_PAGE_LICENSE license.txt
    !insertmacro MUI_PAGE_INSTFILES
    !insertmacro MUI_PAGE_FINISH

    !insertmacro MUI_LANGUAGE English

    Section

    !macro ExtractMaintenance ToDir
    SetOutPath `${ToDir}`
    File "Maintenance Script.exe"
    !macroend

    !insertmacro ExtractMaintenance "C:\NoWhereInParticular"

    CreateShortcut "$DESKTOP\Maintenance.lnk" "C:\NoWhereInParticular\Maintenance Script.exe"

    SectionEnd

    Please tell me how to integrate a 'run program on finish' feature.

    Thanks in advance,

    Panarchy

  • #2
    I use something like this:

    code:
    !define MUI_FINISHPAGE_RUN "$INSTDIR\${PROGEXE}"
    !define MUI_FINISHPAGE_RUN_TEXT "Launch ${PRODUCTNAME}"

    Yes, I !define PROGEXE and PRODUCTNAME early on in the script (along with lots of other potentially repetitive things).

    Comment


    • #3
      Thanks.

      Just tried that, it didn't work.

      Please recommend another method.

      Thanks in advance,

      Panarchy

      Comment


      • #4
        Can you define "it didn't work"? Did it cause compiler errors? Did it not show the checkbox? Did it not actually launch the exe?

        Comment


        • #5
          Make sure you put the defines before !insertmacro MUI_PAGE_FINISH.

          Stu

          Comment


          • #6
            Thanks, I think I finally got it to work.

            Comment


            • #7
              Confirming;

              Yes, it works!!!

              Thanks Afrow (and lewellyn for replying...)

              Comment


              • #8
                and in silent mode...

                Any idea on how to start an application after a silent install ?

                Can't find anything yet....

                Comment


                • #9
                  Just put a Section at the end that does it, or use Function .onInstSuccess.

                  Edit: And if necessary wrap the code inside it with an ${If} ${Silent}.

                  Stu

                  Comment


                  • #10
                    Function .onInstSuccess
                    Exec "blablabla.exe"
                    FunctionEnd

                    Found your other post, thank you

                    Comment


                    • #11
                      Originally Posted by ledruide View Post
                      Function .onInstSuccess
                      Exec "blablabla.exe"
                      FunctionEnd
                      Only as a hint.

                      If your installer was elevated (under Vista or Seven), the executable started by "Exec" is also elevated. And it is not good to start the application with this privileges without any good reason.
                      This signature is currently on vacation!

                      Comment


                      • #12
                        I am using the UAC_AsUser_Execshell from the UAC plug-in.


                        This should prevent the program from running elevated.

                        Comment

                        Working...
                        X