Skip to content
⌘ NSIS Forum Archive

NIS 2.x chokes on installdir

15 posts

atfpodcast#

NIS 2.x chokes on installdir

This is my first post.
I am on windows 7 and I am trying to create an install to the document directory and sub directory but it chokes on space. Here is what I have...

;--------------------------------
; The default installation directory
InstallDir $Documents\Laughingbird Documents\Logo Elements\Tonys Work
; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------
from the default install that came with it. How do I get around it to install? I looked
atfpodcast#
;--------------------------------
; The default installation directory
InstallDir $Documents\Laughingbird" "Documents\Logo" "Elements\AptA
; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------

Processing script file: "C:\Users\Tony\Desktop\lb_install.nsi"
Name: "apta a icon element installer"
OutFile: "install.exe"
Error: unterminated string parsing line at C:\Users\Tony\Desktop\lb_install.nsi:19
Error in script "C:\Users\Tony\Desktop\lb_install.nsi" on line 19 -- aborting creation process

This is using the example.nsi and changing it to install files.
atfpodcast#
Ok I got the splash to screen to work but it still wont work if I put
InstallDir $Documents\Laughingbird" "Documents\Logo" "Elements\AptA

if I go

InstallDir $Documents\Laughingbird""Documents\Logo""Elements\AptA it will compile but then the user would have to add the spaces and I know people will just install. so how can I fix this? IM gonna post my whole script
atfpodcast#
; Installs my graphics pack for Laughingbird Software The Logo Creator.
;--------------------------------

; The name of the installer
Name "Apartment A Productions Installer"

; The file to write
OutFile "install.exe"

Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "apta.bmp"

; optional
; File /oname=spltmp.wav "my_splashshit.wav"

splash::show 5000 $TEMP\spltmp

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.

Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd

;--------------------------------
; The default installation directory
InstallDir $Documents\Laughingbird""Documents\Logo""Elements\AptA
; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------

; Pages

Page directory
Page instfiles

;--------------------------------
; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File club33fancy.png

SectionEnd ; end the section
jpderuiter#
You have to quote the whole string, not just the spaces...
InstallDir "$Documents\Laughingbird Documents\Logo Elements\Tonys Work"
Afrow UK#
The script parser uses whitespace as a token delimiter. If your argument/parameter contains spaces then you need to surround the entire string with quotes (", ' or `) to make it parse as a single token.

Stu
atfpodcast#
Originally Posted by Afrow UK View Post
The script parser uses whitespace as a token delimiter. If your argument/parameter contains spaces then you need to surround the entire string with quotes (", ' or `) to make it parse as a single token.

Stu
so

InstallDir "$Documents\Laughingbird Documents\Logo Elements\AptA"
???
What if I wanted to install files in that directory and another directory in the Laughingbird Documents directory and I did not need the users input?

Would I have to do two sections to achieve it?
JasonFriday13#
Originally Posted by atfpodcast
What if I wanted to install files in that directory and another directory in the Laughingbird Documents directory and I did not need the users input?
InstallDir "$Documents\Laughingbird Documents"

Section
; SetOutPath creates directories if they don't exist.
SetOutPath "$INSTDIR\Logo Elements\AptA"
; files go here

SetOutPath "$INSTDIR\some other dir"
; other files go here

SectionEnd
This is the basics for installing files to different directories. You need the lowest common directory, and you add you're own paths to it.
atfpodcast#edited
So still use file to put them there and the file again after to put in another directory?

InstallDir "$Documents\Laughingbird Documents"

Section
; SetOutPath creates directories if they don't exist.
SetOutPath "$INSTDIR\Logo Elements\AptA"
; files go here

file thisfile.jpg
file yourfile.jpg

SetOutPath "$INSTDIR\some other dir"
; other files go here

file afilehere.png
file card.jpg

SectionEnd



Now will this show it installing with a gui with out users input? I am reading up on silent install but I want them to see an automated install.
JasonFriday13#
Originally Posted by atfpodcast View Post
Now will this show it installing with a gui with out users input? I am reading up on silent install but I want them to see an automated install.
Here's a basic automated installer:
Originally Posted by test.nsi
Name "Test"
OutFile "Test.exe"

RequestExecutionLevel User
ShowInstDetails Show

Page InstFiles

Section
DetailPrint "Sleep for 5 seconds."
Sleep 5000
SetAutoClose True
SectionEnd
"SetAutoClose True" closes the installer after the InstFiles page is finished. The default is False.

File extracts files to the current directory, which is set using SetOutPath.

So you use SetOutPath to set the directory, and File to extract a file to that directory.

Originally Posted by TestSetOutPath.nsi
Name "TestSetOutPath"
OutFile "TestSetOutPath.exe"

RequestExecutionLevel User
ShowInstDetails Show

Page InstFiles

Section
SetOutPath "$EXEDIR\folder1"
File "TestSetOutPath.nsi"

SetOutPath "$EXEDIR\folder2"
File "TestSetOutPath.nsi"

SetOutPath "$EXEDIR\folder3"
; Some other files

SectionEnd
atfpodcast#
I got it to work now. I commented out the directory page and it all works. Added license info too..
atfpodcast#
Here are the changes...
; Installs my graphics pack for Laughingbird Software The Logo Creator.
;--------------------------------
;
!define Version "v1.0"
; installer name
Name " Characters Elements"

; The file to write
OutFile "setup.exe"
!define MUI_ICON "apta_icon.ico"
icon apta_icon.ico


; Show install details
ShowInstDetails show

Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "splash.bmp"
splash::show 4000 $TEMP\spltmp
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.
Delete $TEMP\spltmp.bmp
FunctionEnd

;--------------------------------

; The default installation directory

InstallDir "$Documents\Laughingbird Documents\Logo Elements\Vector Characters"

; InstallDir "$Documents\Laughingbird Documents\Logo Logo Libraries\"

; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------

; Pages

Page license
LicenseData license.txt
;Page directory
Page instfiles

;--------------------------------
; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File C:\Users\Tony\Desktop\stuff\ai\vector\png\biz_man.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\biz_woman.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\casual_girl.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\chef.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\female_doc.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\girl_megaphone.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\santa.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\superhero.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\woodboy.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\woodgirl.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\xmas_girl1.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\xmas_girl2.png
File C:\Users\Tony\Desktop\stuff\ai\vector\png\xmas_girl3.png

SectionEnd ; end the section