- NSIS Discussion
- Passing Var to Registry
Archive: Passing Var to Registry
hungryOrb
11th March 2008 12:56 UTC
Passing Var to Registry
I'm looking to ask a user to input 3 strings, then input those into the registry as program settings. I've looked around a little but couldn't make huge sense of the best(only?) way to do this. Was wondering if someone would offer a minute suggestion? ^.^
hungryOrb
11th March 2008 14:42 UTC
-!
Thanks RW. Although, for a nab such as I, that is a little hard to comprehend ;] I don't think I can make out even the start and finish of each way that you manage the registry :]
Nps ;]
hungryOrb
11th March 2008 15:14 UTC
MUI
Does the MUI.nsh have any generic input pages that are easily customisable? I guess that would be easiest :]
Thanks for any helps.
cheryll
11th March 2008 15:32 UTC
Hm, perhaps I don't understand it right, but isn't what you want quite simple?
Just make a custom- page with some textfields and labels, read the user-input in the leave-function and then just use WriteRegStr to store it in the registry.
hungryOrb
11th March 2008 15:39 UTC
That's exactly it Cheryll, ye. But reading through the Manual at this point of light comprehension is just too much, it's like throwing crowbars into the cogs. A small example or tutorial which touches that exact syntax would be ideal, more important than a solution is understanding, of course.
If anyone knows of such a thing, I'd be delighted to hear :) thanks for any help.
cheryll
11th March 2008 15:54 UTC
I extracted the essential parts from one of my installers. Perhaps that will help. Btw. HM NIS Edit has an editor for ini-files. Makes it quite easy to build them. If you didn't know this.
;Add at appropriate place
Page custom UserInput UserInputLeave
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "UserInput.ini" "UserInput"
Functionend
;Manipuale the page as you want befor showing it
Function UserInput
!insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE)
!insertmacro MUI_INSTALLOPTIONS_WRITE "UserInput" "Settings" "Title" $(Title)
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "UserInput"
FunctionEnd
Function UserInputLeave
;read in the userinformation (use the appropriate Fieldnumbers)
!insertmacro MUI_INSTALLOPTIONS_READ $1 UserInput "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $2 UserInput "Field 2" "State"
;write it to the registry
WriteRegStr HKLM "Software\${APP_NAME}\" "UserInput1" $1
WriteRegStr HKLM "Software\${APP_NAME}\" "UserInput2" $2
FunctionEnd
hungryOrb
11th March 2008 15:59 UTC
Oh, thankyou :) I just found the tutorial referring to the installer options feature :] I think I'm sorted now. tyty!
hungryOrb
11th March 2008 16:32 UTC
Does the order of the text dictate the order of the pages? :O
cheryll
11th March 2008 16:49 UTC
Well, the pages will be displayed in the same order in that they are written in the code, if that's what you're asking...
hungryOrb
11th March 2008 17:01 UTC
Yes, exactly :) I hadn't noticed any other indexing code of pages, but then, I'm not very observant :) thanks.
I hope you don't mind me asking questions continuously, you can always ignore or whatever ^.^
Erm, the MUI macros are usually the start of the pages right? And what about the end of the pages? Do they only end before the "un." parts? At compile time, does the code get re-ordered to link the sections up to everything etc?
If you hadn't guessed I'm a simple guy who must associate visually xD
hungryOrb
11th March 2008 17:24 UTC
Ahm. I followed the tutorial, and your example, and the code ended up between the auto-generated "!insertmacro MUI_PAGE_DIRECTORY" and the beginning of the start menu !defines. It compiles, so I guess there is no error, but there is no page in the installer ^.^ This means it's in the wrong place doesn't it?
EEK.
cheryll
11th March 2008 19:19 UTC
Erm, the MUI macros are usually the start of the pages right? And what about the end of the pages? Do they only end before the "un." parts? At compile time, does the code get re-ordered to link the sections up to everything etc?
Hm, not sure I understand what you mean.
You just list the installerpages, then the uninstaller pages.
The functions and sections come after that. You put the functions that do stuff before the installation before the functions and section that do stuff during the installation.
Ahm. I followed the tutorial, and your example, and the code ended up between the auto-generated "!insertmacro MUI_PAGE_DIRECTORY" and the beginning of the start menu !defines. It compiles, so I guess there is no error, but there is no page in the installer ^.^ This means it's in the wrong place doesn't it?
Have you got the ini-file? And is it in the same directory as the installer file? If yes, please post your code. It's easier if I know what you actually did.
hungryOrb
12th March 2008 12:00 UTC
:]
Thanks Cheryll.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Draco SSC"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Forwessun"
!define PRODUCT_WEB_SITE "http://www.forwessun.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\DracoSSC.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Custom.ini" "Custom"
Functionend
LangString CUSTOM_TITLE ${LANG_ENGLISH} "Enter your Login Details."
LangString CUSTOM_SUBTITLE ${LANG_ENGLISH} " "
Page custom Custom1Page
#==================================
Function UsernamePasswordPage
!insertmacro MUI_HEADER_TEXT "$(CUSTOM_TITLE)" "$(CUSTOM_SUBTITLE)"
# Display the page.
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "Custom"
# Get the user entered values.
!insertmacro MUI_INSTALLOPTIONS_READ $Username "UserInput" "Field 1" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Password "UserInput" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $Server "UserInput" "Field 3" "State"
WriteRegStr HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLUser" $1 ;As per install instruction file.
WriteRegStr HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLPass" $2
WriteRegStr HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLADDR" $3
FunctionEnd
#===================================
################################- Credit: Cheryll(NSIS Forum) -###############################
/*Page Custom UserInput UserInputLeave
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Custom1.ini" "Custom1"
Functionend
;Manipuale the page as you want befor showing it
Function UserInput
!insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE)
!insertmacro MUI_INSTALLOPTIONS_WRITE "UserInput" "Settings" "Title" $(Title)
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "UserInput"
FunctionEnd
Function UserInputLeave
;read in the userinformation (use the appropriate Fieldnumbers)
!insertmacro MUI_INSTALLOPTIONS_READ $1 UserInput "Field 1" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $2 UserInput "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $3 UserInput "Field 3" "State"
;write it to the registry
WriteRegStr HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLUser" $1 ;As per install instruction file.
WriteRegStr HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLPass" $2
WriteRegStr HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLADDR" $3
FunctionEnd*/
################################- End of Custom Page 1 -#########################
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Draco SSC"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\DracoSSC.exe"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "DracoSetup.exe"
InstallDir "$PROGRAMFILES\Draco SSC"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
######################################################-------------COPYING FILES
Section "Draco Files" SEC01
SetOutPath "$INSTDIR"
SetOverwrite try
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\DAO350.DLL"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Dracohelp.chm"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\dracok.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\DracoSSC.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\DracoUpdate.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\ezVidC60.ocx"
SetOutPath "$INSTDIR\Icons"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Customer.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\CustomerO.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\CustomerX.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Dragon.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Job.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\JobO.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\JobX.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Order.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\OrderO.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\OrderX.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Quote.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\QuoteO.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\QuoteX.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Stock.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\StockO.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\StockX.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Supplier.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\SupplierO.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\SupplierX.ico"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Icons\Thumbs.db"
SetOutPath "$INSTDIR\Images"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\confail.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\dragon.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\Floorplan.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\lockbg.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\logonbg.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\po.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\pocn.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\splash.jpg"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\Thumbs.db"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\update.avi"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Images\WelcomeBitMap.bmp"
SetOutPath "$INSTDIR"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\KDateBox.ocx"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\langs.dat"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\LanguageEditor.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\LanguageSelector.exe"
SetOutPath "$INSTDIR\Modules\CommandPrompt"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Modules\CommandPrompt\CommandPrompt.exe"
SetOutPath "$INSTDIR\Modules"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Modules\CommandPrompt.dmd"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Modules\DracoSSC.DDF"
SetOutPath "$INSTDIR\Modules\TestJet"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Modules\TestJet\TestJet.exe"
SetOutPath "$INSTDIR\Modules"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Modules\TestJet.dmd"
SetOutPath "$INSTDIR\Modules\Verifier"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Modules\Verifier\verifier.cmd"
SetOutPath "$INSTDIR"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\MSDERUN.DLL"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\SSubTmr6.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\unzip32.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\UpdateInProgress.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\Updates.txt"
SetOutPath "$INSTDIR\User Modules"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\User Modules\_dmd syntax.txt"
SetOutPath "$INSTDIR"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\WinSubHook.tlb"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\App\zip32.dll"
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Draco SSC.lnk" "$INSTDIR\DracoSSC.exe"
CreateShortCut "$DESKTOP\Draco SSC.lnk" "$INSTDIR\DracoSSC.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section "System" SEC02
SetOutPath "$WINDIR\System\TestFolder1"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3.hlp"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3.lib"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3c.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3i.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3m.exe"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3S.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\MySQL (Goes in System Folder)\myodbc3S.lib"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\COMCT332.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\COMDLG32.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\FM20.DLL"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\hhctrl.ocx"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\msado25.tlb"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSCOMCT2.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSCOMCTL.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSFLXGRD.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSHFLXGD.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSINET.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSMAPI32.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\MSMASK32.OCX"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\msvcr71.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\richtx32.ocx"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\System Folder\scrrun.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\VB6 Runtimes\asycfilt.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\VB6 Runtimes\COMCAT.DLL"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\VB6 Runtimes\msvbvm60.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\VB6 Runtimes\oleaut32.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\VB6 Runtimes\olepro32.dll"
File "C:\Documents and Settings\Robin.Smith\Desktop\Draco NSIS Build Files\VB6 Runtimes\stdole2.tlb"
######################################################---------------------------------------END OF COPYING FILES
; Shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Help.lnk" "$WINDIR\System\TestFolder1\myodbc3.hlp"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section -AdditionalIcons
SetOutPath $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\DracoSSC.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\DracoSSC.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$WINDIR\System\TestFolder1\stdole2.tlb"
Delete "$WINDIR\System\TestFolder1\olepro32.dll"
Delete "$WINDIR\System\TestFolder1\oleaut32.dll"
Delete "$WINDIR\System\TestFolder1\msvbvm60.dll"
Delete "$WINDIR\System\TestFolder1\COMCAT.DLL"
Delete "$WINDIR\System\TestFolder1\asycfilt.dll"
Delete "$WINDIR\System\TestFolder1\scrrun.dll"
Delete "$WINDIR\System\TestFolder1\richtx32.ocx"
Delete "$WINDIR\System\TestFolder1\msvcr71.dll"
Delete "$WINDIR\System\TestFolder1\MSMASK32.OCX"
Delete "$WINDIR\System\TestFolder1\MSMAPI32.OCX"
Delete "$WINDIR\System\TestFolder1\MSINET.OCX"
Delete "$WINDIR\System\TestFolder1\MSHFLXGD.OCX"
Delete "$WINDIR\System\TestFolder1\MSFLXGRD.OCX"
Delete "$WINDIR\System\TestFolder1\MSCOMCTL.OCX"
Delete "$WINDIR\System\TestFolder1\MSCOMCT2.OCX"
Delete "$WINDIR\System\TestFolder1\msado25.tlb"
Delete "$WINDIR\System\TestFolder1\hhctrl.ocx"
Delete "$WINDIR\System\TestFolder1\FM20.DLL"
Delete "$WINDIR\System\TestFolder1\COMDLG32.OCX"
Delete "$WINDIR\System\TestFolder1\COMCT332.OCX"
Delete "$WINDIR\System\TestFolder1\myodbc3S.lib"
Delete "$WINDIR\System\TestFolder1\myodbc3S.dll"
Delete "$WINDIR\System\TestFolder1\myodbc3m.exe"
Delete "$WINDIR\System\TestFolder1\myodbc3i.exe"
Delete "$WINDIR\System\TestFolder1\myodbc3c.exe"
Delete "$WINDIR\System\TestFolder1\myodbc3.lib"
Delete "$WINDIR\System\TestFolder1\myodbc3.hlp"
Delete "$WINDIR\System\TestFolder1\myodbc3.gid"
Delete "$WINDIR\System\TestFolder1\myodbc3.fts"
Delete "$WINDIR\System\TestFolder1\myodbc3.dll"
Delete "$INSTDIR\zip32.dll"
Delete "$INSTDIR\WinSubHook.tlb"
Delete "$INSTDIR\User Modules\_dmd syntax.txt"
Delete "$INSTDIR\Updates.txt"
Delete "$INSTDIR\UpdateInProgress.exe"
Delete "$INSTDIR\unzip32.dll"
Delete "$INSTDIR\SSubTmr6.dll"
Delete "$INSTDIR\MSDERUN.DLL"
Delete "$INSTDIR\Modules\Verifier\verifier.cmd"
Delete "$INSTDIR\Modules\TestJet.dmd"
Delete "$INSTDIR\Modules\TestJet\TestJet.exe"
Delete "$INSTDIR\Modules\DracoSSC.DDF"
Delete "$INSTDIR\Modules\CommandPrompt.dmd"
Delete "$INSTDIR\Modules\CommandPrompt\CommandPrompt.exe"
Delete "$INSTDIR\LanguageSelector.exe"
Delete "$INSTDIR\LanguageEditor.exe"
Delete "$INSTDIR\langs.dat"
Delete "$INSTDIR\KDateBox.ocx"
Delete "$INSTDIR\Images\WelcomeBitMap.bmp"
Delete "$INSTDIR\Images\update.avi"
Delete "$INSTDIR\Images\Thumbs.db"
Delete "$INSTDIR\Images\splash.jpg"
Delete "$INSTDIR\Images\pocn.jpg"
Delete "$INSTDIR\Images\po.jpg"
Delete "$INSTDIR\Images\logonbg.jpg"
Delete "$INSTDIR\Images\lockbg.jpg"
Delete "$INSTDIR\Images\Floorplan.jpg"
Delete "$INSTDIR\Images\dragon.jpg"
Delete "$INSTDIR\Images\confail.jpg"
Delete "$INSTDIR\Icons\Thumbs.db"
Delete "$INSTDIR\Icons\SupplierX.ico"
Delete "$INSTDIR\Icons\SupplierO.ico"
Delete "$INSTDIR\Icons\Supplier.ico"
Delete "$INSTDIR\Icons\StockX.ico"
Delete "$INSTDIR\Icons\StockO.ico"
Delete "$INSTDIR\Icons\Stock.ico"
Delete "$INSTDIR\Icons\QuoteX.ico"
Delete "$INSTDIR\Icons\QuoteO.ico"
Delete "$INSTDIR\Icons\Quote.ico"
Delete "$INSTDIR\Icons\OrderX.ico"
Delete "$INSTDIR\Icons\OrderO.ico"
Delete "$INSTDIR\Icons\Order.ico"
Delete "$INSTDIR\Icons\JobX.ico"
Delete "$INSTDIR\Icons\JobO.ico"
Delete "$INSTDIR\Icons\Job.ico"
Delete "$INSTDIR\Icons\Dragon.ico"
Delete "$INSTDIR\Icons\CustomerX.ico"
Delete "$INSTDIR\Icons\CustomerO.ico"
Delete "$INSTDIR\Icons\Customer.ico"
Delete "$INSTDIR\ezVidC60.ocx"
Delete "$INSTDIR\DracoUpdate.exe"
Delete "$INSTDIR\DracoSSC.exe"
Delete "$INSTDIR\dracok.dll"
Delete "$INSTDIR\Dracohelp.chm"
Delete "$INSTDIR\DAO350.DLL"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Help.lnk"
Delete "$DESKTOP\Draco SSC.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Draco SSC.lnk"
RMDir "$WINDIR\System\TestFolder1"
RMDir "$SMPROGRAMS\$ICONS_GROUP"
RMDir "$INSTDIR\User Modules"
RMDir "$INSTDIR\Modules\Verifier"
RMDir "$INSTDIR\Modules\TestJet"
RMDir "$INSTDIR\Modules\CommandPrompt"
RMDir "$INSTDIR\Modules"
RMDir "$INSTDIR\Images"
RMDir "$INSTDIR\Icons"
RMDir "$INSTDIR"
######## Deleting MySQL user details from registry.
/*DeleteRegValue HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLUser" $1
DeleteRegValue HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLPass" $2
DeleteRegValue HKCU "Software\VB and VBA Program Settings\${PRODUCT_NAME}\Main" "MySQLADDR" $3*/
########
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
I'm guessing you know what you are looking for, so I didn't bother editing any of it out. Thanks for taking the time, I admire you for it.
At this point, I was attempting to follow the tutorial which is downloadable in a .doc from the tutorials main site, while using your example as reference :]
Edit. Sorry forgot to add that yes, the .ini file is in the same folder as the script.
cheryll
12th March 2008 15:56 UTC
Acctualy, the whole order is messed up.
Try order it like this
- Variables, Naming and stuff
- pages (just the pages and stuff you have to define for the page like so:
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
LangString CUSTOM_TITLE ${LANG_ENGLISH} "Enter your Login Details."
LangString CUSTOM_SUBTITLE ${LANG_ENGLISH} " "
Page custom Custom1Page
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Draco SSC"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\DracoSSC.exe"
!insertmacro MUI_PAGE_FINISH
-localization and language stuff
-Functions (onInit, then the custompage function, then the sections, then un.onInit, un.Sections, un.onUninstSucces)
Basicly, first tell the installer which pages to use in what order, then follow with the function in the order they will most likely be used. I'm not certain if everything has to be in exact order, but it's easier to read and comprehend that way at least.
Oh, and if you got a custom Page called CustomPage you got to call the function the same.
hungryOrb
18th March 2008 15:28 UTC
:]
Thanks very much Cheryll, I'll try to follow your advice. I've tried following some learning resources, but don't find them thorough enough, while I find the manual a little too tough to wade through ;]
edit1: Sorry, been dumped with some work that has taken time, I hope I haven't made you waste any time checking for replies ^.^
Edit2: Oh, my custom page is simply called Custom, so I guess the function would be 'Custom'.