Skip to content
⌘ NSIS Forum Archive

need help regarding multini4 (instopts.dll)

14 posts

lvsram#

need help regarding multini4 (instopts.dll)

Hi,
As i have to insert 2 ini pages, i used InstOpts.dll similar to multini4 on sunjammer's site.I used same macros and same functions.
My problem is i am getting error when i use
ReadINIStr $3 "iniA.ini" "Field 3" State
Please help me.

thanks in advance.
lvsram
lvsram#edited
Now i found the problem that i haven't given the complete path of ini file.
But there is one thing i feel like knowing.
Is there any way to know what the error is?
Thank you very much for the response.
--lvsram
lvsram#
need help in testing values from fields / remain in same ini file

now i am inserting 3 ini files by using multini4 from sunjammer site.
i am able to get the values. Now my problem is
1 . i want to make sure the user entered some value in the first and then only i want user to go to second page. and same thing for second and third pages.
2. Exactly where in the methods onCustomPage, onPageEntry, onPageExit,
do i have to check(i think mostly in onPageExit) ? and when i check if i find the blank values, how can i force the current page to be shown without going next page, unless user enters some value in the fields.

please help me.
Thank you
kichik#
In the example (multini4.nsi) you have a function called onCustomPage. In it the DLL is called (CallInstDll "$TEMP\instopts.dll" dialog). All you need to do is condition the entire calling process (quoted below) with some StrCmp or IntCmp depending on the input from the last page.

Push "$TEMP\\ini$0.ini"
CallInstDll "$TEMP\\instopts.dll" dialog
Pop $0
StrCmp $0 "success" Done
  SetErrors
  StrCmp $0 "back" Done
  ; Something else - abort the installer.
    Call CleanUpAll
    Quit 
lvsram#
sorry i didn't get exactly your point.
Function onCustomPage
    MessageBox MB_OK "start of onCustomPage 2val is $2" ;first place
    Exch $2
    MessageBox MB_OK "onCustomPage 2val is $2" ;second place
    ; Show our custom InstOpts pages.
    Push "$TEMP\ini$2.ini"
    CallInstDll "$TEMP\InstOpts.dll" dialog
    Pop $2
    StrCmp $2 "success" Done
    SetErrors
    StrCmp $2 "back" Done
    ; Something else - abort the installer.
    MessageBox MB_OK "onCustomPage 2val in between is $2" ;third place
    Call Cleanup
    Quit
  
  Done:
    MessageBox MB_OK "onCustomPage 2val is $2" ; fourth place
    Pop $2
  FunctionEnd 
you mean to say to put the checking lines after StrCmp $2 "back" Done
Thank you very much
kichik#
After you call Exch $2 the page number is in $2 as long as you don't override it with Pop $2 in your example. Just pop the result to somewhere other than $2 ($0 for example) and then you should have the page letter during the whole function untill Pop $2.

If for example you want to save in $R0 the result of the first IO page and then according to it show or not show the second page use:
Function onCustomPage
  Exch $0
  Push $1
  ; Show our custom InstOpts pages.
  StrCmp $0 "B" 0 +2 ; second page
    ; // if value of $R0 from last page is
    ; // "don't show" then don't show
    StrCmp $R0 "don't show" Done 
  Push "$TEMP\\ini$0.ini"
  CallInstDll "$TEMP\\instopts.dll" dialog
  Pop $1
  StrCmp $1 "success" ReadData
    SetErrors
    StrCmp $1 "back" ReadData
      ; Something else - abort the installer.
      Call CleanUpAll
      Quit
ReadData:
  StrCmp $0 "A" 0 +2 ; first page
    ReadINIStr $R0 "$TEMP\\ini$0.ini" "Field 5" State
  ; else delete $R0 contents
  StrCpy $R0 ""
Done:
  Pop $1
  Pop $0
FunctionEnd 
lvsram#
Hi Kichik,
Thank you very much for fast replies.
Sorry to ask you the same question again and again.
As i am new and weak in push and pop knowledge, i feel so confused.
Please help me . I almost done my installation things 80% and when i complete this other 20% which is data validation, i will be done for now.

I used the above code and it is not stopping at the first page still it is going to second page. This is the change i made to your code.
One more thing exactly i don't know how to control the pages like
there is a text field in page1 and i want to check that when the user is going to next page, and when the user is going to third page , i want to check a field in second page.
Second thing is i want to fill one field in a page explicitly myself
using writeInistr, i feel good place is after calling CallInstDll .
Please tell me the correct place.
Please make changes to the below code in your reply.

Thank you very much.

Function onCustomPage
  MessageBox MB_OK "[0]start of onCustomPage before exch ,2val is $2" ;first place
  Exch $2
  MessageBox MB_OK "[0]onCustomPage after exch ,2val is $2" 
  
  ; Show our custom InstOpts pages.
  StrCmp $2 "B" 0 +2 ; second page
    ; // if value of $R9 from last page is
    ; // "don't show" then don't show
    StrCmp $R9 "don't show" Done 
  Push "$TEMP\myini$0.ini"
  CallInstDll "$TEMP\instopts.dll" dialog
  Pop $2
  StrCmp $2 "success" ReadData
    SetErrors
    StrCmp $2 "back" ReadData
      ; Something else - abort the installer.
      Call Cleanup
      Quit
ReadData:
  StrCmp $2 "A" 0 +2 ; first page
    ReadINIStr $3 "$TEMP\myini$2.ini" "Field 8" State
    StrCmp $3 "" 0 +2
    StrCpy $R9 "don't show"
  ; else delete $R9 contents
  StrCpy $R9 ""
Done:
  Pop $2
FunctionEnd 
kichik#
Second thing is i want to fill one field in a page explicitly myself using writeInistr, i feel good place is after calling CallInstDll. Please tell me the correct place.
If you want the change to be visible to the user you have to make the change before you call the DLL that will parse the INI file. If you do it after you call the DLL it will not show it.

I have attached a correct script, I will explain about it later if you want, just tell me what you don't understand.
lvsram#
small problem with attachment

Hi Kichik,
Thank you very much for help.
I have copied your coded and tried, but this has small problem.
Go to First ini
Click next button
checking validity of the field in first ini
if the user left the field in first ini blank then i don't want to proceed forward to any page but keep him in same page. this is similar to all 3 ini pages.
When i copied your code this is helping not to go to second ini page but going to third ini page.
If you want i can send you my nsi and ini files.

Thank you very much

the code you sent and i made a change at one line
StrCmp $3 "" DontShow Show
;...
  StrCmp $3 "" DontShow Show
;... 
no need to rewrite the whole script, only one line has changed... kichik
kichik#
Use IO's MinLen, MaxLen and ValidateText fields to do the trick. Read more about it in the InstallOptions readme.