Archive: Command Line Usage Problems


Command Line Usage Problems
Hello. I am new to this forum. Anyway, I am a modder of GTA: Vice City and I was trying to integrate IMG editing into my NSIS installer. I am using a command line IMG editing tool to do so. However, when I run my installer, it skips the extraction of the IMG tool. Can someone tell me what to do to fix this?

Here is the nsi

http://www.mediafire.com/?ndrh9a5mpk866au

Thanks in advance!


The FILE command you used specifies a relative path to get/compress the executable. Are you sure that the path is correct relative to the nsi script?

The compiler should detect an error if the file isn't found, but absolute paths might be more reliable. Check the compiler output listing to be sure it found the file (you'll see the size before and after it was compressed when the FILE command is processed).

You can also use 7zip to look at the installer executable. If the fastman92ImgConsole.exe was found you'll see it under the $TEMP folder inside the archive. If it is present but does not get extracted, it might be a permissions issue. Try adding RequestExecutionLevel HIGHEST to your script.


I agree with demiller9. It sounds like you were trying to do this:
File "C:\Downloads\Programs\GTAVC\fastman92_IMG_Console_1_7\go here for program\fastman92ImgConsole.exe"
instead of this:
File "Downloads\Programs\GTAVC\fastman92_IMG_Console_1_7\go here for program\fastman92ImgConsole.exe"

(Note that it's probably better to use $PLUGINSDIR, instead of $TEMP.)

You should also include requestexecutionlevel admin, and verify adminlevel access using the UserInfo plugin in .onInit. Because you're trying to write to programfiles and HKLM.


Thanks! I'll try permissions.


I updated nsi with a script piece from here:

http://forums.winamp.com/showthread.php?t=310377

Above mediafire link no longer works!!!

I also changed fastman92 to ImgEdCmd.

Hopefully it will work.


!define PRODUCT_NAME "Test"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\IMGEdCmd.exe"

!define XPUI_SYSDIR "C:\Program Files (x86)\NSIS\ExperienceUI\Contrib\ExperienceUI"
!include "${XPUI_SYSDIR}\XPUI.nsh"

RequestExecutionLevel Highest

; MUI 1.67 compatible ------
;!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "IMG 1.exe"
InstallDir "$PROGRAMFILES\Rockstar Games\Grand Theft Auto Vice City"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show


Section "MainSection" SEC01

SetOutPath "$INSTDIR\addtogta3img"
SetOverwrite on
File "C:\Users\Ryan\Documents\GTAVC\ImgEdCmd\ImgEdCmd.exe"
File "C:\Users\Ryan\Documents\GTAVC\sparrow.txd"

; Unset all file-attributes (like Read-Only) and check if gta3.img and gta3.dir exist
SetOutPath "$INSTDIR\models"

/*

IfFileExists "$INSTDIR\models\gta3.img" errModelInstall startModelInstallImg

Goto errModelInstall

startModelInstallImg:

IfFileExists "$INSTDIR\models\gta3.dir" errModelInstall startModelInstallDir

Goto errModelInstall

startModelInstallDir:

*/

SetFileAttributes "$INSTDIR\models\gta3.img" FILE_ATTRIBUTE_NORMAL

SetFileAttributes "$INSTDIR\models\gta3.dir" FILE_ATTRIBUTE_NORMAL

; Add models to gta3.img

nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\sparrow.dff"'

SectionEnd



Section -Post
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" ""$PROGRAMFILES\Rockstar Games\Grand Theft Auto Vice City""
Delete "$INSTDIR\addtogta3img"

SectionEnd


Later.

You should use requestexecutionlevel admin, and you also need to use the UserInfo plugin to make sure the installer actually *gets* admin access, for example in case UAC is turned off (or if using Windows older than Vista).

Anders has made an excellent example script: http://pastebin.com/EvMkyLLt


Thanks again!