Old 27th August 2003, 18:30   #1
banaman8d
Junior Member
 
Join Date: May 2003
Posts: 19
!insertmacro and single quotes

I have tried to write script that
has a function and an accompanying macro:

Function __WriteBatFile
...
FunctionEnd

!macro WriteBatFile filename commands
Push "${commands}"
Push "${filename}"
Call __WriteBatFile
!macroend

!insertmacro WriteBatFile "$INSTDIR\afile.bat" '"$INSTDIR\afile.exe" /S'

but when I use strings that have spaces, I get an error message from makensis saying:

!insertmacro: WriteBatFile
Push expects 1 parameter got 5.
Usage: Push string
Error in macro WriteBatFile on macroline 1

I have tried many combinations of single and double quotes and only the number of arguments changes. I have also tried $\". It seems as though !insertmacro only looks for double quotes and interprets everything else literally.
If someone could enlighten me I would greatly appreciate it.
banaman8d is offline   Reply With Quote
Old 27th August 2003, 18:59   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
You've got this command in your macro: Push "${commands}"

Now you set the commands define to "$INSTDIR\afile.exe" /S

You will get: Push ""$INSTDIR\afile.exe" /S"

So, instead, use:

!insertmacro WriteBatFile "$INSTDIR\afile.bat" "$\"$INSTDIR\afile.exe$\" /S"
Joost Verburg is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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