jams08
30th October 2008 18:41 UTC
NSIS close application before uninstall
Hi,
In my case, i'm trying to find and close the running application and then uninstall the existing application and finally install.
I'm using Findwindow and SendMessage $1 ${WM_CLOSE} 0 0 to close my application. But my application in turn pops up a confirmation dialog (with yes / no option). My application will be closed only if you select option yes in the dialog box. Could some one tell me how to find the dialog box from running application and select yes/no option in that dialog (so that my application will be closed) ?
AaronLS
1st November 2008 00:12 UTC
I used AutoIt scripts for finding dialogs and sending button clicks. You can search for dialogs based on titles as well as message texts. After getting my AutoIt script to work, I compile the script to an exe. I then include that exe in my installer and extract it to a temp directory to run it. The AutoIt functions have timeouts, so that it will automatically close if it doesn't find the dialog.
deepcut
2nd November 2008 14:28 UTC
I don't know whether AaronLS's suggestion of AutoIt includes a macro recorder, but a similar system I use called AutoHotkey does. Which makes recording your couple of clicks and compiling the script to an exe very easy.
Not a very elegant solution though.