Sign in to follow this  
Followers 0
grwork1

Controlling Windows MMC Internet Information Servcies (IIS) dialog

2 posts in this topic

Hi,

Using AutoItX3, does anyone know how I can access/ControlClick the "View Sites" control in the right-hand pane of the Windows Microsoft Management Console (MMC) Internet Information Servcies (IIS) dialog. I have no trouble ControlClick'ing other controls in the centre pane, e.g. "Filter" edit box and "Group by" drop down list.

PC is running Windows 7, 64-bit.

The following script is lauched using the following command in an Admin Command Prompt:

> C:\windows\syswow64\cscript <vbscriptName>.vbs

with AutoItX3.dll located in C:\windows\syswow64.

---------- The VB script:

Option Explicit

Dim oShell

Dim oAutoIt

Dim IISWIn

Dim result

Set oShell = WScript.CreateObject("WScript.Shell")

Dim intError

intError = oShell.Run("regsvr32 /s C:\WINDOWS\system32\AutoItX3.dll",,True)

Wscript.Sleep 3000

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

if oAutoIt.IsAdmin then WScript.Echo "Admin rights detected."

'Run an Internet Information Services Window

oShell.Run "%SystemRoot%\system32\inetsrv\iis.msc"

IISWIn = "iis - [internet Information Services (IIS) Manager]"

' Wait for the program window to appear and make it active

oAutoIt.WinWait IISWIn

oAutoIt.WinActivate IISWIn

if (oAutoIt.WinActive(IISWIn)) then

WScript.Echo "IISWIn Windowactive"

end if

result = oAutoIt.ControlClick(IISWIn, "", "Edit1") ' Class Text: Works! Cursor appears in "Filter" edit box. [OK]

result = oAutoIt.ControlSend(IISWIn, "", "Edit1", "ftp") ' [OK]

oAutoIt.Sleep 2000

result = oAutoIt.ControlClick(IISWIn, "", "WindowsForms10.COMBOBOX.app.0.21d16742") ' ClassnameNN: Works! "Group by" drop down list appears. [OK]

oAutoIt.Sleep 2000

result = oAutoIt.ControlClick(IISWIn, "", "View Sites") ' Class Text: "View Sites" is not left clicked!! [FAIL]

if (result <> 1) then

oShell.Popup("Error ControlClick") ' Never triggered.

wscript.quit

end if

'Try again after forcing focus to right-hand pane.

result = oAutoIt.ControlFocus(IISWIn, "", "WindowsForms10.window.8.app.0.21d167414") ' ClassnameNN:

if (result <> 1) then

oShell.Popup("Error ControlFocus")

wscript.quit

end if

oAutoIt.Sleep 2000

result = oAutoIt.ControlClick(IISWIn, "", "View Sites") ' [FAIL]

oAutoIt.Sleep 2000

' Try again using ClassName instead of Class Text and trying 2 left clicks.

result = oAutoIt.ControlClick(IISWIn, "", "WindowsForms10.STATIC.app.0.21d167411", "left", 2) ' [FAIL]

oAutoIt.Sleep 2000

WScript.Quit

P.S. IIS has to be enabled via 'Start\Control Panel\Programs and Features\Turn Windows Features on or off' for the iis.msc to exist.

Thanks in advance for anyone who tries this.

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