:roll: Comment puis-je en code VB6 simple, lancer l'execution d'un script écrit dans un fichier.vbs ?
Merci....
Version imprimable
:roll: Comment puis-je en code VB6 simple, lancer l'execution d'un script écrit dans un fichier.vbs ?
Merci....
Par le biais d'un shell à mon avis, comme un batch
I_strVBScriptCode est le contenu du .vbs (textuellement)
I_strProcedureName est la procédure recherchée pour exécution
Code:
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 Dim objVbsc As New MSScriptControl.ScriptControl Dim objProc As Procedure Dim blnResult As Boolean Dim blnFound As Boolean If Not objVbsc Is Nothing Then With objVbsc .Language = "VBScript" .Reset .Timeout = -1 .AllowUI = True .AddCode I_strVBScriptCode 'Rechercher la procédure blnFound = False For Each objProc In .Procedures If StrComp(objProc.Name, I_strProcedureName, vbTextCompare) = 0 Then blnFound = True Exit For End If Next objProc If blnFound Then blnResult = CBool(.Run(I_strProcedureName)) Else 'Pas de procédure trouvée End If End With End If
Bonjour et bienvenu, si tu pouvais renommer ton post (ex : "Executer un script VB"), ca serait bien ;)