[Script] Passwordbox

19/09/2003 - 18:49 por Ramon Jiménez [MS] | Informe spam
Cortesía de Tom Lavedas [microosft.public.scripting.wsh]

wsh.echo "You entered: ", passwordbox()

' A minimal version of a function to present a Password
' dialog in a VBS (WSF) script
' Requires WScript version 5.1+
' Tom Lavedas <tlavedas@hotmail.com>
' with help from and thanks to Joe Ernest and
' Michael Harris
'
Function PasswordBox()
set oIE = CreateObject("InternetExplorer.Application")
With oIE
.RegisterAsDropTarget = False
.Resizable = False : .FullScreen = True
.width = 400 : .height = 100
.Navigate "about:blank"
Do Until .ReadyState = 4 : WScript.Sleep 100 : Loop
.document.open
.document.write _
"<html><head><" & "script>bboxwait=true;</" _
& "script><title>Password _</title></head>"_
& "<body bgColor=Silver scroll=no" _
& " style='border-Style:outset;border-" _
& "Width:3px'>" _
& "<center><b>Password: </b>" _
& "<input type=password id=pass><p>" _
& "<button onclick='bboxwait=false;'>" _
& " Submit </button>" _
& "</center></body></html>"
.document.close
Do Until .ReadyState = 4 : WScript.Sleep 100 : Loop
.Visible = True
CreateObject("Wscript.Shell").Appactivate "Password _"
With .document
oIE.left = .parentWindow.screen.width \ 2 - 200
oIE.top = .parentWindow.screen.height\ 2 - 100
.all.pass.focus
PasswordBox = "CANCELLED"
On Error Resume Next
Do While .parentWindow.bBoxWait
if Err Then Exit Function
WScript.Sleep 500
Loop
oIE.Visible = False
PasswordBox = .all.pass.value
End With ' document
End With ' IE
End Function


Saludos
Ramon Jimenez
Microsoft Services
 

Leer las respuestas

#1 Alejandro Curquejo [MS MVP]
19/09/2003 - 19:16 | Informe spam
Gracias ;-)

Alejandro Curquejo
MS MVP DTS
Windows XP


Lo que debería saber acerca del boletín de seguridad de Microsoft MS03-039
http://www.microsoft.com/spain/tech...9-USER.asp

Siempre Aprendiendo ;-)

La informacion contenida en este mensaje se proporciona "tal cual"
sin garantias de ninguna clase y no otorga ningun derecho, usted
asume todo el riesgo de poner en practica lo aqui recomendado

"Ramon Jiménez [MS]" escribió en el mensaje
news:
Cortesía de Tom Lavedas [microosft.public.scripting.wsh]

wsh.echo "You entered: ", passwordbox()

' A minimal version of a function to present a Password
' dialog in a VBS (WSF) script
' Requires WScript version 5.1+
' Tom Lavedas
' with help from and thanks to Joe Ernest and
' Michael Harris
'
Function PasswordBox()
set oIE = CreateObject("InternetExplorer.Application")
With oIE
.RegisterAsDropTarget = False
.Resizable = False : .FullScreen = True
.width = 400 : .height = 100
.Navigate "about:blank"
Do Until .ReadyState = 4 : WScript.Sleep 100 : Loop
.document.open
.document.write _
"<html><head><" & "script>bboxwait=true;</" _
& "script><title>Password _</title></head>"_
& "<body bgColor=Silver scroll=no" _
& " style='border-Style:outset;border-" _
& "Width:3px'>" _
& "<center><b>Password: </b>" _
& "<input type=password id=pass><p>" _
& "<button onclick='bboxwait=false;'>" _
& " Submit </button>" _
& "</center></body></html>"
.document.close
Do Until .ReadyState = 4 : WScript.Sleep 100 : Loop
.Visible = True
CreateObject("Wscript.Shell").Appactivate "Password _"
With .document
oIE.left = .parentWindow.screen.width \ 2 - 200
oIE.top = .parentWindow.screen.height\ 2 - 100
.all.pass.focus
PasswordBox = "CANCELLED"
On Error Resume Next
Do While .parentWindow.bBoxWait
if Err Then Exit Function
WScript.Sleep 500
Loop
oIE.Visible = False
PasswordBox = .all.pass.value
End With ' document
End With ' IE
End Function


Saludos
Ramon Jimenez
Microsoft Services


Preguntas similares