Bonjour

Objectif
Ouvrir des URLs dans des instances IE uniques et valider le "OK" d'authentification

Langage choisi
WSH

Voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Sub M1
Set MonShell = WSCript.createObject("wscript.shell")
MonShell.run "URL1"
MonShell.AppActivate "Connexion à IPURL1"
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{ENTER}", False
End Sub

Sub M2
Set MonShell = WSCript.createObject("wscript.shell")
MonShell.Run "URL2"
MonShell.AppActivate "Connexion à IPURL2"
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{ENTER}", False
End Sub

Sub M3
Set MonShell = WSCript.createObject("wscript.shell")
MonShell.Run "URL3" 
MonShell.AppActivate "Connexion à IPURL3"
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{ENTER}", False
End Sub

Sub M4
Set MonShell = WSCript.createObject("wscript.shell")
MonShell.Run "URL4"
MonShell.AppActivate "Connexion à IPURL4"
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{ENTER}", False
End Sub

Sub M5
Set MonShell = WSCript.createObject("wscript.shell")
MonShell.Run "URL5"
MonShell.AppActivate "Connexion à IPURL5"
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{ENTER}", False
End Sub

Sub M6
Set MonShell = WSCript.createObject("wscript.shell")
MonShell.Run "URL6"
MonShell.AppActivate "Connexion à IPURL6"
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{TAB}", False
MonShell.SendKeys "{ENTER}"

End Sub
M1
WScript.Sleep 1200
M2
WScript.Sleep 1200
M3
WScript.Sleep 1200
M4
WScript.Sleep 1200
M5
WScript.Sleep 1200
M6
Toutes les fenêtres s'ouvrent une par une et le bouton "OK" est validé à l'affichage de la boite de dialogue d'authentification.

Mais la dernière fenêtre reste en arrière plan, et la gestion du sendkeys ne fonctionne pas.
Si j'appuie moi même sur entrée cela valide la boite de dialogue par contre.

Le code est pas top je pense.
J'utilise des SendKeys {TAB} pour focus le bouton OK à coup sur, mais même sans cela ne change pas le comportement.
J'ai paramétré de force IE pour ne pas gérer les onglets et le forcer à ouvrir des instances uniques.

Faut il que je passe par un boucle en affectant un ID sur chaque instance ?!
Merci pour vos suggestions/corrections/réponses

Cordialement