Archive: Finishpage: run a file and creating shortcut


Finishpage: run a file and creating shortcut
Hello,

I have the problem with the finishpage:

!define MUI_FINISHPAGE_RUN "$INSTDIR\appz.exe"
!insertmacro MUI_PAGE_FINISH

The appz starts like a shortcut without a workingdir!

The shortcut to this appz works only because the SetOutPath "$INSTDIR\" is defined before the "!insertmacro MUI_STARTMENU_WRITE_BEGIN Application."

How I defined the workingdir?

In INNO Installer it's really simple:

[Run]
Filename: {app}\appz.exe; WorkingDir: {app}; Description: Start den test; Flags: nowait postinstall

And then I wish that the user can choice to make a desktop shortcut to this app at the finishpage. (now this will create it automatic)

It's possible with a simple script?

I hope someone can help me.

Thanks.


For the working directory:

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION RunMyApp

Function RunMyApp

SetOutPath $INSTDIR
Exec '"$INSTDIR\MyApp.exe"'

Function

For the desktop shortcut:
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_SHOWREADME_TEXT "Create &desktop shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDeskShortcut

Function CreateDeskShortcut

;CreateShortcut command here

Function

Note: Usually people use the components page for shortcut options.

Hello Joost,

this is I call perfect help! Thank you very much.
It works fine. Now I need only text for multi language
support but I think I'll found this easy.

Best greetings!

rien


:igor: It isn't so easy! I add the red Langstring but there is only a empty checked field (no text).


!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDeskShortcut
LangString MUI_FINISHPAGE_SHOWREADME_TEXT ${LANG_ENGLISH} "Create &desktop shortcut"
LangString MUI_FINISHPAGE_SHOWREADME_TEXT ${LANG_GERMAN} "&Desktop-Symbol anlegen"



Function CreateDeskShortcut

;Working Directory
SetOutPath $INSTDIR
;CreateShortcut command here
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\MyApp.exe"
FunctionEnd

Hello,

I don't find the solution for my little problem,
I think it could be only a easy fault.

Can someone please help me?!

Perhaps someone has the time to have a look.

rien


From the "Syntax" section near the start of the MUI ReadMe:

"If you want a certain value (e.g. a text) to be language-specific, set a language string (using LangString) and define $(STRINGNAME) as value."

So to use a language string for the MUI_FINISHPAGE_SHOWREADME_TEXT you need to do something like this:

LangString MAKE_SHORTCUT_TEXT ${LANG_ENGLISH} "Create &desktop shortcut"
LangString MAKE_SHORTCUT_TEXT ${LANG_GERMAN} "&Desktop-Symbol anlegen"

!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(MAKE_SHORTCUT_TEXT)"


Thanks to Joost Verburg and pengyou!

The last problem was, I had to move the Langstrings behind the Language macros!


- Finishpage with checkboxes: run app and creating a desktop symbol to app -


!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION RunMyApp

Function RunMyApp

SetOutPath $INSTDIR
Exec '"$INSTDIR\MyApp.exe"'

FunctionEnd

!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(MAKE_SHORTCUT_TEXT)"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDeskShortcut

Function CreateDeskShortcut

;Working Directory
SetOutPath $INSTDIR
;CreateShortcut command here
CreateShortCut "$DESKTOP\MyApp.lnk" "$INSTDIR\MyApp.exe"
FunctionEnd
.
.
.
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"

; English Strings
LangString MAKE_SHORTCUT_TEXT ${LANG_ENGLISH} "Create &desktop shortcut"

; German Strings
LangString MAKE_SHORTCUT_TEXT ${LANG_GERMAN} "&Desktop-Symbol anlegen"


Best Regards

Rien

The language files set the defines like ${LANG_ENGLISH}. The easiest method is to follow the order in the Modern UI Readme.


Hello,

I think I have an interesting question.

Who must look the script above for the classic installer?
Exist perhaps a converter? :) I don't think so.

I don't find a script by the examples for the finish page.

Is it difficult to write the script for the classic installer? Perhaps someone can help for fun.

Good evening

Rien


Hi,

can someone please have a look on the script above?

I want this script for the classic installer of NSIS.
I don't know how I get the finishpage in the classic installer. I think it couldn't be so difficult.

Greetings.

Rien


The classic installer does not have a "Finish" page - it only has the following pages built-in (see "4.5.4 Page" in NSIS User Manual):

license
components
directory
instfiles
uninstConfirm

So if you want a "Finish" page in a classic installer, you'll need to make your own custompage using InstallOptions.


Thank you,

now have the custom page, but I don't understand anything.

I use this ini file:


[Settings]
NumFields=3

[Field 1]
Type=GroupBox
Left=0
Right=-1
Top=0
Bottom=-5
Text=Installation Complete

[Field 2]
Type=checkbox
Text=Install a shortcut on your desktop?
Left=10
Right=-10
Top=17
Bottom=25
State=1
Flags=GROUP

[Field 3]
Type=checkbox
Text=Play MyApp!
Left=10
Right=-10
Top=43
Bottom=51
State=1
Flags=GROUP


And I have at this script to my *.nsi file:

Page license
Page directory
Page instfiles
Page custom customPage "" ": custom page"


Function customPage
GetTempFileName $R0
File /oname=$R0 final_page.ini
InstallOptions::dialog $R0
Pop $R1
StrCmp $R1 "cancel" done
StrCmp $R1 "back" done
StrCmp $R1 "success" done
error: MessageBox MB_OK|MB_ICONSTOP "InstallOptions error:$\r$\n$R1"
done:
FunctionEnd


It looks like I wish, but there is no function.
How I get the checkbox infos from the ini file in function?

For me it's to difficult, but perhaps someone can help me
and spend some time.

I hope you can help me.

Rien