Archive: Open folder/program


Open folder/program
This may have been asked before and the search came up with to much and being specific wont find anything probably, how would I:

add a check box to execute a program on close

and

add a check bow to open a folder

please provide exact code if you can, im kinda new at this ;)


See if this helps:

!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\index.htm"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "&Start ${PRODUCT_NAME}"
;!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED

or, for a function:

!define MUI_FINISHPAGE_SHOWREADME_FUNCTION "post_install"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "&Start ${PRODUCT_NAME}"
;!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED

For both:

!insertmacro MUI_PAGE_FINISH

A function would be:

Function post_install
ExecShell open "$INSTDIR\help\readme.rtf"
FunctionEnd

Good luck!

ps:

This thread might have an answer regarding 2 checkboxes:

install options : page custom like a welcome page


;NSIS Modern User Interface
;Start Menu Folder Selection Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

;Name and file
Name "The Fro Icon Pack"
OutFile "The Fro Icon Pack.exe"

;Default installation folder
InstallDir "$PROGRAMFILES\HQubed\The Fro Icon Pack"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\The Fro Icon Pack" ""

;--------------------------------
;Interface Settings

Var MUI_TEMP
Var STARTMENU_FOLDER
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING

;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "C:\Documents and Settings\Michael\My Documents\Web

Pages\Projects\Installers\The Fro Icon Pack\assets\License.txt"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\The Fro Icon Pack"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "The Fro Icon Pack" SecBF

SetOutPath "$INSTDIR\"

File /r "C:\Documents and Settings\Michael\My Documents\Web Pages\Projects\Installers\The Fro

Icon Pack\files\"

;Store installation folder
WriteRegStr HKCU "$PROGRAMFILES\HQubed\The Fro Icon Pack" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

;Create shortcuts
CreateDirectory "$SMPROGRAMS\HQubed\The Fro Icon Pack"
CreateShortCut "$SMPROGRAMS\HQubed\The Fro Icon Pack\Uninstall.lnk" "$INSTDIR\Uninstall.exe"

!insertmacro MUI_STARTMENU_WRITE_END

SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_SecBF ${LANG_ENGLISH} "The first version of The Fro Icon Pack, includes many

different authors praised icons."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecBF} $(DESC_SecBF)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"

;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"

startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."

IfErrors startMenuDeleteLoopDone

StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:

DeleteRegKey /ifempty HKCU "Software\The Fro Icon Pack"

SectionEnd

Sorry its long, where would I put it? And I notice there are a few header errors ;)


One more thing, how can i delete all of the files i installed

C:\Program Files\HQubed\The Fro Icon Pack

I want to delete the folder "The Fro Icon Pack" and all of its contents and delete

"The Fro Icon Pack" but not HQubed (in either) on the start menu, ty in advance.


You put it where the MUI readme says you should put it, which is:

Page Settings apply to a single page and should be set before inserting a page macro. If you have multiple pages of one type and you want to set a setting for all them, put the setting before each page macro.
To delete a directory use RMDir.

This is ticking me off to no end, and im sorry this is probably gonna get anoying


;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...
RMDir "$INSTDIR\"
Delete "$INSTDIR\Uninstall.exe"

!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"

;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"

startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."

IfErrors startMenuDeleteLoopDone

StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:

DeleteRegKey /ifempty HKCU "Software\The Fro Icon Pack"

SectionEnd

How to i delete the start menu folder ...\The Fro Icon Pack (but not its parent)

And what is the code for the rm dir thing.

Once I get this I shouldnt have any more questions.


The code you've got there is correct, assuming it's an exact copy from the start menu example. If it doesn't work, you've probably got a problem in the code that writes the start menu path to the registry at installation time. Attach (don't just paste it in the message, it's hard to read) the entire script so the problem can be spotted.


--Attached