Another Way to Report on Network DrivesMuch of the code in this example is the same as that in the Reporting on Network Drives example. However, we have created a Wsh.Shell object, here named shell, and used its Popup method to ask the user a question. The "Report on network drives?" question is shown in a dialog box with yes and no buttons for the user to click. (The latter are indicated by the vbYesNo constant.) The vbQuestion constant results in a question mark icon being placed on the dialog box. The 4 parameters to Popup are: the text to display, number of seconds to wait, title for the dialog box, and flags (such as vbYesNo, possibly combined using + signs). In the drives2.vbs script, the program will assume an answer of No if the user doesn't click a button within 4 seconds. In that case, no drive information is displayed.
Finding out the Details on WSH ObjectsNote that there are many other possible flags that can be used with Popup. How do you find out about these flags? Or, in general, how do you find out about other WSH-related objects as well as their properties and methods? The best method (short of a good reference book) is to go to MSDN's page on Windows Script Host Basics. Fill in "WSH Popup" or whatever you want to search for in the MSDN library search engine. Back to the Using WSH to Automate Tasks page |