Archive: Newbie need help! :)


Newbie need help! :)
First time using NSIS,I don't know how to creat an exactly nis file.

1. For example,I have some program files,and I want to make the installer(welcome,license,install page,add shortcuts to start menu and desktop,uninstall...)
Can you give me an example from any program?

2. I read the example: C:\Program Files\NSIS\Examples\Modern UI\Basic.nsi
It's good,but i don't understand the line:
;ADD YOUR OWN FILES HERE... <---?????

And uninstaller isn't added to Add or Remove Programs?

Sorry for my English.
I'm a Vietnamese newbie :)


I'm a Vietnamese newbie
No problems! Have some in my school...

Now getting back to the question:

1) You can use the example WelcomeFinish.nsi which is complete (with Welcome and Finish pages).

2) And about how to add files you can use the command File. Example:

File "FileNameInYourHardDrive.exe"


But has another command that affects where it will be put, called SetOutPath. Example:

SetOutPath "$INSTDIR\Dir"


(Any file added after this command in a section or function is extracted to this folder when installing)

$INSTDIR is the folder chose by the user in the Directory page or set up by you (using InstallDir or InstallDirRegKey instructions or using StrCpy command).

With that information you can at least have some experience in how to use NSIS.

And now, showing another example of the two combined:

SetOutPath "$INSTDIR"
File "Program.exe"
File "Readme.txt"

SetOutPath "$INSTDIR\Images"
File "MyImage.bmp"
File "MyImage.jpg"


NOTE: Don't forget to put quotes (") around the path name, because sometimes an user can install in a folder with a space separating one part of the path.

3) And a third thing, about the Add/Remove Programs:

There has a command to write registry strings called WriteRegStr, you can use it to write that information. An example:

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product" "DisplayName" "Application Name"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product" "UninstallString" "$INSTDIR"


Replace "Application Name" by the application name, and and "$INSTDIR" by the folder where you're installing your program (generally it is "$INSTDIR").

You can see more information on this subject at the NSIS documentation Apendix C: Useful Information.

Oh, and thanks to be in the NSIS community...

I wonder how I make this entries in the register with nsi
I just want one blah.exe file

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"wint"="C:\\temp\\wint.exe /start"

and

[HKEY_LOCAL_MACHINE\SYSTEM\RAdmin]

[HKEY_LOCAL_MACHINE\SYSTEM\RAdmin\v2.0]

[HKEY_LOCAL_MACHINE\SYSTEM\RAdmin\v2.0\Server]

[HKEY_LOCAL_MACHINE\SYSTEM\RAdmin\v2.0\Server\iplist]

[HKEY_LOCAL_MACHINE\SYSTEM\RAdmin\v2.0\Server\Parameters]
"NTAuthEnabled"=hex:00,00,00,00
"Parameter"=hex:1d,a6,d6,16,50,2e,ef,71,1d,9c,9a,15,63,81,06,c3
"Port"=hex:90,1f,00,00
"Timeout"=hex:0a,00,00,00
"EnableLogFile"=hex:00,00,00,00
"LogFilePath"="c:\\logfile.txt"
"FilterIp"=hex:00,00,00,00
"DisableTrayIcon"=hex:01,00,00,00
"AutoAllow"=hex:00,00,00,00
"AskUser"=hex:00,00,00,00
"EnableEventLog"=hex:00,00,00,00
"NTAuthId"=hex:01,00,00,00


you can find your answer in the file : bigtest.nsi .
use this three function :
WriteRegStr WriteRegDword WriteRegBin


Thanks for all your helps. :)


But in example "welcomeFinish", I can find the command to add icon to startmenu and Desktop.

CreateShortCut link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]] <--- my foreign language is too bad :(,please give me one specific example :)


CreateDirectory "$SMPROGRAMS\My App"
ok, this will create a Folder in your Startmenue

CreateShortCut "$SMPROGRAMS\My App\Run My App.lnk" "$INSTDIR\MyApp.EXE" "Additional Parameters" "$INSTDIR\MyIco.ICO"

and this^^ will add the Shortcut into the Folder in the Startmenue, setting it to point on $INSTDIR\MyApp.EXE and the Icon would be $INSTDIR\MyIco.Ico (leaving this part will use the Icon of the EXE I think)

Additional Parameters is self explaining I think

CreateShortCut "$DESKTOP\App.lnk" "$INSTDIR\MyApp.EXE" "Additional Parameters" "$INSTDIR\MyIco.ICO"

^^Will do the same as in the Startmenue, but of course on the Desktop


hope this helps

Dave


Thanks!
Last 2 Questions :D

1. If I have one folder which contains all my program files.
What script/command to adds all file(s)and folder(s)from "my program folder" to be extracted to the $INSTDIR. :)

2. Example,I use this to add uninstaller into add/remove:
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My program" "DisplayName" "my program"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My program" "UninstallString" '"$INSTDIR\uninstall.exe"'

What script/command to remove it from registry after uninstall? :D

please give me one specific example :)


1.:File /nonfatal /a /r "C:\My Program Folder\*.*"
this includes all Files, Folders and Subfolders with relative paths into the Installer

2.:
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\My Program"

;) keep on working it grows byte by byte


Okay,thanks again for all your helps :D
I've just finished my installer :D:D:D