Want to learn a bit of NSIS, so you can write your own installer -- or, even better -- your own portable app? I can't provide a full-fledged tutorial -- for that you'd have to hunt around the NSIS website -- but I can provide this useful template and a few basic NSIS commands you'll find useful. Enjoy!
Use this template and replace the bolded text, and you'll have a basic NSIS script (which doesn't do anything). Click here to see some basic commands.
NSIS Template.nsi (replace bolded text)
;Long Application Name ;Copyright (C) ;2006 Your Name ;This program is free software; you can redistribute it and/or ;modify it under the terms of the GNU General Public License ;as published by the Free Software Foundation; either version 2 ;of the License, or (at your option) any later version. ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the ;GNU General Public License for more details. ;You should have received a copy of the GNU General Public License ;along with this program; if not, write to the Free Software ;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA. ;---Definitions---- !define SNAME "ShortAppName" ;-----Runtime switches---- CRCCheck on AutoCloseWindow True SilentInstall silent WindowIcon off XPSTYLE on ;-----Set basic information----- Name "Long Application Name" Icon "${SNAME}.ico " Caption "Long Application Name" OutFile "${SNAME}.exe" ;-----Variables---- Var VariableName ;-----Version Information------ LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" VIProductVersion "Version number in format x.x.x.x" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Long Application Name" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Your Name 2006" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Application Description" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "Version number" Section "Main" Code goes here... End: SectionEnd
Here are a few commands and variables, just to get you started. Remember -- a huge list is available in the help system!
NOTE: $EXEDIR is the directory the app is in, and $OUTDIR is the directory any files are extracted to.
Put the value value into the variable $variable:
StrCpy $variable "value"
Use this to set $OUTDIR, if you want to extract files.
Run cool.exe in the directory the app is in, and follow the next command:
Exec "$EXEDIR\cool.exe"
Run cool.exe in the directory the app is in, and wait for that app to terminate, then follow the next command:
ExecWait "$EXEDIR\cool.exe"
Set $OUTDIR to C:\App and then extract toodles.exe
StrCpy $OUTDIR "C:\App" File $EXEDIR\Toodles.exe
This alone should be enough to get you started -- now go learn some more!
Comments
PRE / CODE
If people are going to post code this often then John really needs to enable the <pre> tag. <code> is not for multiple lines of code and shouldn't be styled in a block like it is on this site.
I did mention this before... hopefully John will see this.
Quite right
You're quite right, Thox. I missed it the last time you mentioned it.
I've enabled pre and set code back to display: inline. I edited nm35's NSIS post so it uses pre. If I see others using the old code display method, I'll fix em.