Jump to content

Early Software Install Termination


Recommended Posts

So while crafting a software install gui, it occurs to me that the script that runs will continue running even if the program it was installing failed to install.

I considered using a while loop to enclose the entire install function saying while this process (setup.exe or whatever) is running, do these commands. However, I have some WinWait commands that just cycle around waiting for the install complete dialog to show before closing it, so that main while loop would not do any good to terminate those WinWaits.

I suppose the question would be, is there a way to have the script automatically terminate if the program that it called to run (using Run()) terminates before the rest of the script is finished?

Thanks in advance!

Link to comment
Share on other sites

So while crafting a software install gui, it occurs to me that the script that runs will continue running even if the program it was installing failed to install.

I considered using a while loop to enclose the entire install function saying while this process (setup.exe or whatever) is running, do these commands. However, I have some WinWait commands that just cycle around waiting for the install complete dialog to show before closing it, so that main while loop would not do any good to terminate those WinWaits.

I suppose the question would be, is there a way to have the script automatically terminate if the program that it called to run (using Run()) terminates before the rest of the script is finished?

Thanks in advance!

Use AdLibEnable() [in Production version], or AdLibRegister() [in Beta], to check the status periodically.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You can put a timer on WinWaitActive, but I don't know if that is the right solution for you. For example

Run("FooInstaller.exe")
WinWaitActive("Foo Software Install","this installs stuff", 10)  ; wait 10 seconds to see if something happens
If WinActive("Foo Software Install","this installs stuff") = 1 then
    keep going
Else
  MsgBox(0,"Foo Failure" , "Stupid Install did not work")
EndIf

That will run your install and then wait 10 seconds for the Window to appear. there may be a more elegant way to do the same.

Edited by ctyankeeinok
Link to comment
Share on other sites

Ok, so looking at the AdLib, it looks like it will periodically run the function that you specifiy. This will do it on its own, without any function calls, based on the timer that I set?

Also, for something like somebody hitting the X on installation, should that AdLib function check to see if the process still exists, versus checking for a particular error message?

Thanks again!

Link to comment
Share on other sites

Ok, so looking at the AdLib, it looks like it will periodically run the function that you specifiy. This will do it on its own, without any function calls, based on the timer that I set?

Yes.

Also, for something like somebody hitting the X on installation, should that AdLib function check to see if the process still exists, versus checking for a particular error message?

Either, or both. That depends on your application. The AdLib function that you call can check as many conditions as you care to monitor. One hint: keep as short/minimalist as possible. Once AdLib or event functions are called, you generally want them to complete their business and return control to the main script as quickly as possible.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

So I noticed there is also an AdLibDisable(). I tried putting the AdLibEnable after the first WinWait statment, so that it will actually launch the program, and then check to see if the windows still exist, but no dice.

Does it not work that way? Once you put the AdLibEnable in, it will be active in the whole script, regardless of where it actually is placed? I ask because I've tried putting it after and the script just doesn't run now. If I change the time to 6 seconds, then it works ok. The problem with that is the time it will take for installs to get to that first screen is variable if things are being done cross-country over the network.

Edit: Nevermind on this. I put it after the first WinWait, and didn't take it out of the top. Did that, and it worked fine!

Edited by ScriptingNewb
Link to comment
Share on other sites

A note on future developments: AdLibEnable() in the current Production version can only have ONE adlib function setup at a time. In the current Beta it's replaced with AdLibRegister(), which can register many adlib functions. If/When that change makes it to the production version AdLibEnable() will be deprecated.

The work-around for multiple adlib functions in the current production version is _Timer_SetTimer() in the Timers.au3 UDF.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...