|
|
#1 |
|
Junior Member
Join Date: Feb 2009
Posts: 11
|
Hi, I'm a newbie. i really need help to write my script but i couldn't find a way yet. so i have to write this.
i'm really tired of watching scripts for days. i'm trying to make a WOW(world of warcraft) Addon package with Nsis. I have some plug-ins like HM NIS, advsplash, UMUI, InstallOptionsEx and so on. I already read the most of tutorials and reademe files but i can't find how to make the radio buttons in INI file work with NSI file. I hope someone show me the way. ======================= this is INI file contents [Settings] NumFields=8 [Field 1] Type=Groupbox Text=resolution Left=0 Right=284 Top=22 Bottom=153 [Field 2] Type=Bitmap Text=crt.bmp Left=8 Right=86 Top=38 Bottom=108 Flags=RESIZETOFIT [Field 3] Type=Bitmap Text=wide2.bmp Left=99 Right=179 Top=37 Bottom=108 Flags=RESIZETOFIT [Field 4] Type=Bitmap Text=wide.bmp Left=188 Right=272 Top=36 Bottom=108 Flags=RESIZETOFIT [Field 5] Type=Label Text=choose your monitor resolution~!!! Left=17 Right=211 Top=4 Bottom=14 [Field 6] Type=RadioButton Text=1280 X 1024 Left=9 Right=89 Top=110 Bottom=144 [Field 7] Type=RadioButton Text=1680 X 1050 wide Left=95 Right=186 Top=115 Bottom=147 [Field 8] Type=RadioButton Text=1680x1050 wide with larger font Left=189 Right=272 Top=113 Bottom=148 ========================================================= field 6,7,8 are the buttons but i don't know how to call these buttons in NSI file in the installer, i can see the BMPs and buttons but it doesn't work which one i choose. ======= i found the BMP and button showing script ======= !insertmacro MUI_INSTALLOPTIONS_EXTRACT "AccountInf.ini" !insertmacro MUI_INSTALLOPTIONS_WRITE "AccountInf.ini" "Field 2" "State" "$PLUGINSDIR\crt.bmp" SetOutPath "$PLUGINSDIR" File "crt.bmp" !insertmacro MUI_INSTALLOPTIONS_WRITE "AccountInf.ini" "Field 3" "State" "$PLUGINSDIR\wide2.bmp" SetOutPath "$PLUGINSDIR" File "wide2.bmp" !insertmacro MUI_INSTALLOPTIONS_WRITE "AccountInf.ini" "Field 4" "State" "$PLUGINSDIR\wide.bmp" SetOutPath "$PLUGINSDIR" File "wide.bmp" !insertmacro MUI_INSTALLOPTIONS_READ $INI_RESOLUTION "AccountInf.ini" "Field 6" "1" ;1280 X 1024 !insertmacro MUI_INSTALLOPTIONS_READ $INI_RESOLUTION "AccountInf.ini" "Field 7" "0" ;1680 X 1050 !insertmacro MUI_INSTALLOPTIONS_READ $INI_RESOLUTION "AccountInf.ini" "Field 8" "0" ;1680 X 1050 FunctionEnd =========================================================== now, here is the problem. there is no connection between INI and NSI file. Please, someone help |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Jun 2001
Posts: 1,173
|
before FunctionEnd, add this:
code: Or, alternatively (if you might have to poke at the UI before it is popped up onto the screen) code: That should be all that you're missing. Look for this info in the "Using InstallOptions for custom pages" section of the Modern UI (MUI) docs. Note that Modern UI has been superseded by Modern UI 2 (MUI2), which no longer uses installoptions, instead creating your custom dialogs programatically - you can still use the old MUI, of course. |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2009
Posts: 11
|
//Animaether
i added the code above and I think it doesn;t work. as i added the code and recompiled my files, the installer bashed of in the middle of installation. i can see the buttons and BMPs while installation but it doesn't work properly. i mean, radiobutton page(accountinf.ini) is shown while installation but doesn't work no matter which button i choose. my installer contains below 1. welcome page 2. agreement page 3. resolution select page (accountinf.ini) 4. account info ipput page(accountinf1.ini) 5. addons select page 6. destination folder page 7. finish page but only the resolution page doesn't work. other parts work well. so i think there's missing link between INI and NSI file. |
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
You need to have a create functions for each of your pages. (in other words two separate functions in your case because you have 2 separate custom pages.) An example is in the MUI docs as Animaether points out.
Also, for a group of radiobuttons to function correctly using an INI file based page, you need to make sure you add FLAGS=GROUP to the first radiobutton in the group (Field 6 in your example). |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2009
Posts: 11
|
radio buttons still don't work.
page 3(resoultion)and page 4(account info) page are the custom pages. ======== this is accountinf.ini =========================== [Settings] NumFields=9 [Field 1] Type=Label Text=choose your resoultion! Left=17 Right=211 Top=4 Bottom=14 [Field 2] Type=Groupbox Text=Resoultion Left=0 Right=84 Top=22 Bottom=153 [Field 3] Type=Groupbox Text=Description Image Left=88 Right=228 Top=23 Bottom=153 [Field 4] Type=RadioButton Text=1280 X 1024 Left=10 Right=68 Top=43 Bottom=71 Flags=NOTIFY [Field 5] Type=RadioButton Text=1680 X 1050 Left=10 Right=75 Top=76 Bottom=99 Flags=NOTIFY [Field 6] Type=RadioButton Text=1680 x 1050 Large Font Left=10 Right=72 Top=108 Bottom=128 Flags=NOTIFY [Field 7] Type=Bitmap Text=crt.bmp Left=95 Right=220 Top=35 Bottom=144 Flags=RESIZETOFIT [Field 8] Type=Bitmap Text=wide2.bmp Left=94 Right=218 Top=33 Bottom=144 Flags=RESIZETOFIT [Field 9] Type=Bitmap Text=wide.bmp Left=95 Right=219 Top=32 Bottom=144 Flags=RESIZETOFIT ========== this is the part of NSI file ================= !include "UMUI.nsh" ... !include "Sections.nsh" !include logiclib.nsh ReserveFile "AccountInf.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ReserveFile "AccountInf1.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll" Var VER Var INI_RESOLUTION Var INI_ACCOUNT Var INI_SERVER Var INI_CHARACTER ;Var INI_CLASS Var RE_ACCOUNT_TOTAL Var RE_ACCOUNT_NUM Var INI_Macrosetting Function .onInit InitPluginsDir File /oname=$PLUGINSDIR\splash.bmp "boddalhee_1.bmp" File /oname=$PLUGINSDIR\splash.wav "sound.wav" advsplash::show 2400 1200 1200 0xDE3E48 $PLUGINSDIR\splash Pop $0 ;$0 has '1' if the user closed the splash screen early, ;'0' if everything closed normally, and '-1' if some error occurred. Delete $PLUGINSDIR\splash.bmp ## Extract InstallOptions INI files File /oname=$PLUGINSDIR\crt.bmp "crt.bmp" File /oname=$PLUGINSDIR\wide2.bmp "wide2.bmp" File /oname=$PLUGINSDIR\wide.bmp "wide.bmp" File /oname=$PLUGINSDIR\AccountInf.ini "AccountInf.ini" File /oname=$PLUGINSDIR\AccountInf1.ini "AccountInf1.ini" Pop $VER Pop $5 FunctionEnd !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "License.txt" Page custom Monitor MonitorLeave ": Select Resoultion" Function Monitor InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\AccountInf.ini" Pop $0 InstallOptions::show Pop $0 FunctionEnd Function MonitorLeave ; At this point the user has either pressed Next or one of our custom buttons ; We find out which by reading from the INI file ReadINIStr $0 "AccountInf.ini" "Settings" "State" ${Unless} $0 = 0 StrCmp $0 4 RadioButton ;1280 StrCmp $0 5 RadioButton ;1680 StrCmp $0 6 RadioButton ;1680 big Abort ; Return to the page ${EndUnless} RadioButton: ReadINIStr $0 "$PLUGINSDIR\AccountInf.ini" "Field 4" "State" ReadINIStr $1 "$PLUGINSDIR\AccountInf.ini" "Field 7" "HWND" ShowWindow $1 $0 ReadINIStr $0 "$PLUGINSDIR\AccountInf.ini" "Field 5" "State" ReadINIStr $1 "$PLUGINSDIR\AccountInf.ini" "Field 8" "HWND" ShowWindow $1 $0 ReadINIStr $0 "$PLUGINSDIR\AccountInf.ini" "Field 6" "State" ReadINIStr $1 "$PLUGINSDIR\AccountInf.ini" "Field 9" "HWND" ShowWindow $1 $0 Abort ; Return to the page FunctionEnd Page custom AccountPage Accountinfo ":Enter Account Info" Function AccountPage InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\AccountInf1.ini" Pop $0 InstallOptions::show Pop $0 FunctionEnd Function Accountinfo ; At this point the user has either pressed Next or one of our custom buttons ; We find out which by reading from the INI file ReadINIStr $0 "$PLUGINSDIR\AccountInf1.ini" "Settings" "State" ReadINIStr $1 "$PLUGINSDIR\AccountInf1.ini" "Field 3" "HWND" ReadINIStr $1 "$PLUGINSDIR\AccountInf1.ini" "Field 5" "HWND" ReadINIStr $1 "$PLUGINSDIR\AccountInf1.ini" "Field 7" "HWND" ;ReadINIStr $1 "$PLUGINSDIR\AccountInf1.ini" "Field 9" "HWND" ReadINIStr $1 "$PLUGINSDIR\AccountInf1.ini" "Field 11" "HWND" Abort ; Return to the page .......... ========================================================== now i can't go to page 4 from page 3. if i don't put AccountInf.ini file, it works well. but i really want to let the users choose the resolution by showing the resoultion image when they click a radiobutton. it is really annoying. please, your know-how will lit my way. |
|
|
|
|
|
#6 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
Please attach large files next time as it's easier to read posts when you don't have to scroll through all the code....
Don't mix LogicLib and labels. The solution here is the same as in your previous post code: edit: Also change your page's INI file, field 4 to this: code: |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|