Inclusion 1: ------------------------------------ ; SetFlag.nsh ; Author: Ken Andrews ; Incoming: ; R0 Offset to put the flag value at. ; R1 Value for the flag itself, single char. ; R9 Flag string. ; FlagLen Defined Constant. ; R2 R3 ; | | ; /----\ /-\ ; NNNNNNNNNN ; | ; R0 ; Get some working space push $R2 push $R3 push $R4 push $R5 ;;;MessageBox MB_OK "Old Flagset = $R9" ; R2 = first R0 characters of R9 StrCpy $R2 $R9 $R0 0 ; How many right-side characters we need? IntOp $R4 ${FlagLen} - $R0 ; And the offset to grab them from? IntOp $R5 $R0 + 1 ; Grab right-side characters. StrCpy $R3 $R9 $R4 $R5 ;;;MessageBox MB_OK "Left-Right = $R2-$R3" ; Build new string, truncated to proper length. StrCpy $R9 "$R2$R1$R3" ${FlagLen} 0 ;;;MessageBox MB_OK "New Flagset = $R9" ; And restore the working space. Pop $R5 Pop $R4 Pop $R3 Pop $R2 Inclusion 2:------------------------------------ ; GetFlag.nsh ; Author: Ken Andrews ; Incoming: ; R0 Which flag to get. ; R9 Flag string. ; Outgoing: ; R0 Single character flag. ; YYYNNYNYYY ; | ; R0 StrCpy $R0 $R9 1 $R0 Main code:-------------------------------------- ; Test Script 15 ; Author: Ken Andrews ; MUI Header !include "MUI.nsh" ; Identification !define MUI_PRODUCT "Test Routine" !define MUI_VERSION "1.0.0" ;;;Name "${MUI_PRODUCT} ${MUI_VERSION}" ; Configuration OutFile "Test.exe" ; Target Directory. Note that in most cases the bottom ; level will be $PROGRAMFILES, but for our testing we want ; to use somewhere a bit safer. InstallDir "e:\text\${MUI_PRODUCT}" ; MUI Configuration via defines. ; Note that order here DOES NOT determine order of actual ; processing. This is just an activation section. ; Show the welcome page. !define MUI_WELCOMEPAGE ; Show the finish page. !define MUI_FINISHPAGE ; Show the license page. LicenseData "${NSISDIR}\Code\License.txt" !define MUI_LICENSEPAGE ; Build the uninstall executable. !define MUI_UNINSTALLER ; Allow user to choose target directory. !define MUI_DIRECTORYPAGE ; If the user chooses "Cancel", this gives him a chance ; to change his mind. !define MUI_ABORTWARNING ; This puts a confirmation page at the start of the ; uninstaller. Without this, the uninstaller simply runs ; when it's double-clicked. With this, it tells you it's ; gonna uninstall and gives you a chance to change your ; mind. !define MUI_UNCONFIRMPAGE ; When there's multiple components, this allows the user ; to decide what gets installed. !define MUI_COMPONENTSPAGE ; This puts a company logo on the little white text block ; at the top of the installation windows. The second one ; moves it from the left to the right side. !define MUI_HEADERBITMAP ${NSISDIR}\Code\TPLogoSm.bmp !define MUI_HEADERBITMAP_RIGHT ; MUI Macro insertion. ; I don't know why we need this, but we do. I guess it can't ; set up a default language. !insertmacro MUI_LANGUAGE "English" ; Installer Sections Section "-InitFlags" !define OffTMSExe 0 !define OffTMSScr 1 !define OffTMSChn 2 !define OffODBC 3 !define OffComp 4 !define OffDB 5 !define FlagLen 6 StrCpy $R9 "NNNNNN" SectionEnd Subsection "TMS" ; Forced installation. Section "-TMS Executable" ; ; Where to stuff things. SetOutPath "$INSTDIR\tpm10\tims\sys\dbc" ; ; What to stuff. File e:\text\sample.txt ; ; Flag that we went active. Push $R0 Push $R1 StrCpy $R0 ${OffTMSExe} StrCpy $R1 "Y" !include "${NSISDIR}\Code\SetFlag.nsh" Pop $R1 Pop $R0 SectionEnd ; Section "TMS Scripts" ; ; Where to stuff things. SetOutPath "$INSTDIR\tpm10\tims\sys\bin" ; ; What to stuff. File e:\text\sample.txt ; ; Flag that we went active. Push $R0 Push $R1 StrCpy $R0 ${OffTMSScr} StrCpy $R1 "Y" !include "${NSISDIR}\Code\SetFlag.nsh" Pop $R1 Pop $R0 SectionEnd ; Section "TMS Chains" ; ; Where to stuff things. SetOutPath "$INSTDIR\tpm10\tims\sys\chn" ; ; What to stuff. File e:\text\sample.txt StrCmp $R1 "No" SkipBMP File e:\text\TPLogo1.bmp SkipBMP: ; ; Flag that we went active. Push $R0 Push $R1 StrCpy $R0 ${OffTMSChn} StrCpy $R1 "Y" !include "${NSISDIR}\Code\SetFlag.nsh" Pop $R1 Pop $R0 SectionEnd SubsectionEnd Subsection "ODBC" Section "ODBC Part A" ; ; Where to stuff things. SetOutPath "$INSTDIR\ODBC" ; ; What to stuff. File e:\text\sample.txt ; ; Flag that we went active. Push $R0 Push $R1 StrCpy $R0 ${OffODBC} StrCpy $R1 "Y" !include "${NSISDIR}\Code\SetFlag.nsh" Pop $R1 Pop $R0 SectionEnd SubsectionEnd Subsection "Compiler" Section "Comp Part A" ; ; Where to stuff things. SetOutPath "$INSTDIR\Compile" ; ; What to stuff. File e:\text\sample.txt ; ; Flag that we went active. Push $R0 Push $R1 StrCpy $R0 ${OffComp} StrCpy $R1 "Y" !include "${NSISDIR}\Code\SetFlag.nsh" Pop $R1 Pop $R0 SectionEnd SubsectionEnd Subsection "Database" Section "DB Part A" ; ; Where to stuff things. SetOutPath "$INSTDIR\DataBase" ; ; What to stuff. File e:\text\sample.txt ; ; Flag that we went active. Push $R0 Push $R1 StrCpy $R0 ${OffDB} StrCpy $R1 "Y" !include "${NSISDIR}\Code\SetFlag.nsh" Pop $R1 Pop $R0 SectionEnd SubsectionEnd Section "-Uninst" ; ; Build our uninstall routine while we're at it. WriteUninstaller Uninst.exe SectionEnd ; Uninstaller Section Section "Uninstall" ; StrCpy $R0 ${OffTMSExe} !include "${NSISDIR}\Code\GetFlag.nsh" StrCmp $R0 "Y" DelEXE SkipEXE DelEXE: Delete "$INSTDIR\tpm10\tims\sys\dbc\sample.txt" RMDir "$INSTDIR\tpm10\tims\sys\dbc" RMDir "$INSTDIR\tpm10\tims\sys" RMDir "$INSTDIR\tpm10\tims" RMDir "$INSTDIR\tpm10" SkipEXE: ; StrCpy $R0 ${OffTMSScr} !include "${NSISDIR}\Code\GetFlag.nsh" StrCmp $R0 "Y" DelSCR SkipSCR DelSCR: Delete "$INSTDIR\tpm10\tims\sys\bin\sample.txt" RMDir "$INSTDIR\tpm10\tims\sys\bin" RMDir "$INSTDIR\tpm10\tims\sys" RMDir "$INSTDIR\tpm10\tims" RMDir "$INSTDIR\tpm10" SkipSCR: ; StrCpy $R0 ${OffTMSChn} !include "${NSISDIR}\Code\GetFlag.nsh" StrCmp $R0 "Y" DelCHN SkipCHN DelCHN: Delete "$INSTDIR\tpm10\tims\sys\chn\sample.txt" Delete "$INSTDIR\tpm10\tims\sys\chn\TPLogo1.bmp" RMDir "$INSTDIR\tpm10\tims\sys\chn" RMDir "$INSTDIR\tpm10\tims\sys" RMDir "$INSTDIR\tpm10\tims" RMDir "$INSTDIR\tpm10" SkipCHN: ; StrCpy $R0 ${OffODBC} !include "${NSISDIR}\Code\GetFlag.nsh" StrCmp $R0 "Y" DelODBC SkipODBC DelODBC: Delete "$INSTDIR\ODBC\sample.txt" RMDir "$INSTDIR\ODBC" SkipODBC: ; StrCpy $R0 ${OffComp} !include "${NSISDIR}\Code\GetFlag.nsh" StrCmp $R0 "Y" DelCOMP SkipCOMP DelCOMP: Delete "$INSTDIR\Compile\sample.txt" RMDir "$INSTDIR\Compile" SkipCOMP: ; StrCpy $R0 ${OffDB} !include "${NSISDIR}\Code\GetFlag.nsh" StrCmp $R0 "Y" DelDB SkipDB DelDB: Delete "$INSTDIR\DataBase\sample.txt" RMDir "$INSTDIR\DataBase" SkipDB: ; Delete "$INSTDIR\Uninst.exe" RMDir "$INSTDIR" SectionEnd