Archive: Multiple InstallOptions DirRequests


Multiple InstallOptions DirRequests
I would like to show three DirRequest options in a row for multiple save locations in a backup location, does anyone know of a way that I can show them?

Thank you in advance!!


First of all, InstallOptions has been deprecated, please use nsDialogs instead: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

To answer your question, you can just declare three different dirrequests in a row, as far as I know. What exactly goes wrong when you try it?


Re: Multiple InstallOptions DirRequests
It shows a single option but I want three in a row, I am using an ini file which works for the first one and not the second, I know I am calling the right location but it shows the first and not the second, both are called in the nsis code.

Thank you for your reply and I will try nsDialogs.


Well we can't really help you unless you link to some code. Like, your ini file for example. But yeah, screw ini files, nsDialogs is the way to go.


Sorry
Sorry I didn't reply but I tried nsDialogs and it is working very well except that it will not accept ReadINIStr at all but it is working perfectly on everything else, any ideas?


Code
Here is the code I am using (at least trying to!):

Function BrowseButton

nsDialogs::SelectFolderDialog "Please select your first backup save location" "$DRIVELETTER:\"

Pop $BrowseResult

${NSD_SetText} $DirRequest $BrowseResult

FunctionEnd

Function BrowseButton1

nsDialogs::SelectFolderDialog "Please select your second backup save location" "$DRIVELETTER:\"

Pop $BrowseResult1

${NSD_SetText} $DirRequest1 $BrowseResult1

FunctionEnd

Function BrowseButton2

nsDialogs::SelectFolderDialog "Please select your third backup save location" "$DRIVELETTER:\"

Pop $BrowseResult2

${NSD_SetText} $DirRequest2 $BrowseResult2

FunctionEnd


Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog

;Start of problem code.
ReadINIStr $R0 "$EXEDIR\MozillaThunderbirdBackup.ini" "MozillaThunderbirdBackup" "DirRequestINI"
${NSD_GetText} $R0 $1
${NSD_SetText} $DirRequest $1
ReadINIStr $DirRequestINI1 "$EXEDIR\MozillaThunderbirdBackup.ini" "MozillaThunderbirdBackup" "DirRequestINI1"
${NSD_SetText} $DirRequest1 $DirRequestINI1
ReadINIStr $DirRequestINI2 "$EXEDIR\MozillaThunderbirdBackup.ini" "MozillaThunderbirdBackup" "DirRequestINI2"
${NSD_SetText} $DirRequest2 $DirRequestINI2

;End of problem code.
;Comment below.

${If} $Dialog == error
Abort
${EndIf}

${NSD_CreateBrowseButton} 273u 90u 5% 13u "..."
Pop $BrowseButton
${NSD_OnClick} $BrowseButton BrowseButton


${NSD_CreateDirRequest} 10u 90u 87% 13u "Please select your first backup save location."
Pop $DirRequest

${NSD_CreateBrowseButton} 273u 104u 5% 13u "..."
Pop $BrowseButton1
${NSD_OnClick} $BrowseButton1 BrowseButton1



${NSD_CreateDirRequest} 10u 104u 87% 13u "Please select your second backup save location."
Pop $DirRequest1

${NSD_CreateBrowseButton} 273u 118u 5% 13u "..."
Pop $BrowseButton2
${NSD_OnClick} $BrowseButton2 BrowseButton2

${NSD_SetText} $DirRequest2 $DirRequestINI2


${NSD_CreateDirRequest} 10u 118u 87% 13u "Please select your third backup save location."
Pop $DirRequest2





nsDialogs::Show

FunctionEnd


Comment: I am just trying to get it to read from the INI file and fill the directory path but it will not fill the directory path, it is working with the same "fill" method on the browse buttons so it is probably the "ReadINIStr" part but the NSIS compiler isn't showing any errors and I can't figure out what is going wrong.

And the identical ReadINIStr format and code is working perfectly elsewhere.


And the top few paragraphs (it is supposed to be a Thunderbird backup program):

;=== Includes
!include MUI2.nsh
!include FileFunc.nsh
!insertmacro GetTime
!include GetParent.nsh
!include InstallOptions.nsh
!include LogicLib.nsh
!include nsDialogs.nsh


;=== Icon & Style ===
!define MUI_ICON "MozillaThunderbirdBackup.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP backupheader.bmp
!define ReadINIStrNS "!insertmacro ReadINIStrNS"

BrandingText "Mozilla Thunderbird Backup - Your Email, Anywhere"
InstallButtonText "Backup Now"
ShowInstDetails show
SubCaption 3 " | Backing Up Files"

;=== Variables
Var BACKUPFILENAME
Var BACKUPDIRECTORY
Var USE7ZFORMAT
Var USEMAXCOMPRESSION
Var SHOWBACKUPDETAILS
Var DRIVELETTER
Var EXECSTRING
Var BACKUPEVERYTHING
Var BACKUPEMAIL
Var BACKUPEXCLUDINGMAIL
Var FINISHTEXT
Var FINISHTITLE
Var BACKUPEXTENSION
Var BACKUPTYPE
Var MOZILLATHUNDERBIRDROOTPATH
Var Dialog
Var DirRequest
Var BrowseButton
Var BrowseResult
Var DirRequest1
Var BrowseButton1
Var BrowseResult1
Var DirRequest2
Var BrowseButton2
Var BrowseResult2
Var DirRequestINI
Var DirRequestINI1
Var DirRequestINI2



;=== Pages
!define MUI_WELCOMEFINISHPAGE_BITMAP welcomefinish.bmp
!define MUI_WELCOMEPAGE_TITLE "Mozilla Thunderbird Backup"
!define MUI_WELCOMEPAGE_TEXT `$(welcome)`
;!define MUI_WELCOMEPAGE_TEXT "rather long description that stretched the post in width"
!insertmacro MUI_PAGE_WELCOME
Page custom ShowBackupWindow LeaveBackupWindow " | $(settingsheader)"
Page custom nsDialogsPage
Page instfiles
!define MUI_FINISHPAGE_TITLE "$FINISHTITLE"
!define MUI_FINISHPAGE_TEXT "$FINISHTEXT"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES


This is just the current state of the code and I am trying everything I can think of.

As is obvious I was trying a temporary identifier, ${NSD_GetText} etc.


These are the INI file contents:

[MozillaThunderbirdBackup]
Use7zFormat=1
UseMaxCompression=1
ShowBackupDetails=1
BackupEmail=0
BackupExcludingMail=0
BackupEverything=1
DirRequestINI=C:\Users\Family\Desktop
DirRequestINI1=C:\Users\Family\Desktop
DirRequestINI2=C:\Users\Family\Desktop

I did say "link" to some code. Please don't paste such a mess...


You can't NSD_SetText etc if the control doesn't exist. First create the controls, then set their properties/text.


Sorry, NSD_SetText is for the browse buttons and is working very well but the rest isn't.

I am attaching the complete code.

Thanks again and sorry!!


I already told you, you're trying to SetText before the element is created.

Please follow the tutorial in the nsDialogs readme: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html


It worked!! Thank you, I don't know if I should create a new topic but now I am having a problem with getting the selected option from a DropList in nsDialogs, the code is below:

        ${NSD_CreateDropList} 20u 20u 13% 13u "..."
Pop $ZipOptions

SendMessage $ZipOptions ${CB_ADDSTRING} 0 "STR:7z"

SendMessage $ZipOptions ${CB_ADDSTRING} 0 "STR:GZip"

SendMessage $ZipOptions ${CB_ADDSTRING} 0 "STR:BZip2"

SendMessage $ZipOptions ${CB_ADDSTRING} 0 "STR:Tar"

SendMessage $ZipOptions ${CB_ADDSTRING} 0 "STR:ISO"

SendMessage $ZipOptions ${CB_ADDSTRING} 0 "STR:UDF"

${NSD_GetText} $SaveFormat $ZipOptions



And further down:


${StrCase} "$SaveFormat2" "$SaveFormat" "L"

;'CompileEXECString:
StrCpy $EXECSTRING `a -w"$TEMP"`

StrCmp $USE7ZFORMAT "1" "" "UseZipFormat"
StrCpy $EXECSTRING `$EXECSTRING -t$SaveFormat2`
StrCpy $BACKUPEXTENSION "$SaveFormat2"
Goto CheckCompressionType


I am trying to have it set the compression method for 7-Zip, and it is not getting the text before the StrCase part, do you know what the problem is?

--LOVENSIS

Your order of parameters for GetText is wrong. To avoid confusion, I recommend appending the control variable names with the control type, e.g. DropListZipOptions.

Stu


Still nothing
Thank you, but it didn't help.

Now I am also having a problem with WriteINIStr :blah:

Here is the code for that:

        nsDialogs::OnChange $DirRequest LeavensDialogsPage
nsDialogs::OnChange $DirRequest1 LeavensDialogsPage
nsDialogs::OnChange $DirRequest2 LeavensDialogsPage

nsDialogs::Show

FunctionEnd

Function LeavensDialogsPage

WriteINIStr $EXEDIR\MozillaThunderbirdBackup.ini "MozillaThunderbirdBackup" "DirRequestINI" "$DirRequestINISave"
WriteINIStr $EXEDIR\MozillaThunderbirdBackup.ini "MozillaThunderbirdBackup" "DirRequestINI1" "$DirRequestINISave1"
WriteINIStr $EXEDIR\MozillaThunderbirdBackup.ini "MozillaThunderbirdBackup" "DirRequestINI2" "$DirRequestINISave2"
WriteINIStr $EXEDIR\MozillaThunderbirdBackup.ini "MozillaThunderbirdBackup" "SaveFormat" "$SaveFormat"



FunctionEnd


I was trying onChange for that but have tested it and it is writing to the ini file but it won't do it from DirRequestINISave is all of my code bad?

Thanks for all of your time!