PDA

View Full Version : Concatenate colon


morkovnik
4th March 2012, 15:46
How can to concatenate variable with colon?

$1 = A
$2 = B

StrCpy $3 "$1:$2"

I want to result A:B, but out AB

MSG
4th March 2012, 16:55
You're mistaken. StrCpy $3 "$1:$2" is the correct command. If $1 is A and $2 is B, the output to $3 will be A:B .

morkovnik
4th March 2012, 18:47
I use NSIS 2.46 and that version crop the colon. The output is AB.

Anders
4th March 2012, 19:24
Some variables are special ($instdir etc) and will strip things that are not valid paths, $3 is normal and strcpy will not strip anything.

morkovnik
5th March 2012, 06:04
ok, so how can I add colon with the variable $INSTDIR

like this:
$1 = localhost
$2 = 123
$INSTDIR\proxy.exe --address=localhost:123

T.Slappy
5th March 2012, 06:16
That cannot be done!
Use nsExec, ExecWait or similar way to execute application with your desired parameters.

morkovnik
5th March 2012, 06:26
That cannot be done!
Use nsExec, ExecWait or similar way to execute application with your desired parameters.

I need to create shortcut to start application via CreateShortCut

MSG
5th March 2012, 07:38
I need to create shortcut to start application via CreateShortCut
The manual clearly states how you can supply parameters to your shortcut.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4

morkovnik
5th March 2012, 07:52
The manual clearly states how you can supply parameters to your shortcut.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4

I know about manual, but colon not added

${NSD_GetText} $SERVER_HOST $1
${NSD_GetText} $SERVER_PORT $2
StrCpy $3 "$1:$2"
${NSD_GetText} $PROFILER_PORT $4
StrCpy $4 "127.0.0.1:$4"

CreateShortCut \
"$SMPROGRAMS\Proxy.lnk" \
"$INSTDIR\proxy.exe --proxy-address=$4 --proxy-backend-addresses=$3" \
"" \
"$INSTDIR\proxy.ico" \
0

In result:
proxy.exe --proxy-address=127.0.0.1PORT --proxy-backend-addresses=SERVERPORT
no colon between address and port

Afrow UK
5th March 2012, 10:35
Please check the link MSG provided. Command line arguments are specified as a separate argument for CreateShortCut.

Stu

morkovnik
5th March 2012, 11:00
yes, it resolved:

CreateShortCut \
"$SMPROGRAMS\Proxy.lnk" \
"$INSTDIR\proxy.exe" \
"--proxy-address=$4 --proxy-backend-addresses=$3" \
"$INSTDIR\proxy.ico" \
0

thanks a lot!