Old 11th February 2018, 15:13   #1
Nafin
Junior Member
 
Join Date: Feb 2018
Posts: 1
Passing command to macro

Hi everybody!
I'm literally fighting with an issue in NSIS.
I'm trying to pass a command as argument to a macro, which should write log and then execute the command.
This is my code:

code:

!macro ExecCommandAndLog command
push ${command}
call ExecCommandAndLog
!macroend

Function ExecCommandAndLog
StrCpy $result ""
pop $R0
nsislog::log $LOGFILE "Running command : $R0"
ClearErrors
ExecWait $R0 $result
${If} $result != ""
nsislog::log $LOGFILE "Error executing $R0 = $result"
${Else}
IfErrors 0 +2
nsislog::log $LOGFILE "Generic error executing $R0"
${EndIf}
FunctionEnd


Section "Install"
[...]
SetOutPath "C:\Temp"
!insertmacro ExecCommandAndLog "File file.txt"
[...]
SectionEnd



At compile time I have an error: push expects 1 parameters, got 2
I suppose the command passed in !insertmacro ExecCommandAndLog "File file.txt" has been seen as 2 strings.
I've tried with any quotes but nothing works.
Any help?

Thank you so much in advance
Nafin is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Winamp > Winamp Technical Support

Tags
argument, command, log, macro, parameter

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