Sign in to follow this  
Followers 0
stuka

....

11 posts in this topic

#1 ·  Posted (edited)

.

Edited by stuka

Share this post


Link to post
Share on other sites



This is not an AutoIt related problem but I hope you all can help me out with this.

1. How do I install a fresh setup file over a previously installed program when it is still running without manually quitting it?

2. How do I automatically quit the running program when it is uninstalled so that it is not left behind as 'trash'?

Thanks in advance to anyone who is willing to help :)

1. You can't uninstall a program while it's running, and you'll want to uninstall the old copy before installing the new one. You'll either need to kill it (ProcessClose) or put the command line for the setup into either the RunOnce or RunOnceEx registry keys (HKLM) so that it will uninstall/new install on the next boot.

2. Don't understand what you mean. If the uninstall isn't doing a complete job, script the uninstall and then clean up after it, then do the new install.

Share this post


Link to post
Share on other sites

With Inno, there is a script command such as RunBefore or something like that, and another one called RunAfter or something. You could have a separate batch file or something, that lays alongside the installer in the same directory as the installer and looks for the target process and closes it, waits a second for the process to end and then uninstalls the old version of the application.


Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

1. I want the setup file to detect the running process, quit it, and then overwrite the old file. At the moment i have to manually quit the running program before i can update the file when installing over the old installation. I'm sure it can be done, i just can't figure out how to do it using Inno.

Posted Image

2. The Uninstallation process should detect the running process, quit it, and then only uninstall so that no files will be left behind because of the 'locked' process.

Any experienced Inno users here?

See AppMutex in the Inno Setup Help file. Use it to detect the process and close it. You could also use the RestartReplace flag on the file inquestion. That will force a restart and replace the file then. If you are using ISTool as your front end then creating the App Mutex is easy and does exactly what you want without the restart.

BTW this thread belongs in Chat not in AutoIt Help and Support.

Edit:

I should have added that another method that has been used is to write a compiled AutoIt script that does all of the Process Closing and cleanup before the install begins. Just install that file to {Temp} and create an entry pointing to the file in the [Run] section of your Iss file.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks Squirrely1 and GEOSoft, will try it out :)

Welcome

If you still have a problem then send me your ISS file (via PM) and I'll look at it for you.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I'm still not very sure how Inno's AppMutex function works...any experienced Inno users here?

If I were you jackit, I would study the Inno help file very carefully under AppMutex and then Google "Inno AppMutex" and study hopeful-looking results. Just keep trying to get the syntax of it correct and when you do, post the results in this thread because we know that the Inno help file is about as well written as the AutoIt help file. This way, we will all know the syntax. The AutoIt forums are about full disclosure, as far as syntax is concerned.

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

If I were you jackit, I would study the Inno help file very carefully under AppMutex and then Google "Inno AppMutex" and study hopeful-looking results. Just keep trying to get the syntax of it correct and when you do, post the results in this thread because we know that the Inno help file is about as well written as the AutoIt help file. This way, we will all know the syntax. The AutoIt forums are about full disclosure, as far as syntax is concerned.

Except that after looking at what he has, I've already advised him via PM that this is not a case that requires appmutex. I'm looking at his script and waiting for some info from him, but I think that it may be just as easy to either wrap the setup inside another one or to use the build in Exec code.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

2. The Uninstallation process should detect the running process, quit it, and then only uninstall so that no files will be left behind because of the 'locked' process.

Should what? You have no rights to force this on to an end user. I think you should reconsider. If you insist, then use Pascal as it is the backbone language of Inno Setup. I have created Inno Setup scripts since version 3.0.6 and never seen processes forced to close. Edited by MHz

Share this post


Link to post
Share on other sites

Perhaps I do not understand your intentions well enough but...

I don't mean to force the user in any way, it is just to assist the uninstalling or upgrading of a file without producing error messages like 'can't replace file', 'file in use/locked' and the sort. Or at least a warning beforehand.

You may think you are being nice but if your setup executable is on another end users machine, then they have the right to say if any force closure procedures are used. At least warning is just and rightly given. No one appreciates their processes being killed off deliberately and without warning. Half way through something and bang, all gone because someone thought it was good...

Any ideas for the AutoIt AppMutex?

No experience with doing that.

Share this post


Link to post
Share on other sites

A warning message box with a choice to kill or not would be good but implementing it is difficult.

Do you remind your users to exit the app first before installing/uninstalling so that the whole process would be smooth or do you have an alternative idea? Besides the AppMutex.

See your previous pictures you supplied. What is wrong with asking the user to choose?

And Jordan is well aware of what is best. Don't blame him for your unusual needs. If you can give good enough reason for your need then you may just get a good enough answer from Jordan. Jordan is quite very active with Inno Setup and may respond to you through the mailing list.

I cannot understand your reasons for forcing process closure without users consent.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

When installing over an old installation, the error does appear, but when uninstalling while the app is still running, the file doesn't get removed.

This is regarded as normal. When a user starts a installation, they are warned of closing programs etc... and warning is given later as your pictures show.

AppMutex can determine if the app is running and if does, it tells the user to close it before continuing.

I could be wrong but I am fairly surely sure that you need to initiate the process to know the handle to the AppMutex like _singleton() does within AutoIt.

Edit:

Try using the flag named uninsrestartdelete

Source: {app}\program.exe; DestDir: {app}; Flags: uninsrestartdelete

That should allow installation to progress and prompt restart if the option is of restart not disabled.

And use ISTool if your not already as it does show these options for easy selection.

Edited by MHz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0