Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


automating file dialog box within mmc

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2219
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> automating file dialog box within mmc
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 automating file dialog box within mmc - 3/2/2005 10:09:58 AM   
  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}"
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> automating file dialog box within mmc Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts