- NSIS Discussion
- exec command questions
Archive: exec command questions
JaqDraco
20th January 2003 08:54 UTC
exec command questions
Hi
i want to run a programm minimized.
exec seems not to support this. At th moment i have to create a batch file using the "start" command. This also is capable of setting process priority. Is there any way doing this with native nsis commands?
virtlink
20th January 2003 11:39 UTC
Use this:
ExecShell "open" "***91;exename***93;" "***91;parameters***93;" SW_SHOWMINIMIZED
>
Where [exename] is the name of your .exe file and [parameters] are the parameters for it. If it doesn't work with "open", try something else (I'm not sure if "open" also works with executables).
Here you can find the syntax.
JaqDraco
20th January 2003 12:32 UTC
I've tested execshell with "open" but the programm didn't start
virtlink
20th January 2003 12:41 UTC
Try an empty zero-length string "". Everywhere I look, it says that in order to run a program, you must use an empty string. I can't test it right now.
JaqDraco
20th January 2003 12:46 UTC
This don't work either. Unfortunately ".exe" doesn't appear in the extension association in the explorer settings. Therefore i think it can only be "executed". But then there should be a way to change the status Maximized, normal or minimized like in shortcuts
virtlink
20th January 2003 12:53 UTC
I know. I didn't find it there eighter. But in Visual Basic, there is a very similar API command called ShellExecute. That does virtually the same and works the same.
I found some more information about this function here, and it states that you can use the "open" action for documents, files and executables.
Please post your code here, or at least the error you get, and where. Do you get the error when compiling the script, or when you run the script, or doesn't the exe start at all, without any messages?
JaqDraco
20th January 2003 13:09 UTC
mmh I didn't checked the state of errors yet but i can say that the script compiles without error but it seems that the exe wasn't executed but i will use the iferrors for testing purposes but i check for his later
JaqDraco
22nd January 2003 08:49 UTC
i've checked again on another XP maschine the following
ExecShell "" "[exename]" SW_SHOWMINIMIZED
The Programm was started but not minimized
virtlink
22nd January 2003 10:38 UTC
I think you should ask KiCHiK, for example, by PM-ing him: Click here!.
kichik
22nd January 2003 14:17 UTC
Does it work without SW_SHOWMINIMIZED?
Are you using a full path (F:\bla\bla\prog.exe instead of prog.exe)?
JaqDraco
22nd January 2003 14:20 UTC
i'm using
ExecShell "" "$EXEDIR\exename" SW_SHOWMINIMIZED
and as i said the program starts but not minimized
rainwater
22nd January 2003 14:37 UTC
Originally posted by JaqDraco
i'm using
ExecShell "" "$EXEDIR\exename" SW_SHOWMINIMIZED
and as i said the program starts but not minimized
ExecShell "open" "$EXEDIR\exename" "" SW_SHOWMINIMIZED
You didn't pass the empty paramater string in that example.
JaqDraco
22nd January 2003 14:45 UTC
Originally posted by rainwater
You didn't pass the empty paramater string in that example.
is it necessary? Because the Compiler doesn't complains about the removal of the empty parameter string but i can check that later
virtlink
22nd January 2003 14:58 UTC
The compiler cannot guess that SW_SHOWMINIMIZED is the fourth parameter when you type it as being the third.
JaqDraco
22nd January 2003 15:08 UTC
this works:
ExecShell "" "$EXEDIR\exename.exe" "" SW_SHOWMINIMIZED
but the docs don't say that empty parameter is necessary to use the state
nevertheless is was my fault
sorry guys
virtlink
22nd January 2003 17:56 UTC
That's because the writers of the docs are experienced C++, NSIS, Java, VB programmer's that forget things that are very normal and common for them, like knowing that you always have to fill in a parameter even when it's not used.
I deal with it all the time myself. I help people with Windows computer problems via the phone or e-mail and forget that very basic things like knowing how to open the context menu of a file or browsing for a folder are not known with those users.
rainwater
22nd January 2003 18:25 UTC
I don't know how to describe it any better. When the 5th parameter is required, obviously you can't pass it as the 4th parameter.