cs_Oasis3000
Messages postés3Date d'inscriptionvendredi 30 juillet 2004StatutMembreDernière intervention 6 avril 2006
-
6 avril 2006 à 17:01
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 2018
-
7 avril 2006 à 00:04
Bonjour,
J'ai besoin de scripter l'installation d'une app non scriptable 0_o
Je vais donc le faire par touche clavier
Mais pour cela j'ai besoin d'ouvrir une appli et de la fermer ensuite
Mon script ressemble à ça :
'mise en place
Set WshShell = WScript.CreateObject("WScript.Shell")
'selection setup
WshShell.Run app & "notepad.exe"
[..]
'Et ICI je veux fermer notepad.exe
/////
Mais je suis un peu perdu entre VBA vb.net ... j'ai essayé pas mal des solutions proposée via la recherche "fermeture app" "kill process" mais sans succès.
ta4444
Messages postés36Date d'inscriptionvendredi 17 mars 2006StatutMembreDernière intervention 6 novembre 2006 6 avril 2006 à 18:02
Si tu n'as pas d'autre notepad ouvert (que tu ne voudrais pas fermer), j'ai une solution radicale :
Public Function KillProcess(ByVal ProcessName As String) As Boolean
Dim svc As Object
Dim sQuery As String
Dim oproc
Set svc = GetObject("winmgmts:root\cimv2")
sQuery = "select * from win32_process where name='" & ProcessName & "'"
For Each oproc In svc.execquery(sQuery)
oproc.Terminate
Next
Set svc = Nothing
End Function
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 201827 7 avril 2006 à 00:04
Bonsoir,
Dans le même principe:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run app & "%SystemRoot%\system32\notepad.exe"
WScript.Sleep(200)
WshShell.SendKeys "nous sommes sur le forum de VBF"
WScript.Sleep(1000)
WshShell.SendKeys "%(fqn)" 'correspond à Alt + F(fichier) + Q(quitter) + "voulez-vs enregister"N(non)
Set WshShell = Nothing
MsgBox "Le process NotePad.exe est bien fermé"