Archive: Run Time Install Options


Run Time Install Options
Hey whats up.
The deal is that I want to have a custom install page that is compiled at run time. Think of it as this:
The user selects a directory, and then I list all the directories that are contained in InstDir. My reasons are a little more complex, but if someone could help get this far, I think I could manage. I was thining of calculating the current page using the .on*Page callbacks, but those are gone. Also, I am reading the options from a .ini file that is loaded in teh executable... Is there a way to either a) compile a .ini file in teh user's Temp directory and use that, or modify the one on board (doubtful).
Thanks for the help.
-Froggy


Re: Run Time Install Options
Quote:


Ok, i just looked at the macro definition and saw when are where it was extracted, so Ill play with that...
Thanks anyway =)

Originally posted by Bud-froggy
Hey whats up.
The deal is that I want to have a custom install page that is [....]
Thanks for the help.
-Froggy


Haha... back again.
This time around, I wrote a plugin to return a list of all the files and directories in the current directory. I run into problems when I try and call it from the script.
I have:

        InitPluginsDir
ListFiles::ListFiles $PLUGINSDIR\ListFiles

And the compiler returns the following error:
InitPluginsDir
Invalid command: ListFiles::ListFiles
Error in script "D:\Installer\Example.nsi" on line 24 -- aborting creation process

I put the DLL in its own folder in the Contrib section of the NSIS installation...
I would very much appreciate a little help here, because I am stumped.
Then again, as soon as I hit post, I willprobably figure it out =)
-Froggy

AFAIK, you should put the dll in ${NSISDIR}\plugins. :)


doh.

thanks =)


To list files in a directory use FindFirst, FindNext and FindClose. To write into an INI file use WriteIniStr and friends. To add another plugins dir to NSIS's list use PluginsDir. You don't have to call InitPluginsDir before calling a plug-in. You only need to call this function if you wish to use $PLUGINSDIR before any plug-in was called.


Well, scratch the plugin then =)

MEanwhile I have been looking around, and I cant seem to figure out how to call a function after selecting an InstDir but before the custom page....
I have a declared a custom page, to be ordered right after the directory selection page, but I cant seem to hook anything that is called between the two.
SetDirectory and SetDirectory Dialog are called before the page, and the custom function for the page is called when the custom page is destroyed... too late for me since the custom page depends on the install directory that was choosen.
I am fairly certain there is a way because I was browsing thru the forums and saw something about it, but now i cant seem to find it for the life of me... quite annoying.
Anyway, thanks for any and all help
-froggy


There is no after page callback function currently. The custom page function is called after the custom page is destryoed, it is called to create the page. By calling InstallOptions::dialog (MUI_INSTALLOPTIONS_DISPLAY macro in the MUI's case) in this callback function you are creating the page. All you need to do is write to that INI file before you call IO::dialog or insert the macro.


.. which is what i did, but to no avail. here is the cut down code..


Function SetCustomMod
InitPluginsDir
File /oname=$PLUGINSDIRS\ioMod.ini ioMod.ini

FileOpen $R0 $PLUGINSDIR\ioMod.ini "a"
FileSeek $R0 0 END
FileWrite $R0 "$\r$\n"

FindFirst $9 $8 $INSTDIR\*.*
Goto Find

PathGood:
FileWrite $R0 "[Field "
FileWrite $R0 $R8
FileWrite $R0 "]$\r$\nType=radiobutton$\r$\nText="
FileWrite $R0 $8
FileWrite $R0 "$\r$\nLeft=0$\r$\nRight=125$\r$\nTop="
FileWrite $R0 $R9
IntOp $R9 $R9 + 15
FileWrite $R0 "$\r$\nBottom="
FileWrite $R0 $R9
FileWrite $R0 "$\r$\nState=0$\r$\n"
IntOp $R8 $R8 + 1
IntOp $R9 $R9 + 40

Find:
FindNext $9 $8
IfErrors End
IfFileExists $INSTDIR\$8\liblist.gam PathGood Find


End:
FindClose $9
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioMod.ini" # File is places in $PLUGINSDIR
FunctionEnd


now, this code will only use what was originally in the ioMod.ini.
I looked at the contents of the temporary file ioMod.ini while i was on the custom page, and the contents is what i generated. However, the custom page disaplays the contents of the file that was packaged with the executable, even though I tried to extract before time....
I looked thru the source of InstallOptions fairly quickly, but I did not see iy copy the file over again anywhere... do you know where in which of the two funcs it performs the copy, so I can override it and use a custom io.dll?

Why don't you use WriteIniStr? It's so much simpler then opening the file manually and writing to it...

My best guess why this doesn't work is that you have forgot to update NumFields in [Settings].