Archive: Finding NSIS really hard to use - Please Help Me


Finding NSIS really hard to use - Please Help Me
Hello,
I am finding NSIS really hard to use. I have trying to make an install program with runs as follows. It would need to run silently and if there were any errors then it would close.





Set $mainversion to 1.11


If the system directory is c:\windows\system\ set as $installdir (including last \) and set $installdirnum as 1
If the system directory is c:\win95\system\ set as $installdir (including last \) and set $installdirnum as 2
If the system directory is c:\winnt\system\ set as $installdir (including last \) and set $installdirnum as 3
If the system directory is none of the above then exit

If the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\mainversion is > $mainversion Then exit
If there is no such directory or HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\mainversion is less than $mainversion then just continue

Copy files3.exe to $installdir if the file is newer
Copy files4.exe to $installdir if the file is newer
Copy files5.exe to $installdir if the file is newer

If the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\currentstate is “zero” Then run code section 1
If the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\currentstate is “one” Then run code section 2
If there is no such registry key as: HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\currentstate Then run code section 2


--------------- Code Section 1 ---------------

Copy file1.exe to $installdir as file1_1.exe and overwrite if there is a file with the same name
Copy file2.exe to $installdir as file2_1.exe and overwrite if there is a file with the same name
Set HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\currentstate to “one”
Set $currentstate to “one”

------------ End Code Section 1 ------------


--------------- Code Section 2 ---------------

Copy file1.exe to $installdir and overwrite if there is a file with the same name
Copy file2.exe to $installdir and overwrite if there is a file with the same name
Set HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\currentstate to “zero”
Set $currentstate to “zero”

------------ End Code Section 2 ------------


If $installdirnum = 1 AND $currentstate = “zero” Then copy 1.ini
If $installdirnum = 2 AND $currentstate = “zero” Then copy 2.ini
If $installdirnum = 3 AND $currentstate = “zero” Then copy 3.ini
If $installdirnum = 1 AND $currentstate = “one” Then copy 4.ini
If $installdirnum = 2 AND $currentstate = “one” Then copy 5.ini
If $installdirnum = 3 AND $currentstate = “one” Then copy 6.ini

Set HKEY_LOCAL_MACHINE\SOFTWARE\mmsoft\mainversion as $mainversion

If $installdirnum = 1 AND $currentstate = “zero” Then run c:\windows\system\file1.exe
If $installdirnum = 2 AND $currentstate = “zero” Then run c:\win95\system\file1.exe
If $installdirnum = 3 AND $currentstate = “zero” Then run c:\winnt\system\file1.exe
If $installdirnum = 1 AND $currentstate = “one” Then run c:\windows\system\file1_1.exe
If $installdirnum = 2 AND $currentstate = “one” Then run c:\win95\system\file1_1.exe
If $installdirnum = 3 AND $currentstate = “one” Then run c:\winnt\system\file1_1.exe





Any help would be great.
Thanks
Benoni
:)


Read the documentation and go through the sample scripts. That should get you started.

-Scott


If you still don't understand something after you read the documents and look over the examples don't be afraid to come again and ask as much as you want.

Things to look for in the documents:
ReadRegStr
WriteRegStr
$WINDIR
$SYSDIR
File
StrCmp
StrCpy
Exec
ExecWait
ShellExec


reply
Thanks
Will do