Script java - Hermand Stéphane

Aller au contenu

Script java

Formations-astuces > Informatique
Voici des exemples de script afin d'automatiser différentes taches :
Ceux-ci sont à copier dans un fichier texte et puis à renomer avec extention vbs

1 Bonjour
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad", 9
WScript.Sleep 500
WshShell.SendKeys "Bonjour"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "Comment va tu ?"

2 Bonsoir & note de départ
Heure ="Il est " & Hour(Now) & "h et " & Minute(Now) & " min."
if Hour(Now)<=16 then
Message="Voila"
Msgbox "Voici l'heure"
else
Message= "Bonsoir il est temps de partir"
end if
MsgBox Message & "!" & vbnewline & Heure
prog = InputBox("notepad ? oui ?")
if prog = "oui" then
Set oSh=CreateObject("WScript.Shell")
set oEnv = oSh.Environment("PROCESS")
oEnv("SEE_MASK_NOZONECHECKS") = 1
oSh.run "%SystemRoot%\system32\notepad.exe"
else
end if

3 Site web
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "iexplore.exe http://www.hermandstephane.be/"

4 Site web evo
Set WshShell = CreateObject("WScript.Shell")
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.navigate "http://be.msn.com/defaultf.aspx?lang=fr-be&ocid=iehp"
wscript.sleep 100
objExplorer.Visible=True
wscript.sleep 1500
WshShell.SendKeys "{tab}"
WshShell.SendKeys "test"
Hermand Stéphane Mensa MBE4012
Retourner au contenu