Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th April 2006, 18:43   #1
pjn123
Major Dude
 
pjn123's Avatar
 
Join Date: Jan 2006
Location: /\/¯¯¯¯¯\/\ , South-Africa
Posts: 1,026
Adding one parameter to installer

I'm having problems reading parameters in nsis.

I only need a number in the parameter. The number will then replace this number in my curent code. Hope this isn't do difficult to do .

Thanks in advance.


CURRENT CODE
...
SendMessage $0 ${WM_COMMAND} 40012 0
...
The number in bold will then be replaced with the parameter.
EX:
C:\myInstaller.exe 40012
will then do the same as my current code.

I've included my source code.
Attached Files
File Type: zip sendmessage.zip (603 Bytes, 54 views)

ClassicPro© v2.01 : This plugin allows you to use cPro skins in Winamp. ClassicPro skins are all SUI skins and loads very quickly. ClassicPro skins is even easier to skin than Winamp Classic skins. A new layout have been added since version 2.
Download ClassicPro© ==== cPro Skins ==== ClassicPro© Homepage ==== SC Forums
pjn123 is offline   Reply With Quote
Old 17th April 2006, 20:20   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Use GetParameters which you can find in the NSIS documentation under Useful Scripts.

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 18th April 2006, 13:29   #3
pjn123
Major Dude
 
pjn123's Avatar
 
Join Date: Jan 2006
Location: /\/¯¯¯¯¯\/\ , South-Africa
Posts: 1,026
Thanks for the help so far but I still need help getting it working. Here is the source:

!include WinMessages.nsh

Name "Alarm"
Caption "Alarm Notice"
OutFile "zzzz.exe"
Icon "..\Contrib\Graphics\Icons\llama-grey.ico"

silent by default.
; SilentInstall silent

Function CloseProgram
Exch $1
Push $0
FindWindow $0 $1
SendMessage $0 ${WM_COMMAND} 40012 0
Pop $0
Pop $1
FunctionEnd

Function .onInit
Push "Winamp v1.x"
Call CloseProgram
SetSilent silent
FunctionEnd

Function GetParameters
Push $R0
Push $R1
Push $R2
Push $R3

StrCpy $R2 1
StrLen $R3 $CMDLINE

;Check for quote or space
StrCpy $R0 $CMDLINE $R2
StrCmp $R0 '"' 0 +3
StrCpy $R1 '"'
Goto loop
StrCpy $R1 " "

loop:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 $R1 get
StrCmp $R2 $R3 get
Goto loop

get:
IntOp $R2 $R2 + 1
StrCpy $R0 $CMDLINE 1 $R2
StrCmp $R0 " " get
StrCpy $R0 $CMDLINE "" $R2

Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

Section
SectionEnd

..:: How do I get the int in the parameter to the 40012.

I will run the setup like this:

"C:\zzzz.exe 40012"

If the code look funny its because I don't know much about nsis. Can you maybe correct the above code?
Hope you can help me a a

ClassicPro© v2.01 : This plugin allows you to use cPro skins in Winamp. ClassicPro skins are all SUI skins and loads very quickly. ClassicPro skins is even easier to skin than Winamp Classic skins. A new layout have been added since version 2.
Download ClassicPro© ==== cPro Skins ==== ClassicPro© Homepage ==== SC Forums
pjn123 is offline   Reply With Quote
Old 18th April 2006, 17:34   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
code:
Function CloseProgram
Exch $0
Exch
Exch $1
Push $2
FindWindow $2 $1
SendMessage $2 ${WM_COMMAND} $0 0
Pop $2
Pop $1
Pop $0
FunctionEnd

Function .onInit
Call GetParameters
Pop $0
IntOp $0 $0 * 1 # make sure int value
Push "Winamp v1.x"
Push $0
Call CloseProgram
SetSilent silent
FunctionEnd



-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 18th April 2006, 19:01   #5
pjn123
Major Dude
 
pjn123's Avatar
 
Join Date: Jan 2006
Location: /\/¯¯¯¯¯\/\ , South-Africa
Posts: 1,026
Thanks!!!!!!
I still can believe it's working! Finaly!

Thanks again, Afrow UK

ClassicPro© v2.01 : This plugin allows you to use cPro skins in Winamp. ClassicPro skins are all SUI skins and loads very quickly. ClassicPro skins is even easier to skin than Winamp Classic skins. A new layout have been added since version 2.
Download ClassicPro© ==== cPro Skins ==== ClassicPro© Homepage ==== SC Forums
pjn123 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump