MSN Home  |  My MSN  |  Hotmail
Sign in to Windows Live ID Web Search:   
go to MSNGroups 
Groups Home  |  My Groups  |  Language  |  Help  
 
Windows-Scriptwindowsscript@groups.msn.com 
  
What's New
  Join Now
  Home  
  Windows XP  
  Getting Started  
  Advanced Stuff  
  FAQ  
  Downloads  
  Recommendations  
  MS Newsgroups  
  Upload  
  Old Homes  
  
  
  Tools  
 
Windows XP
Add XP Feature  Edit XP Feature  Delete XP Feature  List View 

 SOAP client COMponent included in XP
   
You can call a WEB Service (this is what .NET is all about) from a script
 
set SOAPClient = createobject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit "http://www.webservicex.net/stockquote.asmx?WSDL"
WScript.Echo "MSFT : " & SOAPClient.GetQuote("MSFT")
 
See GotDotNet for more on .NET


 Open File dialog
   
set oUA = CreateObject("UserAccounts.CommonDialog")
' exposed in  nusrmgr.cpl
x = oUA.ShowOpen
wscript.echo x ' shows False if user cancels selection
wscript.echo oUA.FileName
 
or
 
set oFO = CreateObject("SAFRCFileDlg.FileOpen")
' exposed in safrcdlg.dll
x = oFO.OpenFileOpenDlg
wscript.echo x, oFO.FileName
 
Note that the return value from the call using SAFRCFileDlg.FileOpen has inverted logic; you get back a 1 if the user selected a file rather than -1.


 Hidden text input on command line for password prompting
   

This will only work when the script is run using cscript!

Set pw = CreateObject("ScriptPW.Password")
WScript.StdOut.Write "What's the magic word? "
strPassword = pw.GetPassword()
MsgBox strPassword



 New WMI object wbemscripting.swbemdatetime to help solve the WMI date/time format drama
   
Set dateTime = CreateObject("WbemScripting.SWbemDateTime")
set OSobjs = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")
for each obj in OSobjs
    dateTime.Value = obj.LastBootUpTime
    wscript.echo "Last boot time:",dateTime.GetVarDate
next
 
More details on MSDN


 XP includes cmdlib.wsc that contains a library of functions you can use in your own scripts
   

progid = Microsoft.CmdLib

Method Name Description
CheckScript used to find whether CScript is used or not
vbPrintf Simulates the Printf function
getHostName used to get the current Host name
getUserName used to get the current User Name
getDomainName used to get the current Domain name
getPassword used to get the password from the user
trapError Reports error with a string saying what the error occurred in
getArguments used to get the arguments into appropriate variables
wmiConnect used to connect to wmi provider with the given credentials
packString Attaches spaces to a string to increase the length to intWidth
getMaxStringLen used to get length of the maximum length string in an array of strings
showResults used to show results in the desired format
validateDateTime To validate the date-time format specified
changeToWMIDateTime To format the given date-time
matchPattern checks whether a given value matches a particular pattern



 MMC 2.0 now has an automation model for scripting
   
 
Read more about it on MSDN


Notice: Microsoft has no responsibility for the content featured in this group. Click here for more info.
  Try MSN Internet Software for FREE!
    MSN Home  |  My MSN  |  Hotmail  |  Search
Feedback  |  Help  
  ©2005 Microsoft Corporation. All rights reserved.  Legal  Advertise  MSN Privacy