Hello.
I made today an applications .bat file (choice app based)menu for an user on work, who presents him a list of determinated apps and so on.....but read some stuff about internet explorer scripting model and i start a script who controls user input trough an .html menu.
it works 'til msgbox instruction but doesn't run desired app...probably insn't possible?
My old ms dos window style looks crap...visualy html window is more clear, modern..
thanks for your comments
I made today an applications .bat file (choice app based)menu for an user on work, who presents him a list of determinated apps and so on.....but read some stuff about internet explorer scripting model and i start a script who controls user input trough an .html menu.
Code:
Dim shell, oIE
Set shell = WScript.CreateObject("WScript.Shell")
Do While true
' Ouverture d'Internet Explorer
Set oIE = WScript.CreateObject("InternetExplorer.Application", "IE_")
oIE.Left = 50
oIE.Top = 10
oIE.Height = 700
oIE.Width = 550
oIE.MenuBar = 0
oIE.ToolBar = 0
oIE.StatusBar = 0
oIE.navigate GetPath() & "test44.htm"
oIE.Visible = 2
Do While (oIE.Busy)
WScript.Sleep 200
Loop
shell.AppActivate "AppsForm"
On Error Resume Next
Do
WScript.Sleep 100
Loop While (oIE.Document.Script.CheckVal() = 0)
If Err <> 0 Then
'Wscript.Echo "On a fermé IE directement"
Wscript.quit
end if
test=oIE.Document.Script.CheckVal()
If test=1 Then
'CloseIE
'Wscript.quit
'end if
MsgBox "On a appuyé sur le bouton " & test & VBCRLF & VBCRLF _
'work's 'til here...
& "On a choisi comme application: " & oIE.Document.Appsform.AppsList.value
call FncShell()
End IF
CloseIE
loop
'------------------------------------------------------------
' Fonction de récupération du répertoire courant
Function GetPath()
Dim path
path = WScript.ScriptFullName
GetPath = Left(path, InStrRev(path, "\"))
End Function
'------------------------------------------------------------
' Fermeture d'Internet Explorer
Sub CloseIE
oIE.Quit
Set oIE = Nothing
End Sub
'------------------------------------------------------------
Function FncShell()
Set tempshell = Wscript.CreateObject("Wscript.Shell")
Tempshell.Run "c:\Program Files\Microsoft Office\Office10\Winword.exe"
End function
Code:
<html>
<head>
<title>Test de formulaire avec IE</title>
</head>
<body bgcolor="#FFFFD2" scroll="no">
<script language="VBScript">
<!--
Dim ready
Sub VALID_OnClick
ready=1
End Sub
Sub ANNUL_OnClick
ready=2
End Sub
' Initialisation
Sub Window_OnLoad()
ready=0
End Sub
Public Function CheckVal()
CheckVal=ready
End function
'-->
</script>
<form name="AppsForm">
<h3><center>Liste d'Applications</center></h3><hr>
<select size="1" name="AppsList">
<option value="Opt1">application1</option>
<option value="Opt2">application2</option>
<option value="Opt3">application3</option>
<option value="opt4">application4</option>
</select>
<hr>
<input type="button" value="Valider" name="VALID">
<input type="button" value="Annuler" name="ANNUL">
</form>
</body>
</html>
it works 'til msgbox instruction but doesn't run desired app...probably insn't possible?
My old ms dos window style looks crap...visualy html window is more clear, modern..
thanks for your comments