Archive: Custom scripted installer.


HELP!!! w/Custom scripted installer.
Hi guys, I promised the community that I am a part of that I would release a mod I created Thanks Giving day for the game TRIBES.

I successfully created a installer, now the only problem is that I need it to install :\

I originally worked out of gfx.nsi, I got everything to work, and the installer itself looks excellent. I couldn't find any code in the NSI that attaches files to it so I browsed around in zip2exe. I noticed at the top it says the contrib crap, so I went ahead and went to my Programs files/NSIS/Contrib/ bla bla... I then opened up the base, then I attempted to replace the base code with the one gfx gave me.. No luck... Syntax syntax syntax.. Now this is weird knowing the installer works in the scripter but not the zip2exe... I am basically trying to add the zip to my custom gfx.nsi, if anyone could help I would deeply appreciate it..

Josh-

Here is the un-syntaxed GFX.nsi code.


;--------------------------------

!macro BIMAGE IMAGE PARMS
Push $0
GetTempFileName $0
File /oname=$0 "${IMAGE}"
SetBrandingImage ${PARMS} $0
Delete $0
Pop $0
!macroend

;--------------------------------

Name "WTF Mod v0.2"

OutFile "Gfx.exe"

; Adds an XP manifest to the installer
XPStyle on

; Add branding image to the installer (an image placeholder on the side).
; It is not enough to just add the placeholder, we must set the image too...
; We will later set the image in every pre-page function.
; We can also set just one persistent image in .onGUIInit
AddBrandingImage left 100

; Sets the font of the installer
SetFont "Comic Sans MS" 8

; Just to make it three pages...
SubCaption 0 ": !?WTF?! Mod installer - Clanmx.com"
SubCaption 2 ": !?WTF?! Mod installer Page - Clanmx.com"
LicenseText "WTF Mod License page"
LicenseData "License.nsi"
DirText "--!?WTF?! Mod-- (example: C:\Dynamix\Tribes\)"

; Install dir
InstallDir "C:\Dynamix\Tribes\"

;--------------------------------

; Pages
Page license licenseImage
Page custom customPage
Page directory dirImage
Page instfiles instImage

;--------------------------------

Section ""
; You can also use the BI_NEXT macro here...
MessageBox MB_YESNO "You are about ready to install !?WTF?! Mod v0.2. Please NOTE: I am not responsible \
for any problems this installer/mod may cause to your computer. As far as I know, it's safe. Help + \
information at Clanmx.com & clanmx.info." IDNO done
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" ""
done:
WriteUninstaller uninst.exe
SectionEnd

;--------------------------------

Function licenseImage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
MessageBox MB_YESNO 'Would you like to skip the license page?' IDNO no
Abort
no:
FunctionEnd

Function customPage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
MessageBox MB_OK 'After clicking "Ok" Please select a propper TRIBES directory to install !?WTF?! \
Mod to. Make sure you back up your Tribes folder!'
#insert install options/start menu/<insert plugin name here> here
FunctionEnd

Function dirImage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
FunctionEnd

Function instImage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
FunctionEnd

;--------------------------------

; Uninstall pages

UninstPage uninstConfirm un.uninstImage
UninstPage custom un.customPage
UninstPage instfiles un.instImage

Function un.uninstImage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
FunctionEnd

Function un.customPage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
MessageBox MB_OK 'You have chosen to delete !?WTF?! mod from the directory you selected'
#insert install options/start menu/<insert plugin name here> here
FunctionEnd

Function un.instImage
!insertmacro BIMAGE "C:\Documents and Settings\HaCKeR\Desktop\Installer stuff\WTFmod2.bmp" /RESIZETOFIT
FunctionEnd

;--------------------------------

; Uninstaller

; Another page for uninstaller
UninstallText "--!?WTF?! Mod Uninstaller--"

Section uninstall
MessageBox MB_OK "Are you sure you want to completley delete !?WTF?! mod?"
SectionEnd

You don't need zip2exe. It's only used for converting ZIP files to installers with two clicks and no customizations. What you are looking for is the File command. Start with the simpler examples - example1.nsi.


Mmk, I might convert some code over from example1.nsi to gfx, but I am definetly not starting over.


Ahh! thank you so much!

;--------------------------------

; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File Filenamehere.w/e

SectionEnd ; end the section


mmm..
How do we write a shortcut to installer?


Originally posted by Dark-energy
mmm..
How do we write a shortcut to installer?
Try this hmne.sourceforge.net

And for desktop shortcut

Section "-Make Shortcut" SEC0XX
SetOutPath $INSTDIR
CreateShortCut "$DESKTOP\Name_of_your
_shortcut.lnk" "$INSTDIR\Game.exe" "$INSTDIR\shortcut_icon.ico"
SectionEnd

shortcut icon is optional if u like to have different icon than main game icon

Mmm, but I already have the shortcut, I just need to write it :\


Use CreateShortCut please.


Oh, I get it.

Another thing, last thing and I will stop bugging you guys..

How do you change Installer icon?


The Icon command would do that.


Err great, uninstaller doesn't work..


Hmm, what is change shortcut icon code?


Nvm got it all working


Hmm, What if I wanted a file to open after it's done installing?


You could use the .onInstSuccess function, or add a leave function for the finish page...

Stu


Err that didn't exactally help at all but I did get it to work anyways.

;AIFO
Section "" ;No components page, name is not important

ExecShell "open" "$INSTDIR\Config\WTF.cs"

SectionEnd ; end the section