Skip to content
⌘ NSIS Forum Archive

GetParameters

6 posts

Cerveza#

GetParameters

Section
${GetParameters} $R0
; $R0="[parameters]"
SectionEnd

and i get this error:

invalid command ${GetParameters}
Cerveza#
now i want to use this exampel in myscript

Function .onInit
Call GetParameters
Pop $2
# search for quoted /USERNAME
StrCpy $1 '"'
Push $2
Push '"/USERNAME='
Call StrStr
Pop $0
StrCpy $0 $0 "" 1 # skip quote
StrCmp $0 "" "" next
# search for non quoted /USERNAME
StrCpy $1 ' '
Push $2
Push '/USERNAME='
Call StrStr
Pop $0
next:
StrCmp $0 "" done
# copy the value after /USERNAME=
StrCpy $0 $0 "" 10
# search for the next parameter
Push $0
Push $1
Call StrStr
Pop $1
StrCmp $1 "" done
StrLen $1 $1
StrCpy $0 $0 -$1
done:
FunctionEnd

but it doesn't works because it doesn`t know the function StrStr. where can i find this function?
Cerveza#
so now i have a few parameters added in my script...now i need some thing like this

if the variable $x is empty
then
StrCpy $x "something"
Afrow UK#
!include FileFunc.nsh
!insertmacro GetParameters
!insertmacro GetOptions

...

${GetParameters} $R0
${GetOptions} $R0 /username= $R1
StrCmp $R1 `` 0 +2
StrCpy $R1 `Jim`

$R1 is the value.

Stu