Page 1 sur 1

Problème automatisation TV HOST

Posté : mer. 27 mars 2019 11:59
par Polycop
;.............INSTALL TEAM VIEWER....................................
TrayTip("Installation Teamviewer","Installation Teamviewer en cours",1000)

ShellExecute("Teamviewer11\TeamViewer_Host_Setup-idcmn2c5k3.exe")
WinWaitActive("Installation de TeamViewer 11 Host","Bienvenue à TeamViewer 11 Host")
   Send("{ENTER}")
   Send("{DOWN}")
   Send("{ENTER}")
   Send("{TAB}")
   Send("{SPACE}")
   Send("{ENTER}")
   Sleep(3000)
WinActive("Accès non surveillé", "Installation accès non surveillé")
Sleep(1000)
;MouseClickDrag("left", 655, 355, @DesktopWidth, @DesktopHeight)
WinWaitActive("Accès non surveillé", "Installation accès non surveillé")
   Send("{ENTER}")
   Send($nomtv)
   Send("{TAB}")
...
Bonjour je suis bloquer à l'installation de Teamviewer Host, dès que la fenètre "Accès non surveillé", "Installation accès non surveillé" apparait je suis obliger de cliquer sur celle-ci pour que le script continu. avez vous une idée? j'ai tenter WinActive, WinWaitActive, de faire une simulation de clic mais comme tout les postes n'ont pas les mêmes dimensions bof. Peut être WinActivate? :? Merci beaucoup d'avance!

Re: Problème automatisation TV HOST

Posté : mer. 27 mars 2019 13:52
par TommyDDR
Cela peut arriver quand le processus lancé a les droits administrateur alors que votre programme non.
Essayez d'ajouter #RequireAdmin au début de votre script et réessayez.

Re: Problème automatisation TV HOST

Posté : mer. 27 mars 2019 14:18
par Polycop
J'ai également plein d'autres logiciels avant. Et j'ai bien mis le #RequireAdmin au début

Re: Problème automatisation TV HOST

Posté : jeu. 28 mars 2019 00:17
par TommyDDR
Vous pouvez poster l'impression écran de AutoIt Window Info concernant la fenêtre incriminée ?

Re: Problème automatisation TV HOST

Posté : jeu. 28 mars 2019 09:22
par Polycop
Bien sur je met l'image de la fenêtre ainsi que les info avec Auto-it de celle ci.
Image
Image

Re: Problème automatisation TV HOST

Posté : jeu. 28 mars 2019 11:55
par Polycop
J'ai créer une parti comme ça dans le code pour voir ce qu'il me retourne:
If WinExists("Accès non surveillé", "Installation accès non surveillé") Then
   MsgBox(0,"existe bien","")
   WinActivate("Accès non surveillé", "Installation accès non surveillé")
Else
   MsgBox(0,"existe pas","")
EndIf
Et il me retourne donc que la fenêtre n'existe pas..
mais pendant l'installation, je tiens au courant de mon avancement si ça peut aider qqn ou même vous aidez a trouver mon souçis ^^
après quand je clique sur la fenêtre le script se poursuit.

Re: Problème automatisation TV HOST  

Posté : jeu. 28 mars 2019 14:18
par Polycop
C'est bon j'ai réussi ^^' je pose au cas ou j'ai créer une boucle que tant que la fenêtre n'est pas activé, elle cherche si elle existe et l'active.
While WinActive("Accès non surveillé","Installation accès non surveillé") == 0
If WinExists("Accès non surveillé", "Installation accès non surveillé") Then
   WinActivate("Accès non surveillé", "Installation accès non surveillé")
EndIf
WEnd
:wink:

Re: Problème automatisation TV HOST

Posté : jeu. 28 mars 2019 16:26
par TommyDDR
WinWait est fait pour ça :
local $hwnd = WinWait("Accès non surveillé","Installation accès non surveillé")
WinActivate($hwnd)

Juste par curiosité : pourquoi faire des Send("xxx") au lieu d'utiliser les fonctions ControlClic(), ControlSend(), ControlSetText() etc ?

Essayez le script suivant pour voir la différence (le gros + c'est que vous pouvez utiliser votre ordinateur en même temps, pas besoin d'avoir le focus sur la fenêtre) :
Send("#r")

Local $hwnd = WinWait("Exécuter")
Sleep(1000)
ControlSetText($hwnd, "", "[CLASS:Button; INSTANCE:2]", "Valider")
Sleep(1000)
ControlSetText($hwnd, "", "[CLASS:Button; INSTANCE:3]", "Retour")
Sleep(1000)
ControlDisable($hwnd, "", "[CLASS:Button; INSTANCE:4]")
ControlSetText($hwnd, "", "[CLASS:Button; INSTANCE:4]", "(Désactivé)")
Sleep(1000)
Local $pos = ControlGetPos($hwnd, "", "[CLASS:Button; INSTANCE:2]")
For $i = $pos[0] To 10 Step -1
   ControlMove($hwnd, "", "[CLASS:Button; INSTANCE:2]", $i, Default)
   Sleep(10)
Next
Sleep(1000)
ControlSetText($hwnd, "", "[CLASS:Edit; INSTANCE:1]", "calc")
Sleep(1000)
ControlClick($hwnd, "", "[CLASS:Button; INSTANCE:2]")

Re: Problème automatisation TV HOST

Posté : jeu. 28 mars 2019 17:05
par orax
Juste par curiosité : pourquoi faire des Send("xxx") au lieu de faire une installation silencieuse ?
TeamViewer_Host_Setup.exe /S