Jump to content

Modal dialogs?

Recommended Posts


Hi folks:

Brand new to AutoIT.  Nifty stuff.  I can see lots of future uses.

But at present, I'm trying to automate an install so that it's a 'silent' install, so I don't have to create a document to tell the users to click, Yes, Next, Next, Continue, check the 'agree' box and hit 'OK', and so forth and so on.

I was hoping I could just use the InstallShield setup.iss business, but that didn't work.

I was hoping I could automate the response to the UAC prompt, but that doesn't seem likely, which is totally understandable.

However, what I've got now doesn't respond to the very first dialog box of the install program.

; Script Start - Add your code below here
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

Local $runDir
Local $progName
Local $result

$rundir= "J:\RPM\Client Install\"

$result= ShellExecute($progName, "", $rundir, $SHEX_OPEN)
If $result=0 Then
   MsgBox($MB_OK, "failure", "failed to launch RPMClientSetup.exe")
   Exit  ;if the user answers 'no' to the UAC prompt, we'll get this 'failure to launch' error

$result= WinWaitActive("RPM Client Setup", "includes an install", 10)
$result=WinActivate("RPM Client Setup", "includes an install")
If $result=0 Then

   MsgBox($MB_OK, "failure", $result &@error & @extended )

Send("!n") ;to activated setup window for 'next'

(not sure what's up with the color-scheme there - it looks fine in SciTE!)

Even though I put a timeout on the WinWaitActive function, I never get the 'failure' msgbox.  The "RPM Client Setup" window just sits there mocking me until I close it manually.

I'm wondering if the problem is that the install program I'm trying to automate (RPMClientSetup.exe) is set up to make it's dialog boxes the equivalent of $MB_SYSTEMMODAL and thus my script process is not getting any clockcycles and cannot do any 'sending' of keystrokes to those dialog boxes.

How could I test for that?  And, hopefully, get around it?

Thanks much.

Share this post

Link to post
Share on other sites

Well duh - I just realized - It can't be that the dialog is sysmodal, because I can click away from it into other windows (like this one).

So now I'm even more confused.  I used the Window Info tool to identify the window's title.  I know I can manually send it 'Alt-n' and get it to proceed to the next dialog box.

But apparently my script isn't 'seeing' that window getting activated.

What am I doing wrong?

Share this post

Link to post
Share on other sites

Could it be that the title or text changed in the mean time?

I personally wouldn't love to use (but I did in my early AutoIt days, as you do) window titles for handle references.

There is an API in AutoIt you can call to make sure you get the same window whatever happens: "#include <WinAPIProc.au3>" then use this "_WinAPI_EnumProcessWindows($PID)" function to get the windows handle to reference to. (it's in the help file!)


In any case, if you use the above to get the handle, you don't even need to activate the windows :D

Just use: ControlSend() :drool:   (ControlSend() works in a similar way to Send() but it can send key strokes directly to a window/control, rather than just to the active window.)

Good luck.



I'm not really in AutoIt-shape anymore I guess...

Could it be you send the keys to the window-itself, instead of the button?

Edited by Triblade
Typo, added edit text.

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

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