- NSIS Discussion
- Make menu choose many set up
Archive: Make menu choose many set up
sunlight112
11th October 2006 03:16 UTC
Make menu choose many set up
How can I make a menu before I set up many program.
Eg: I want to set up jdk, my sql and my program. I want to request user to set up following these steps:
+ JDK
+ My Sql
+ My product
When software run, I must request user to set up JDK
first. After that, I will install my sql and so on...
Thank a lot,
CancerFace
11th October 2006 22:46 UTC
Hi,
From your description I would think that jdk and MySQL are prerequisites to run your program, so there is no reason to have a menu and ask the user to install those, just use some code in your .onInit function to check if jdk and MySQL are installed and then install your program. You can read some registry key/value or search for a specific file in each case (you can use some registry tool, like regshot, to see what keys/values are generated by jdk and MySQL).
For example:
Function .onInit
...
ClearErrors
ReadRegStr $R0 HKLM "Software\jdk" "Version"
IfErrors +1 +4
SetOutPath $PLUGINSDIR
File "JDK_Installer.exe"
nsExec::ExecToLog '"$PLUGINSDIR\JDK_Installer.exe" /s'
ClearErrors
ReadRegStr $R0 HKLM "Software\MySql" "Version"
IfErrors +1 +4
SetOutPath $PLUGINSDIR
File "MySQL_Installer.exe"
nsExec::ExecToLog '"$PLUGINSDIR\MySQL_Installer.exe" /s'
...
FunctionEnd
That is assuming that you want to include jdk and MySQL with your distribution, in the same package. The filenames and switches used in the above example are random by the way.
Hope this helps
CF
sunlight112
13th October 2006 09:42 UTC
I do it the same way you said, but I still do not work.
My Code here:
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
ReadRegStr $R0 HKLM "c:\programfiles\java\jdk" "1.5.0_08"
IfErrors +1 +4
SetOutPath $PLUGINSDIR
File "d:\software\jdk.exe"
nsExec::ExecToLog '"$PLUGINSDIR\jdk.exe" /s'
ReadRegStr $R0 HKLM "c:\Programfiles\my sql Software\MySql\MySqlServer" "5.0"
IfErrors +1 +4
SetOutPath $PLUGINSDIR
File "MySQL_Installer.exe"
nsExec::ExecToLog '"$PLUGINSDIR\MySQL_Installer.exe" /s'
FuncitonEnd
I only add your guide in onInist function and when I run it have some errors.
Can you tell me why????
Thank!
I am so sorry for my inconvenience because this is the first time I use NullSoft
Thank alot,
CancerFace
13th October 2006 11:21 UTC
I think you misread my post :(
This:
ReadRegStr $R0 HKLM "c:\programfiles\java\jdk" "1.5.0_08"
should look like this:
ReadRegStr $R0 HKLM "SOME_REGISTRY_KEY" "SOME_REGISTRY_VALUE"
You should be reading a value from the registry. I do not know what value as I don't have JDK or MySQL installed, that is why I suggested that you use a freeware tool like
regshot to get a snapshot of the registry before installing each one of those and after, so that you can see what registry entries are generated. Then adjust your code so that it reads the appropriate registry entries.
Also this may be wrong:
nsExec::ExecToLog '"$PLUGINSDIR\jdk.exe" /s'
I do not know what the name of your JDK install package is nor do I not know what the silent switch for that is. That was an example as I stated.
The same goes for the MySQL entries (both registry and switches).
CF
sunlight112
17th October 2006 05:26 UTC
Thank you for your reply,
Your opinion is very good, your help is one of the process which I must do but I still want to create a menu to help user understand the process set up.
In my opinion,A menu is the same process to set up Visual Studio 2005 because my application need many software to support them. I want user to follow these steps to set up program because my install is very difficult.I must set up many program:
+ The first, I want to set up JDK (check JDK has already set up yet).
+ The second, I set up my sql 5.0 (check it again).
+ The thirst,I will use tool zip2exe to pack these software which it does not have file exe to became file set up and install it in computer(for two software need to set up in my program)
+ My product
So I need to create a menu for my program.If you have another opinion, can you help me!
Thanks,
CancerFace
17th October 2006 07:48 UTC
Use sections or section groups and force selection based on your criteria.
Use .onInit to see if one of your components is installed and disable/enable its section accordingly.
Check also this post.
CF
sunlight112
17th October 2006 08:16 UTC
Thank alot, :D
However, you can misread my opinion. I do not allow user to option these software which need to set up. I mean I will create a menu
+ JDK
+ My SQL
+ My product 1
+ My product 2
The first screen will appear below and run JDK first.
After setting up JDK, this screen will appear again and My SQL will be executed and so on.
I see your section which you help me, but this section,user can check these software and if they omit JDK or My SQL, they only want to install my product.It may appear problems here.
I will attach a file which screen the same VS 2005 which I want to create that.
CancerFace
17th October 2006 08:58 UTC
No, I did not misread your post ;)
Use sections or section groups and force selection based on your criteria.
CF
sunlight112
18th October 2006 11:45 UTC
Thank a lot, I understand what you mean.
I create a component page and display the process to install my application. Firstly, I will install JDK(include check JDK is installed or not)and Set up JDK is checked.After finishing setting up JDK, the first screen will appear again and set up MY sql is check and process will continue.
How can I make the first screen appear again with MY SQL is checked and set up it???
Can you help me!!!
Thank alot,
sunlight112
19th October 2006 11:38 UTC
If anyone is unsure of what I am talking about please tell me. I sounded good in my head, but might not have translated well.
Please help me!!!