Torgeir
Sat Jul 23 13:53:03 CDT 2005
cslyas wrote:
> Hi,
>
> I am new to vbscript.
>
> Before an application program can be open - there is a dialog box
> requesting the user for the password - how do I write the vbscript
> to indicate the password so that the application program can be
> automatically visible?
>
> Thanks in advance.
Hi,
For a solution that should work pretty well, you could use AutoIt or
AutoItX, it has a pretty decent handling of windows and dialog boxes.
AutoIt/AutoItX
http://www.hiddensoft.com/autoit3/index.php
AutoItX.dll is an ActiveX control version of AutoIt and
can be used from e.g. VBScript/Jscript.
An example using AutoItX from a VBScript:
'--------------------8<----------------------
Set oAutoIt = CreateObject("AutoItX.Control")
oAutoIt.SetTitleMatchMode 2
Set oShell = CreateObject("WScript.Shell")
oShell.Run "some program", 1, False
' Wait for the window (no timeout)
oAutoIt.WinWait "Some title here", "Maybe some text here", 0
oAutoIt.WinActivate "Some title here", "Maybe some text here"
oAutoIt.Send "something, e.g. a password"
'--------------------8<----------------------
Hint: Use the "/reveal" mode of the full AutoIt product to see what
text is present on a window that you can test for.
Alternatively, use AutoIt (not AutoItX) that can convert a AutoIt
script to a standalone exe file you can distribute. You can do all
your scripting in the AutoIt script language, this way you avoid
to install the AutoItX dll file (with regsvr32.exe [/s]).
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx