Archive: Nsis can crreate installer for a non-exe project


Nsis can crreate installer for a non-exe project
Dear all

I know the NSIS can create a installer for a exe program, but I am wondering whether it can do this for a non-exe program,if so, how can it do that?

whoever knows this, please give me some comments. I am a newer for NSIS.

thanks in advance

dongfang


Using NSIS, you can 'install' all kinds of files - whether they be EXEs, DLLs, JPG, TXT files or anything else.

Simply use the "SetOutPath" and "File" instructions to write the given files to the path specified, and that's all there is to it.

Is there anything specific you're trying to install ?


My program runs with wjview command, which is included in a bat file.

before running the command wjview, it needs to know the directory of the program.


for the exe program,NSIS defines the running variable like that :
!define MUI_FINISHPAGE_RUN "$INSTDIR\MyProgram.exe"
but if the program is not exe project and runs with a batch file, I define the running variable like this:!define MUI_FINISHPAGE_RUN "$INSTDIR\myprogam.bat". Compile succeeds but running fails.

I am wondering whether the problem is that I can't define this variable like this for non-exe program or I need to do another configurations.

thank you very much.

dongfang


You can use MUI_FINISHPAGE_RUN_FUNCTION and use ExecShell in the specified function, or simply recreate the batch file contents in NSIS script.


Reading System.nsh, seems that it uses Exec command to run the target, which will not work for batch files. What you want to do, is use something like $SYSDIR\cmd.exe /c <batch_file_name.bat>.

Haven't tested it, but it should work...

Part of System.nsh
------------------------
!ifdef MUI_FINISHPAGE_RUN

!insertmacro MUI_INSTALLOPTIONS_READ $MUI_TEMP1 "ioSpecial.ini" "Field 4" "State"

StrCmp $MUI_TEMP1 "1" 0 mui.finish_norun
!ifndef MUI_FINISHPAGE_RUN_FUNCTION
!ifndef MUI_FINISHPAGE_RUN_PARAMETERS
StrCpy $MUI_TEMP1 "$\"${MUI_FINISHPAGE_RUN}$\""
!else
StrCpy $MUI_TEMP1 "$\"${MUI_FINISHPAGE_RUN}$\" ${MUI_FINISHPAGE_RUN_PARAMETERS}"
!endif
Exec "$MUI_TEMP1"
!else
Call "${MUI_FINISHPAGE_RUN_FUNCTION}"
!endif

mui.finish_norun:

!endif


cmd.exe is not available on Windows 9x, only command.com.


kichik

thank you very much.
I just recreate the batch file contents in NSIS script and set this file for MUI_FINISHPAGE_RUN_FUNCTION. It works well.

regards

dongfang