Archive: Installer script


21st September 2002 18:08 UTC

Installer script
I've just finished my new installer script, I thought that maybe some of you people here might prefer this method of installing to Winamp 2 or 3 (but still not both unfortunately) to the one using those messy message boxes. This one uses the 'Install Options' menu to choose between Winamp 2 and 3 like my old script but it also autodetects the install directory.

I've used my last minipack for the example script here. Please tell me if you find any bugs!

Name "Jheriko - Purely Platonic"
Icon "platonic.ico"
OutFile "J Platonic.exe"

EnabledBitmap d:\NSIS\Contrib\two-check.bmp
DisabledBitmap d:\NSIS\Contrib\two-nocheck.bmp

Function .onInit
StrCpy $9 0
FunctionEnd

Function .onNextPage

IntOp $9 $9 + 1

IntCmp $9 2 nothing

Goto jump

nothing:

SectionGetFlags 1 $1

IntCmpU $1 2147483648 getwa2path getwa3path getwa2path

getwa2path:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString"
StrCpy $INSTDIR $INSTDIR "" 1
Goto skippy

getwa3path:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"

skippy:

StrCpy $1 $INSTDIR
loopy:
StrCpy $2 $INSTDIR 1 $1
StrCmp $2 "" lpdone
StrCmp $2 "\" lpdone
IntOp $1 $1 - 1
Goto loopy
lpdone:
StrCpy $INSTDIR $INSTDIR $1

jump:

FunctionEnd

Function .onPrevPage

IntOp $9 $9 - 1

FunctionEnd

DirText "Please enter your full Winamp path below."

ComponentText "Please choose the version of Winamp that you wish to install to:"

InstType "Winamp 2"
InstType "Winamp 3"
InstType /NOCUSTOM

AutoCloseWindow false
ShowInstDetails show

Section "-"
SectionIn 1 2
SectionEnd

Section "PP Minipack for Winamp 2"
SectionIn 1
SetOutPath "$INSTDIR\Plugins\AVS"

File "D:\winamp3\wacs\data\avs\multiplier.ape"

SetOutPath "$INSTDIR\Plugins\AVS\JHERiKO - Purely Platonic Minipack"

File "D:\winamp3\wacs\data\avs\Jheriko - Purely Platonic Minipack\*.avs"
SectionEnd

Section "PP Minipack for Winamp 3"
SectionIn 2
SetOutPath "$INSTDIR\wacs\data\AVS\"

File "D:\winamp3\wacs\data\avs\multiplier.ape"

SetOutPath "$INSTDIR\wacs\data\AVS\JHERiKO - Purely Platonic Minipack"

File "D:\winamp3\wacs\data\avs\Jheriko - Purely Platonic Minipack\*.avs"
SectionEnd


21st September 2002 18:39 UTC

it is schweet

gj, and thx for all ur help again!


22nd September 2002 06:21 UTC

Thanks for the thanks, I like helping people, makes me feel all big and clever. :)


22nd September 2002 06:35 UTC

Oh but you are, anyone who can calculate phi without iterating is obviously of a higher species. (Non-sarcasm)


22nd September 2002 07:11 UTC

I love maths.
Okay, I'll explain how the value I use as phi is calculated in a finite manner.

Phi is the ratio of the sides of a rectangle which, when cut into a square and a remainder, gives a remainder rectangle with sides of ratio phi. So, by using areas, we can see that:

1 + 1/phi = phi

or, more nicely,

1/phi = phi -1

My calculation of phi is pretty standard, all that I did was solve the definiton of phi that I explained above by rearranging it a little:

1/phi = phi - 1

1 = phi^2 - phi

phi^2 - phi - 1 = 0

Using the quadratic formula and taking the postive solution (the negative one is -1/phi). There are iterative formulae which limit towards phi but, originally, phi was defined in Euclid's Elements geometrically using the ancient greek mathematics which was limited to whole numbers, fractions and the solutions to quadratic equations.

I think Euclid also used phi to determine the vertices of the dodecahedron and icosahedron but I'm not sure because I haven't read all of 'The Elements' (his definitions of those shapes are right near the end) but I would think it is likely that he used the same method as I did since it is geometric rather than algebraic.

The maths I've been using in my latest AVS presets is thousands of years old. :)


23rd September 2002 17:10 UTC

Hmmm phi might be another magical math number, but unlike e or pi it's quite easy to calculate (it's not a trancendental number) :).

Though you could say that Jheriko's method is iterative, because the traditional method of calculating square roots is an iterative algorithm that approximates the square root with a rational number of increasing precision.

I learnt Jheriko's method in school too, don't see why you'd consider it to be so special.


23rd September 2002 18:40 UTC

Well, I just never saw phi as being able to be calculated using a straight formula.

How do you get the pi in 'loge (-1) = i*pi'? Here's what I've tried.

logi (-1) = 2

logi (-1) = loge (-1) / loge (i)
loge (-1) = logi (-1) / logi (e)

loge (-1) = 2 / logi (e)
loge (-1) = loge (-1) / (loge (i) * logi (e))
loge (-1) = loge (-1) / (loge (i) * logi (e))

loge (-1) + loge (-1) = loge (i)

Any suggestions?


23rd September 2002 19:26 UTC

presumably you mean loge as in natural logarithm? so you mean e^ipi=-1.

Well the easiest way to solve this one is to use the identity

e^itheta = cos (theta) + isin(theta)

which you can prove by expanding the series for e^x and cos(x)+isin(x)
(deriving these series is another matter entirely, you can use maclaurin expansions to get the sin(x) and cos(x) series and some calculus to define e as the sum of powers/factorials, remembering that x^0=1 and 0!=1)

e^x = 1+x+x^2/2!+x^3/3!+x^4/4!...
cos(x)= 1-x^2/2!+x^4/4!-x^6/6!+x^8/8!...
sin(x) = x-x^3/3!+x^5/5!-x^7/7!...

if you add if you do e^ix you get

e^ix=1+ix+(ix)^2/2!+(ix)^3/3!...
using i^2=-1, i^3=-i, i^4=1, i^5=i, i^6=-1 ...
=1+ix-x^2/2!-ix^3/3!+x^4/4!+ix^5/5...
=(1+x^2/2!-x^4/4!...)+(ix-ix^3/3+ix^5/5...)
=cos(x)+isin(x)

so since cos(pi)=-1 and sin(pi)=0

e^ipi = -1

hopefully i made that understandable :D


24th September 2002 06:42 UTC

That's kinda freaky though, that the 2 most irrational numbers and a number that can only be referred to, come together to form negative unity.


24th September 2002 09:53 UTC

You know that the sum of two positive infinities can be negative whole numbers as well.

Integrate 1/(x^2) between 1 and -1

= 1/-1 - 1/1 = -2

Integrate between -1 and 0 or 0 and -1 and you get two values that tend to positive infinity.


10 points to someone who can explain why and 100 points to anyone who can prove that my first statement is wrong.

<ooooh, i have made 2^8 posts>


24th September 2002 12:21 UTC

STOP, YOU'RE KILLING ME!!! :p


24th September 2002 12:23 UTC

I think I will stop, all of this maths is taking away from the mega-coolness of my installer script. Which is what this thread was originally all about.

:cool:


1st October 2002 04:03 UTC

Yeah, i sure did like your script

(
although, how many people don't have WA2 and WA3 on their systems?

Winamp never did (and i dont believe they should) make an effort to erase or write over WA2
)

(i know people disagree w/ me, but i sure do like WA3 a helluva lot better than WA2)


2nd October 2002 20:11 UTC

Can I use your script for mah pack, jheriko?

<noob> How do you make icons? </noob>


2nd October 2002 22:11 UTC

well, atero, i was having that same problem

try
ArtIcons


and i "found" my serial for that program

its the best, (make sure the icon is the right dimension, NSIS wants exact shiznet) (its 32x32x16 i beleive


2nd October 2002 22:16 UTC

Anyone can use my script, thats why I posted it here. :)

EDIT: Atero try Icon Edit Pro, Tuggummi recommended it to me, you can get it from http://www.iconedit.com its a shareware version but is fully functional and really useful. You won't need to 'find' any serial numbers. ;)


3rd October 2002 00:50 UTC

Originally posted by Karnov
make sure the icon is the right dimension, NSIS wants exact shiznet (its 32x32x16 i beleive
that applies for the old NSIS 1.x only, NSIS 2.x supports all sizes and colors!

3rd October 2002 13:05 UTC

Im gonna wait for nsis 2 to be finished before I start using it, although I have to admit that those develpoment versions are really snazzy.


3rd October 2002 15:46 UTC

NSIS 2 Script
I made an NSIS 2 version of the script so that if you want to use the highcolor icons you can. The changes are negligable and mainly revolve around the directory detection bit since the SectionGetFlags function has changed to a more user friendly version. I haven't implemented any of the new UI features but I'm sure that you would probably want to add them yourself. I'll probably make a new script when NSIS 2 is finished with lots of nice things like uninstallers and subsections and a splash screen and stuff.

You can add the icon tag where it was before.




Name "Jheriko - 6point5 Minipack"
OutFile "6point5.exe"

Function .onInit
StrCpy $9 0
FunctionEnd

Function .onNextPage

IntOp $9 $9 + 1

IntCmp $9 2 nothing

Goto jump

nothing:

SectionGetFlags 1 $1

IntCmp $1 1 getwa3path getwa2path getwa3path

getwa2path:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString"
StrCpy $INSTDIR $INSTDIR "" 1
Goto skippy

getwa3path:
ReadRegStr $INSTDIR HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"

skippy:

StrCpy $1 $INSTDIR
loopy:
StrCpy $2 $INSTDIR 1 $1
StrCmp $2 "" lpdone
StrCmp $2 "\" lpdone
IntOp $1 $1 - 1
Goto loopy
lpdone:
StrCpy $INSTDIR $INSTDIR $1

jump:

FunctionEnd

Function .onPrevPage

IntOp $9 $9 - 1

FunctionEnd

DirText "Please enter your full Winamp path below."

ComponentText "Please choose the version of Winamp that you wish to install to:"

InstType "Winamp 2"
InstType "Winamp 3"
InstType /NOCUSTOM

AutoCloseWindow false
ShowInstDetails show

Section "-"
SectionIn 1 2
SectionEnd

Section "6point5 for Winamp 2.x"
SectionIn 1
SetOutPath "$INSTDIR\Plugins\AVS"

File "D:\winamp3\wacs\data\avs\multiplier.ape"
File "D:\winamp3\wacs\data\avs\convolution.ape"
File "D:\winamp3\wacs\data\avs\channelshift.ape"

SetOutPath "$INSTDIR\Plugins\AVS\JHERiKO - 6point5"

File "D:\winamp3\wacs\data\avs\New Minipack\*.avs"
SectionEnd

Section "6point5 for Winamp 3.x"
SectionIn 2
SetOutPath "$INSTDIR\wacs\data\AVS\"

File "D:\winamp3\wacs\data\avs\multiplier.ape"
File "D:\winamp3\wacs\data\avs\convolution.ape"
File "D:\winamp3\wacs\data\avs\channelshift.ape"

SetOutPath "$INSTDIR\wacs\data\AVS\JHERiKO - 6point5"

File "D:\winamp3\wacs\data\avs\New Minipack\*.avs"
SectionEnd


20th November 2002 22:14 UTC

??
<supernoob>how do U use the scripts?</supernoob>


20th November 2002 23:11 UTC

Thanks J. I'll be using this for NDD3 and beyond.


21st November 2002 03:56 UTC

I'm no expert, but I believe you just change this line

File"D:\winamp3\wacs\data\avs\NewMinipack\*.avs"

to the path of your pack and it's good.

21st November 2002 14:31 UTC

stoopidgenius: you need NSIS


21st November 2002 22:41 UTC

NSIS
I have NSIS, but either it
1. installed bad, or
2. I'm a political dumbass.


23rd November 2002 11:21 UTC

Try getting NSIS2


23rd November 2002 12:55 UTC

Jheriko: just a little question... in the script you used for your previous packs, installing for WA2 or WA3 was like choosing between different sections. However, you could only select one winamp and this had to be done through the drop-down selector at the top (install-type): you couldn't click the options themselves.
Have you fixed this yet? It really bugs me and I thought your installer was broken at first because of this.


23rd November 2002 13:46 UTC

If you take a look at the J7 installer you will (hopefully) see that you can select multiple options for both winamps and also use the checkboxes to choose which version you want. The drop-down combo box is still there for convenience.

I've also attached the script so that you can take a look at it and see how it works.

(Requires latest cvs version of NSIS2)


2nd May 2003 15:44 UTC

By the way, here's something that belongs here....

If you want your presets to appear in numerical order, then you have to include each separately in your script.

For example, if your presets are named "Joe - 01 - Name.avs":

File "c:\winamp3\wacs\data\avs\Joe's pack\Joe - 01*"
File "c:\winamp3\wacs\data\avs\Joe's pack\Joe - 02*"
File "c:\winamp3\wacs\data\avs\Joe's pack\Joe - 03*"
File "c:\winamp3\wacs\data\avs\Joe's pack\Joe - 04*"
etc.

Always worked for me, and it gives a more professional touch ;).


2nd May 2003 16:13 UTC

Originally posted by UnConeD
If you want your presets to appear in numerical order, then you have to include each separately in your script.
this is no longer necessary since avs 2.6.0 (or is it the nsis betas that now sort files?)

2nd May 2003 18:36 UTC

I believe it's the NFTS filesystem. Older versions of avs are also sorted on my computer (win xp with ntfs as filesystem).
My 98SE computer doesn't have sorting, even with NSIS beta installers. I haven't tried a winamp2 version with avs 2.6.0 on that computer though.


2nd May 2003 19:25 UTC

i've been using ntfs as long as i can think.. and in the past the files weren't sorted


2nd May 2003 20:27 UTC

Originally posted by UnConeD
Hmmm phi might be another magical math number
Ever watched PI - the movie? ;)

Btw, thanks jheriko, this will come in handy for the hotlist 2.2 installer (saves me the "figuring out" time, grab and adjust is a lot faster :D)

2nd May 2003 20:56 UTC

MagicX: yes I saw the movie, really cool and awesome soundtrack...
I revived this thread for installer info though, let's keep it on topic :) (we were talking about phi btw, not pi).


4th May 2003 04:52 UTC

yathosho: yes, but what about us smart people that have gone back to 2.5? that's sort of like saying you don't need to code your installers for winamp 2.x support :rolleyes:


4th May 2003 05:12 UTC

Originally posted by Atero
yathosho: yes, but what about us smart people that have gone back to 2.5? that's sort of like saying you don't need to code your installers for winamp 2.x support :rolleyes:
2.5? :confused:

4th May 2003 11:03 UTC

so you think you're smart ;)


4th May 2003 20:13 UTC

great script jheriko. Keep`em coming :)