!include "nsDialogs.nsh" Var PathTextBoxHandle Var EEEXEPathTextBoxHandle Var EEButtonHandle Function Page_SelectNWNPath nsDialogs::Create 1018 Pop $0 StrCmp $INSTALL_TYPE "diamond" diamond_select_path ee_select_path ee_select_path: StrCpy $INSTPATH "$DOCUMENTS\Neverwinter Nights" Goto selectpath_end diamond_select_path: StrCpy $INSTPATH "C:\Program Files (x86)\GOG Galaxy\Games\NWN Diamond" Goto selectpath_end selectpath_end: ;________________________________________ ; Create label above ${NSD_CreateLabel} 0 0 100% 12u "Please select your Neverwinter Nights install folder:" Pop $1 ; Create a read-only text box to display the selected path ${NSD_CreateText} 0 14u 75% 12u "$INSTPATH" Pop $PathTextBoxHandle ; Create a "Browse..." button ${NSD_CreateButton} 80% 14u 20% 12u "Browse..." Pop $2 ${NSD_OnClick} $2 OnBrowseClicked ;________________________________________ StrCmp $INSTALL_TYPE "diamond" skipee_exe StrCpy $EE_EXEPATH "C:\Program Files (x86)\GOG Galaxy\Games\Neverwinter Nights Enhanced Edition" ; Create the label ${NSD_CreateLabel} 0 32u 100% 12u "Select the location of the nwn exectable for EE:" Pop $2 ; Create the text ${NSD_CreateText} 0 44u 75% 12u "$EE_EXEPATH" Pop $EEEXEPathTextBoxHandle ; CReate the button ${NSD_CreateButton} 80% 44u 20% 12u "Browse..." Pop $EEButtonHandle ${NSD_OnClick} $EEButtonHandle OnBrowse2Clicked ${NSD_CreateLabel} 0 58u 100% 24u "(Path may differ for steam ex: C:\Program Files (x86)\Steam\steamapps\common\Neverwinter Nights)" ;________________________________________ skipee_exe: nsDialogs::Show FunctionEnd Function OnBrowseClicked nsDialogs::SelectFolderDialog "Select Neverwinter Nights Folder" "$INSTPATH" Pop $0 StrCmp $0 "" done StrCmp $0 "error" done StrCpy $INSTPATH "$0" ${NSD_SetText} $PathTextBoxHandle $INSTPATH done: FunctionEnd Function OnBrowse2Clicked nsDialogs::SelectFolderDialog "Select Neverwinter Nights executable location" "$EE_EXEPATH" Pop $0 StrCmp $0 "" done StrCmp $0 "error" done StrCpy $EE_EXEPATH "$0" ${NSD_SetText} $EEEXEPathTextBoxHandle $EE_EXEPATH done: FunctionEnd Function Page_SelectNWNPath_Validation ; Get the current text in the folder path textbox ${NSD_GetText} $PathTextBoxHandle $INSTPATH ; Check if tlk and hak folder exists IfFileExists "$INSTPATH\tlk\*.*" 0 invalid IfFileExists "$INSTPATH\hak\*.*" 0 invalid StrCmp $INSTALL_TYPE "diamond" skipee_exe_validation ; IF EE Gotta validate for the exetucable's presence!! IfFileExists "$EE_EXEPATH\bin\win32" 0 invalid skipee_exe_validation: ; Everything is valid Return invalid: MessageBox MB_ICONEXCLAMATION|MB_OK "The selected folder must contain both 'tlk' and 'hak' subfolders." Abort ; Prevents advancing to next page FunctionEnd