This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Script help
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 04, 2008
10:50 AM
Script help
I wrote a script to stop a process from running then call uninstall on my program but it does not appear to be working. I have put in message boxes to check that it is hitting inside the if statements and it seems to be executing all of the code....but nothing gets shut down or uninstalled.
exePath = "";
exePath = INSTALLDIR ^ "MyApp.exe";
LongPathToQuote(exePath,FALSE);
// check if the file is in use
if (Is (FILE_EXISTS, exePath) = TRUE) then
hWnd = FindWindow("", "My App");
if (hWnd != 0) then
PostMessage(hWnd, WM_QUIT, 0, 0);
endif;
// if the file exists call uninstall on it
LaunchAppAndWait("msiexec.exe","/quiet /uninstall {MyProductCode}",WAIT);
endif;
Any help is greatly appreciated, Thank you.
exePath = "";
exePath = INSTALLDIR ^ "MyApp.exe";
LongPathToQuote(exePath,FALSE);
// check if the file is in use
if (Is (FILE_EXISTS, exePath) = TRUE) then
hWnd = FindWindow("", "My App");
if (hWnd != 0) then
PostMessage(hWnd, WM_QUIT, 0, 0);
endif;
// if the file exists call uninstall on it
LaunchAppAndWait("msiexec.exe","/quiet /uninstall {MyProductCode}",WAIT);
endif;
Any help is greatly appreciated, Thank you.
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 04, 2008
12:09 PM
Is this a Basic MSI project with your code in an InstallScript Custom Action?
If so, Where is this code sequenced? Have you tried generating a log file?
In either case, you might also capture the return code from the LaunchAppAndWait call and display it.
One other point: Looking to see if a file exists is different from seeing if the file is in use. To see if the file is in use, look at the Is function with the FILE_LOCKED parameter.
If so, Where is this code sequenced? Have you tried generating a log file?
In either case, you might also capture the return code from the LaunchAppAndWait call and display it.
One other point: Looking to see if a file exists is different from seeing if the file is in use. To see if the file is in use, look at the Is function with the FILE_LOCKED parameter.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 04, 2008
12:28 PM
Yes it is a basic MSI and the custom action is sequenced right after this event 'SetARPINSTALLLOCATION'
I will capture the return from the LaunchAppAndWait then display it to get a better feel for what is going on.
I was using the Is FILE_LOCKED then calling EXIT on exePath, but it was not working and found the code I am using now on the forums here.
I will capture the return from the LaunchAppAndWait then display it to get a better feel for what is going on.
I was using the Is FILE_LOCKED then calling EXIT on exePath, but it was not working and found the code I am using now on the forums here.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 05, 2008
11:51 AM
I added this section of code to replace the FindWindow stuff, it says it completes successfully but the program does not exit.
if (Is (FILE_LOCKED, exePath)) then
nreturn = Is(EXIT, "My App");
MessageBox("EXIT = " + FormatMessage(nreturn), INFORMATION);
endif;
if (Is (FILE_LOCKED, exePath)) then
nreturn = Is(EXIT, "My App");
MessageBox("EXIT = " + FormatMessage(nreturn), INFORMATION);
endif;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 05, 2008
11:58 AM
I don't see EXIT as a valid parameter to pass to the Is function. Most likely that's the problem with the return code.