1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| ' Test l'existence d'un fichier
Set objFSO = CreateObject("Scripting.FileSystemObject" )
If objFSO.FileExists("spec.txt" ) Then
dim filesys, text, readfile, contents
set filesys = CreateObject("Scripting.FileSystemObject")
set readfile = filesys.OpenTextFile("spec.txt", 1, false)
do while readfile.AtEndOfStream=false
contents = readfile.ReadLine
' Set what you want to put in the clipboard '
strMessage = contents
' Declare an object for the word application '
Set objWord = CreateObject("word.Application")
' Using the object '
With objWord
.Visible = False ' Don't show word '
.Documents.Add ' Create a document '
.Selection.TypeText strMessage ' Put text into it '
.Selection.WholeStory ' Select everything in the doc '
.Selection.Copy ' Copy contents to clipboard '
.Quit False ' Close Word, don't save '
End With
Set WshShell = createobject("wscript.shell")
Set oExec = WshShell.Exec("..\LabSp418\LabSpec.exe")
WScript.Sleep 1000
Set WshShell = WScript.CreateObject("WScript.Shell" )
WshShell.SendKeys "^o"
WScript.Sleep 500
WshShell.SendKeys "^v"
WshShell.SendKeys "{enter}"
loop
readfile.close
WScript.Quit
Else
Wscript.Echo "Veuillez sélectionner des spectres !"
End If |
Partager