PDA

View Full Version : Restoring Application Window


Clinical
11-14-2005, 05:02 AM
OK, I am lhaving trouble getting my Autoplay Apllication window to restore after running an installation routine.
Scritpting used:

OnClick
File.Open("AutoPlay\\Docs\\setup.exe", _SourceFolder.."\\AutoPlay\\Docs", SW_SHOWNORMAL)
Window.Minimize(Application.GetWndHandle());

OnLeave
Window.Restore(Application.GetWndHandle());
result = Dialog.Message("Notice", "Thank You for Installing dabl Primary. Click OK to continue", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Page.Jump("Page1");

This all works well except for the restore bit. The problem I think is that the Autoplay window is losing its windows focus. Because after I click on the minimised window, the rest of the routine works.

Being a non-programmer, I have no idea how to get the focus back to the Autoplay minimised window automatically.

Thanks

rhosk
11-14-2005, 06:30 AM
Try this -

On Click

Dialog.Message("Notice", "Thank You for Installing dabl Primary. Click OK to continue", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Window.Minimize(Application.GetWndHandle());
File.Run("AutoPlay\\Docs\\setup.exe", "", "", SW_SHOWNORMAL, true); -- tells the application to "wait" until the setup.exe is complete
Window.Restore(Application.GetWndHandle());
Page.Jump("Page1");


If your setup routine relies on other sub-processes, that may not work. You may have to do some windows targeting to further the conditional routine (Enumerate...)

Also try Window.Hide - works extremely well in that case.

Clinical
11-14-2005, 07:58 AM
Ok, Just changed the order a bit. Message not supposed to appear until exe is installed. (Actually tried the text exactly as above and got same result)

The minimise and restore now work great, but the installation of setup.exe is being skipped.

Window.Minimize(Application.GetWndHandle());
File.Run("AutoPlay\\Docs\\setup.exe", _SourceFolder.."\\AutoPlay\\Docs", SW_SHOWNORMAL, true);
Window.Restore(Application.GetWndHandle());
Lines = "Thank You for Installing dablŪ Primary.\n Setup is now Complete. \n Click OK to continue";
result = Dialog.Message("v8.1.5.2", Lines, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Page.Jump("Page1");

Clinical
11-14-2005, 08:07 AM
Bit more tweaking and I have found that this works:

Window.Minimize(Application.GetWndHandle());
File.Open("AutoPlay\\Docs\\setup.exe", _SourceFolder.."\\AutoPlay\\Docs", SW_SHOWNORMAL, true);
Window.Restore(Application.GetWndHandle());
Lines = "Thank You for Installing dablŪ Primary.\n Setup is now Complete. \n Click OK to continue";
result = Dialog.Message("v8.1.5.2", Lines, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Page.Jump("Page1");

However the window is restoring slightly before the setup.exe has a change to open its window. So Window minimises and restores almost immediately.

I can see how File.Run and true are the better option but my setup.exe wouldn't execute this way? Don't know why.

rhosk
11-14-2005, 08:17 AM
Yeah, as I stated, your setup.exe probably has internal processes that fire and AMS thinks that setup.exe is finished because it executes the other internals and the mother exe is done.

The way you currently have your code is useless, because the scripting occurs one after the other in virtual milliseconds. The Window.Maximize is being fired almost (like you said) immediately after the File.Open. There are probably a few ways you can achieve exactly what you want, but it sounds as if you're satisfied :)

edit: or Window.Restore (not Window.Maximize) :o

Clinical
11-14-2005, 08:23 AM
Yeah, as I stated, your setup.exe probably has internal processes that fire and AMS thinks that setup.exe is finished because it executes the other internals and the mother exe is done.

The way you currently have your code is useless, because the scripting occurs one after the other in virtual milliseconds. The Window.Maximize is being fired almost (like you said) immediately after the File.Open. There are probably a few ways you can achieve exactly what you want, but it sounds as if you're satisfied :)

No you are right. It is useless. Pointless to minimise and restore immediately.
(looks NAF)
Any quick ideas to delay the restore?
Maybe thats the easiest solution (aside from the easier option of not bothering with the minimise at all) Was only to look a bit more polished.

(Hope they pay you here for your time :)

rhosk
11-14-2005, 08:36 AM
Did you build the install routine?

In any event, if you could get the window handle(s), you may be able to use the File.Run and start the Page Timer to locate the window (or process) and tell AMS that as soon as the process is complete, Restore the application.

Or, if you built the install, you could have the end of the install routine to send a message to AMS via command-line to Restore as well.

Or maybe instead of minimizing, jump to a specific page with a [custom background] or whatever...just don't know the precise details of the app.

Clinical
11-14-2005, 09:32 AM
No it was built for me by 2 (FUSSR) programmers. I am just trying to move it beyond mere functionality. I will see if they can append "the end of the install routine to send a message to AMS via command-line to Restore".

If not will leave it un-minimised. Still looks very acceptable.

Thanks again Ron.