Execution d'un programme avec un script

Résolu
McDEV04 Messages postés 42 Date d'inscription vendredi 24 août 2007 Statut Membre Dernière intervention 1 octobre 2007 - 29 août 2007 à 01:17
McDEV04 Messages postés 42 Date d'inscription vendredi 24 août 2007 Statut Membre Dernière intervention 1 octobre 2007 - 30 août 2007 à 06:01
Hello la tribu !!!

Mon script ouvre FRSDiag.exe puis normallement il est confirer automatiquement grace à "sendkeys" en cochant et decochant les option puis en dernier il doit , aprés avoir appuyer sur Valider (toujout avec sendkeys) lancer une analyse et générer des fichier log en .txt

Mon problème avec ce script et qui ne ve pas lancer l'analyse. mon exe bloque et ne fait rien alor qu'il dervait démarer l'analyse de mon réseau.

j'ai essayer de mette a vrai objshell.run à la fin ça ne donne rien
sa bloque et j'ai pas de message d'erreur

Option Explicit
    'déclaration des variables
Dim objShell, pause
Dim objReseau, Ofso
Dim  osh , return

Set objShell = CreateObject ("Wscript.shell")
Set Ofso = CreateObject("Scripting.FileSystemObject")
Set objReseau = CreateObject ("Wscript.Network")
Set osh  = CreateObject ("Wscript.shell")
    
    'Execution automatique de l'application FRSDiag
return = objshell.run("c:\mytest\Exe\FRSDiag\frsdiag",,false)

    'Process qui configure automatiquement FRSDiag
    'Decoche et coche des options            
objShell.AppActivate("FRSDiag")
wscript.sleep 2000
    Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500
    objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.Sendkeys Space(1)
wscript.sleep 500    
    Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500    
    Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500
    Objshell.SendKeys "{Tab}"
wscript.sleep 500    
    Objshell.SendKeys Space(1)
wscript.sleep 500
    Objshell.SendKeys "{Tab}"
wscript.sleep 500    
    Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys "{Tab}"
wscript.sleep 500
    'coche systeme
Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500    
    'coche directory Services
    Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500
    'Coche DNS log
    Objshell.SendKeys "{tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500
    Objshell.SendKeys "{tab}"
wscript.sleep 500
Objshell.SendKeys "{Tab}"
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500
    Objshell.SendKeys "{tab}"
 wscript.sleep 500
    Objshell.SendKeys Space(1)
 wscript.sleep 500          
    Objshell.SendKeys "{tab}"
wscript.sleep 500    
    Objshell.SendKeys Space(1)
wscript.sleep 500    
    Objshell.SendKeys "{tab}"
wscript.sleep 500    
    Objshell.SendKeys Space(1)
wscript.sleep 500
    objshell.SendKeys Space(1)
wscript.sleep 500
    Objshell.SendKeys Space(1)
wscript.sleep 500
    Objshell.SendKeys "{tab}"
 wscript.sleep 500
    Objshell.SendKeys Space(1)
 wscript.sleep 500          
    Objshell.SendKeys "{tab}"
wscript.sleep 500    
    Objshell.SendKeys "{tab}"    
wscript.sleep 500    
    Objshell.SendKeys "{tab}"
wscript.sleep 500    
    Objshell.SendKeys Space(1)
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 1000
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 1000
    objshell.SendKeys "{tab}"
wscript.sleep 1000
    objshell.SendKeys "{tab}"
wscript.sleep 500
    objshell.SendKeys "{tab}"
wscript.sleep 500
    'lance l'analyse en appuyant sur valider
objshell.SendKeys space(1)
 
------------------------------------------------------------------------------------------------

je sais, c un peu long pour rien mais bon, si il existe une solution à mon problème je suis tout ouie !!!!!

Voili voila,

2 réponses

McDEV04 Messages postés 42 Date d'inscription vendredi 24 août 2007 Statut Membre Dernière intervention 1 octobre 2007
30 août 2007 à 06:01
Merci Jack

Désolé ça fait pas longtemps que j'utilise ce site

En faite FRSDiag et un outil qui permet de scanner le réseau d'une
forêt active directory. Il repère des erreurs  de réplications ou de
nom de domaine, verifie que la connection entre domaines parents et
domaines enfants s'effectue.
Il est impossible d'avoir de l'aide sous l'invité de commande et il y a bien un .ini


 J'ai trouvé mon erreur, en faite parmis tous ces sendkeys, il y en avait un en trop, alors le focus n'était pas au bonne endroit.


Sur-bête XD, j'ai perdu du temps juste pour ça


Encors désolé et merci quand même

PS : Tes remarques sont enregistrer
3
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
29 août 2007 à 19:56
Salut McDev04
Commence par bien choisir le thème de ta question : elle porte sur vbscript et pas sur VB6 (corrigé)
Ensuite, explique un peu ce qu'est "FRSDiag" (que ce ne soit pas à l'internaute d'aller chercher les infos)

Manipuler un exe avec des SendKeys n'est jamais très
Les idées qui me viennent :
- Regarder quelles sont les options en ligne de commande de cet exécutable :
Ouvre une fenêtre DOS avec CMD puis tape la commande
FRSDiag /?   ou   FRSDiag /h
- Ce programme n'aurait-il pas un fichier de config ?
Regarde si un fichier CFG ou INI accompagne ton exécutable : il y a surement de quoi paramétrer ton run

Sinon, sous VB6, quand on utilise SendKeys, il y a une option (en fin de commande) pour spécifier si on veut que l'instruction attende qu'elle soit fini avant de continuer. 
   SendKeys "chaine", True/False

Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

<hr />Le savoir est la seule matière qui s'accroit quand on la partage (Socrate)
0
Rejoignez-nous