| |
ols_76
Posts: 1
Score: 0
Joined: 3/1/2005
From:
Status: offline
|
I have a script (see below) that uses the 'MMC 2.0 Automation Object Model' to: 1.] start the 'Microsoft Management Console 2.0' application 2.] load the 'Security Configuration and Analysis' snapin 3.] execute the 'Open Database...' menu item (prompts user with a File Dialog Box) However, this script (step 3) requires the user to manually select the database from the File Dialog Box. Is it possible to automate the selection of the database? I've tried forcing the database name to the file dialog box (objShell.SendKeys "test.sdb{ENTER}"), but this line is not executed until the dialog box is closed. The reference to the file dialog box seems to be inaccessible as it encapsulated within the 'Item(2).Execute' method. Otherwise I could use that reference to automatically select the database. '################################################ ' VARIABLE DECLARATION '################################################ Option Explicit Dim objSCANode Dim objMMC Dim objShell '################################################ ' VARIABLE INITIALIZATION '################################################ Set objMMC = Wscript.CreateObject("MMC20.Application") set objShell = CreateObject("WScript.Shell") '################################################ ' EXECUTE 'Open Database...' MENU ITEM '################################################ objMMC.Document.SnapIns.Add("Security Configuration and Analysis") Set objSCANode = objMMC.Document.ScopeNamespace.GetChild(objMMC.Document.RootNode) objMMC.Show objMMC.Document.ActiveView.Select objSCANode objMMC.Document.ActiveView.SelectionContextMenu.Item(2).Execute objShell.SendKeys "test.sdb{ENTER}" 'force db name to active dialog box 'objShell.SendKeys "^{ESC}"
|
|