My question is : how give the focus to a InputBox
Here the script
'*****************************
passwordbox()
InputBox ("nom")
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>Mot de passe : </b>" _
& "<input type=password id=pass><p>" _
& "<button onclick='bboxwait=false;'>" _
& " Valider </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
'*****************************
Thank's in advance for your help.
Yvan
this.document.FormName.InputBoxName.focus()
TDM
"Yvan" <yvan....@wanadoo.fr> wrote in message
news:uhSqCUVn...@tk2msftngp13.phx.gbl...
'...
oIE.top = .parentWindow.screen.height\ 2 - 100
CreateObject("Wscript.Shell").AppActivate "Password _"
.all.pass.focus
PasswordBox = "CANCELLED"
'...
I have included that in most of my later examples of this routine.
Tom Lavedas
===========
Your answer don't give me the response.
How can i retrieve the focus for the vbscript inputbox after the function
passwordbox ?
--
Salutations
Yves HEILIG
"Tom Lavedas" <lav...@pressroom.com> a écrit dans le message de
news:DaKdnXP5BJ9...@fcc.net...
> Thank you for the passwordbox script. It's a great script.
>
> Your answer don't give me the response.
>
> How can i retrieve the focus for the vbscript inputbox after the function
> passwordbox ?
Hi
Put a "unique" title on your InputBox, like this:
InputBox "nom", "My unique title"
Create a second script (AppactivateInputBox.vbs below) that you launch just
before you make the callout to the InputBox function that runs AppActivate on
your unique title.
First script:
' ***************************************
passwordbox()
sExternalAppactivateVbs = "some path\AppactivateInputBox.vbs"
CreateObject("Wscript.Shell").Run "wscript.exe " & sExternalAppactivateVbs
InputBox "nom", "My unique title"
(snip)
' ***************************************
Second script AppactivateInputBox.vbs:
' ***************************************
Set oShell = CreateObject("Wscript.Shell")
Do
WScript.Sleep 200
i = i + 1
' give up after 5 seconds if necessary
If i = 25 Then Exit Do
Loop Until oShell.Appactivate("My unique title")
' ***************************************
--
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
Thank you very much.
--
Salutations
Yves HEILIG
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> a écrit dans le
message de news:3FA01845...@hydro.com...