Archive: NSIS close application before uninstall


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) ?


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.


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.