Archive: updating ini pages, retrieving buttons and 3rd party installers


updating ini pages, retrieving buttons and 3rd party installers
Hi,

I've been using NSIS for a few months and it worked great for producing quick and simple installs. I now find myself with a far more complicated installer and I have a few questions to which i haven't yet found any answers in the forum or archive.


I need to check that Quicktime, Adobe Acrobat Reader and DirectX are installed. With the help of the archive I've got these functions up and running, however I have two issues.

Firstly I'd like to display a page where it indicates which of the third party apps are present and which are missing. I've been playing with installoptions and whilst I can read values as well as detect user interaction I cannot find a way to change the states. Initially I tried using WriteINIStr with FlushINI, but that didn't work, then whilst reading through the forum I found a remark about MUI_INSTALLOPTIONS_WRITE. I assume like the other MUI_ options this is a macro and indeed i can call it without getting an error as

!insertmacro MUI_INSTALLOPTIONS_WRITE "$PLUGINSDIR\Page_ThirdPartyCheck.ini" "Field 3" "State" 0


Yet it doesn't work, all it does is make the checkbox disappear, well actually the checkbox is more corrupted than missing, just a few black lines. If I rollover the checkbox area though, it and its text popup, but the state has not changed.

a. So what am I doing wrong?
b. Is there any more documentation to installoptions? The readme that comes with it appears to be for an older version, and nowhere can i find anything about the macro MUI_INSTALLOPTIONS_WRITE.
c. Is what i'm trying to do possible or even recommended?
d. If you can edit an ini before its used to display the page what are the order of opertations?


The second issue i'm having is when to do these checks and run the installers. As I mention above, my plan was to have a custom page so the user knows whats going on and in the create_function do my app checks. If any failed then I display a message box to allow the user to install (use ExecWait to run it) or ignore. Unfortunately none of the code appears to execute in the create_function, its not until you press one of the back, next, cancel buttons that it is triggered. I tried moving the code to the leave_function, since thats when it appeared to be run, but that presents its own problems. Mainly that if the user presses any of the main buttons it will execute the app check which I clearly don't want. However unlike in installoptions which tells you whats been clicked, I can find no method of detecting which of the main 3 buttons have been pressed.

e. How have others approached providing the user with the installs for several third party applications?
f. Can I detect which of the main 3 buttons have been pressed?
g. Anyway to get the app check function to run at the start of a page?
h. I tried putting the checks after the MUI_PAGE_INSTFILES page, but oddly the functions just fail completely at that point? Is there a reason for this?

I'm wondering if i did the checks in .onInit, that might get around the user triggering it by going back and forth. However i'd rather have the Eula come up first and then do the thrid party app checks and installs.

OK after posting i found a few things that might help in the MUI help. Firstly it explains the MUI_INSTALLOPTIONS_WRITE but it still doesn't appear to work. Secondly it mentions two functions MUI_INSTALLOPTIONS_SHOW_RETURN and MUI_INSTALLOPTIONS_DISPLAY_RETURN to get which of the main buttons have been pressed, but simply using either of these macros cause the installer to crash?

So at this point i'd appricate any guidance that can be offered.

Cheers

ok I think i've got the writing to the page ini working. It appears that using $PLUGINSDIR\ in the filename was messing it up - odd becuase i only put that in when trying to fix something else. I'll have to check if it actually did fix the other bug.

Still no closer to getting feedback for the main buttons being pressed, or the best time to check/install third party software.


MUI_INSTALLOPTIONS_WRITE just calls WriteINIStr with an addition of $PLUGINSDIR.

For an example of working with buttons in an InstallOptions page see Contrib\InstallOptions\notify.nsi. It should explain all of your troubles with it.

If the checks are simple, it's best to do them in .onInit because that way they'll execute when the installer is silent too. However, if it's not silent, it's best to show the results of the checks in a custom page. Use IfSilent to find out if the installer is silent or not.