- NSIS Discussion
- Closing a DOS box problem
Archive: Closing a DOS box problem
Sailo
3rd October 2002 14:42 UTC
Closing a DOS box problem
Hi,
I'm struggling to close a DOS box after running a batch file. What am i missing?
Name "DOS Window Test"
OutFile "FindWindow.exe"
!define WM_CLOSE 0x10
Section
File 'test.bat'
Exec 'test.bat'
findloop:
Sleep 500
FindWindow $0 "test"
StrCmp $0 0 findloop
MessageBox MB_OK "Click OK to close DOS Window"
SendMessage $0 ${WM_CLOSE} 0 0
SectionEnd
;eof
It just seems to get stuck in a loop.
Test.bat just contains an echo statement.
kichik
3rd October 2002 14:50 UTC
Are you sure the window name is "test"? Have you tried nsExec? It will show the output in the NSIS log, or no output at all if that's what you want.
Sailo
3rd October 2002 15:10 UTC
The blue bar at the top of the window reads 'Finished - test' and if i right click on it and select properties it has test in the title box.
I'm using nsis 1.99 so don't have option of nsExec. Any other ideas? How do you use shellExec? Will that help?
kichik
3rd October 2002 15:23 UTC
Download nsExec.dll alone from the CVS and use it.
Sailo
3rd October 2002 15:56 UTC
How can i display a list of window titles of windows that are currently open?
kichik
3rd October 2002 16:03 UTC
You can't with NSIS. You will have to create an extension DLL to do this with EnumWindows.
Why won't you use nsExec? It is so much easier and simpler.
Sailo
3rd October 2002 16:46 UTC
I am just trying to make sure my window title is correct.
I can't get nsExec to work. Where is the log that it rights. I can't find any info on it.
If you just open a command prompt what is the window title? This is all i'm trying to find out.
kichik
3rd October 2002 16:57 UTC
nsExec logs into the NSIS log, installation details. Logging will not work with NSIS 1.x because the logging method has changed since 2.0a2/3, I am sorry I mislead you. You can still use simple Exec with no output.
I think the window title should be the name of the batch file at the begining but after it finishes it depends on language of the system (Finished in different languages). You can't trust the NSIS process to be fast enough when trying to find the window before the title changes, it could be problematic.
Sailo
3rd October 2002 17:06 UTC
I have found that if you run a batch file and the very last command in the file is CLS windows automatically shuts the screen for you. So instead i created a temporary batch file, put my command with all its variables into it with a CLS on the end then used execwait to run it then deleted it.
This works fine for me but thanks for your help.
david33470
7th October 2002 13:13 UTC
I Have a similar Problem
During the installation, I compile the uninstal script (that it permit me to give some parameter from the install script to the uninstall one) using the following comand:
ExecWait '"$NSISDIR\makensis.exe" /CD /PAUSE /Duninstalrekey="My parameter" Uninstallscript.nsi'
but the problem is that the dos windows doesn't close automaticaly!!!
what can I do for the windows closing automaticaly???
Tank you, in advance, for your help!!!
Joost Verburg
7th October 2002 15:33 UTC
Re: I Have a similar Problem
Use nsExec
david33470
7th October 2002 21:09 UTC
???
OK but I dont find nsexec in the documentation.
how can I use this command?
Netsabes
7th October 2002 21:38 UTC
It's a plugin. There should be a readme in Contrib/nsExec/ explaining it's functions.
Also, if you are using the current cvs version, plugins are not called like in NSIS 1.x/2.0alpha. You need to use something like plugin::func.
For nsExec, it's nsExec::Exec [/TIMEOUT=x] path and nsExec::ExecToLog [/TIMEOUT=x] path
Joost Verburg
8th October 2002 09:31 UTC
The old way still works, but this is a easier of course.