例子:路径选择
优质
小牛编辑
129浏览
2023-12-01
引用脚本的内容:
SetCompressor /SOLID /FINAL lzma XPStyle on !include "MUI.nsh" !insertmacro MUI_LANGUAGE "SimpChinese" Name "Test" OutFile "Test.exe" Caption "Test" !include "WinMessages.nsh" !include "FileFunc.nsh" Var INI Page Custom ShowCustom LeaveCustom Function .onInit BringToFront InitPluginsDir GetTempFileName $INI $PLUGINSDIR File /oname=$INI "Test.ini" WriteINIStr $INI "Field 3" "State" $PROGRAMFILES\Winamp WriteINIStr $INI "Field 4" "State" $PROGRAMFILES\Foobar2000 FunctionEnd Function ShowCustom InstallOptions::initDialog /NOUNLOAD "$INI" InstallOptions::show FunctionEnd Function LeaveCustom ReadINIStr $R2 $INI "Field 3" "State" ReadINIStr $R3 $INI "Field 4" "State" FunctionEnd Page instfiles Section SetOutPath "$R2\" File "Test.ini" SetOutPath "$R3\" SectionEnd
引用Test.ini的内容:
[Settings] NumFields=7 NextButtonText=确定 [Field 1] Type=Label Text=请选择下列软件的插件位置,以便将DFX安装至相应的目录: Left=44 Right=-10 Top=1 Bottom=12 [Field 2] Type=FileRequest [Field 3] Type=DirRequest State=$PROGRAMFILES\Winamp Text=请选择Winamp的路径: Left=49 Right=-10 Top=22 Bottom=35 [Field 4] Type=DirRequest State=$PROGRAMFILES\Foobar2000 Text=请选择Foobar2000的路径: Left=49 Right=-10 Top=56 Bottom=69 [Field 5] Type=Text State=FileRequest [Field 6] Type=Label Text=Winamp: Left=0 Right=40 Top=23 Bottom=35 [Field 7] Type=Label Text=Foobar2000: Left=0 Right=44 Top=58 Bottom=70