Sign in to follow this  
Followers 0
macrolooped

Control Click & Windows Updates

5 posts in this topic

I would like to automate the process of checking for Windows updates after a routine that I am running. I am able to extract the following information from the Windows Updates screen using AutoIT Window Info:

>>>> Window <<<<
Title:  Windows Update
Class:  CabinetWClass
Position:   1956, 141
Size:   1004, 897
Style:  0x14CF0000
ExStyle:    0x00000100
Handle: 0x000F0F1C

>>>> Control <<<<
Class:  DirectUIHWND
Instance:   3
ClassnameNN:    DirectUIHWND3
Name:   
Advanced (Class):   [CLASS:DirectUIHWND; INSTANCE:3]
ID: 
Text:   
Position:   0, 35
Size:   988, 801
ControlClick Coords:    58, 103
Style:  0x56000000
ExStyle:    0x00010000
Handle: 0x0008102E

>>>> Mouse <<<<
Position:   2022, 309
Cursor ID:  0
Color:  0x651C73

>>>> StatusBar <<<<
1:  

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Address: Control Panel\All Control Panel Items\Windows Update
Windows Update
ShellView


>>>> Hidden Text <<<<
&Install updates
Turn on &automatic updates
&Check for updates
&Stop installation
Try &again
&Restart now
&Install now

And when I try to run this command for "Control Click" to automate clicking the "Check for updates" button, I get nothing. Can anyone spot the error? I suspect I need to do something because the text is hidden but I didn't see anything in the help file regarding this.

#include <File.au3>
#include <Constants.au3>

Run(@ComSpec & ' /c ' & '%windir%\System32\rundll32.exe url.dll,FileProtocolHandler wuapp.exe', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

WinActivate("Windows Update")

ControlClick("Windows Update", "", "[CLASS:DirectUIHWND; TEXT:&Check for updates; INSTANCE:3]")

Thanks in advance!

Share this post


Link to post
Share on other sites



#include <File.au3>
#include <Constants.au3>

Run(@ComSpec & ' /c ' & '%windir%\System32\rundll32.exe url.dll,FileProtocolHandler wuapp.exe', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

WinActivate("Windows Update")

ControlClick("Windows Update", "", "[CLASS:DirectUIHWND; INSTANCE:3]")


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thanks John but still no-go. I am able to open an instance of Windows Updates but cannot get the "Check for Updates" button to automatically click. I read that it uses DirectX which is a pain to work with so I am not sure if this is part of my problem.

For the time being I have added a mouseClick event to click the button this way but if I can do it through the ControlClick method this would be helpful and will accommodate for different monitor sizes and such.

Share this post


Link to post
Share on other sites

The problem you would run into is not so much the "Check for Updates" button (as LarsJ points out above), but the logic once this is done. Unless you expect to incorporate logic to tell the script which updates you want, which is going to be difficult to maintain, you're still going to have a lot of manual interaction. If you're thinking of just downloading and installing critical or important updates, you can do this in the Windows Update settings and then just turn on automatic updating.


√-1 2^3 ∑ π, and it was delicious!

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