Archive: Using ExecShell with SW_HIDE?


Using ExecShell with SW_HIDE?
At the end of installation I'd like to run a trivial .bat file:

@echo off
if "%LANG%=="" SET LANG=fr_FR
"C:\Program Files\LyX\bin\lyx.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9

Following the example here:
http://nsis.sourceforge.net/archive/...php?pageid=416

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
!insertmacro MUI_PAGE_FINISH

Function LaunchProduct
ExecShell "" '"${PRODUCT_BAT}"' SW_HIDE
FunctionEnd

Where ${PRODUCT_BAT} is the batch file.

It works in that the file runs, but instead of hiding the cmd window, it passes SW_HIDE through to lyx.exe.

So, two questions:
1. How do I run a batch file without displaying the shell window.
2. Is it possible to achieve the same goal another way? I don't want to set LANG globally.

Regards,
Angus


Apologies for replying to self, but I've achieved my goal with

Function LaunchProduct
lyx_configure::set_env LANG $LangCode
Exec ${PRODUCT_EXE}
FunctionEnd

where lyx_configure is a .dll that I use for a number of other things. Here, I've added:



std::string const pop_from_stack()
{
char data[10*MAX_PATH];
popstring(data);
return data;
}


// Set an environment variable
extern "C"
void __declspec(dllexport) set_env(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)
{
EXDLL_INIT();

std::string const var_name = pop_from_stack();
std::string const var_value = pop_from_stack();

SetEnvironmentVariableA(var_name.c_str(), var_value.c_str());

pushstring("0");
}

Regards,
Angus


NSIS package includes NSIS\Contrib\nsExec plugin for DOS applications. And my ExecDos http://forums.winamp.com/showthread....hlight=ExecDos with some comments to batch files execution.


Nice! However, in this case the .bat file is so trivial that I'm happy with a call to SetEnvironmentVariable within the installer.

Regards,
Angus