Aide:ControlSend.txt
De Wiki AutoIt Français
Document original V3.3.6.1 :
###Function###
ControlSend
###Description###
Sends a string of characters to a control.
###Syntax###
ControlSend ( "title", "text", controlID, "string" [, flag] )
###Parameters###
@@ParamTable@@
title
The title of the window to access.
text
The text of the window to access.
controlID
The control to interact with. See <a href="../intro/controls.htm">Controls</a>.
string
String of characters to send to the control.
flag
[optional] Changes how "keys" is processed:
flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.
flag = 1, keys are sent raw.
@@End@@
###ReturnValue###
@@ReturnTable@@
Success: Returns 1.
Failure: Returns 0 if window/control is not found.
@@End@@
###Remarks###
ControlSend works in a similar way to <a href="Send.htm">Send</a> but it can send key strokes directly to a window/control, rather than just to the active window.
ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages). For normal windows ControlSend should be way more reliable than a normal Send - and yes it does send shift, ctrl, alt etc.
As mention in the Send help the keyboard that send different chars when in CAPS LOCK and using the Shift Key cannot be simulated. An example is the Czech Keyboard. A good workaround is to use the ControlSetText.
The control might first need to be given focus with the ControlFocus command, specially when referencing an controlID created by the script itself.
Opt("SendKeyDelay",...) alters the the length of the brief pause in between sent keystrokes.
Opt("SendKeyDownDelay",...) alters the length of time a key is held down before being released during a keystroke.
###Related###
ControlCommand, Send, ControlSetText, ControlFocus, SendKeyDelay (Option), SendKeyDownDelay (Option)
###Example###
@@IncludeExample@@
Document traduit V3.3.6.1 :
###Function###
ControlSend
###Description###
Envoie une chaîne de caractère à un contrôle.
###Syntax###
ControlSend ( "title", "text", controlID, "string" [, flag] )
###Parameters###
@@ParamTable@@
title
Le titre de la fenêtre à accéder.
text
Le texte de la fenêtre à accéder.
controlID
Le contrôle avec lequel interagir. Voir <a href="../intro/controls.htm">Controls</a>.
string
Chaîne de caractères à envoyer au contrôle.
flag
[optionnel] Change la manière de traiter les "touches" :
flag = 0 (défaut), Texte contenant des caractères spéciaux tel que + pour indiquer SHIFT et {LEFT}
pour indiquer la flèche de gauche.
flag = 1, les touches sont envoyées tel quel.
@@End@@
###ReturnValue###
@@ReturnTable@@
Succès: Retourne 1.
Échec: Retourne 0 si la fenêtre/le contrôle n'est pas trouvé.
@@End@@
###Remarks###
ControlSend fonctionne de manière similaire à <a href="Send.htm">Send</a>, mais il peut envoyer des appuis de touche directement à une fenêtre ou un contrôle, au lieu de la fenêtre active seulement.
ControlSend est instable pour les fenêtres de commande (DOS) car elles fonctionnent différemment d'une fenêtre normale (Semble vérifier l'état physique plutôt qu'accepter les messages de frappe clavier). Pour une fenêtre normale, ControlSend devrait être plus fiable, qu'un Send normal. Et oui, il envoie Shift, Ctrl, Alt etc.
Comme il est mentionné dans l'aide de Send, un clavier qui envoie des caractères différents lorsque CAPS LOCK et la touche Shift sont utilisée ne peut être simulé (le clavier Tchèque par exemple). Une bonne manière de contourner le problème, est d'utiliser ControlSetText.
Le contrôle peut en premier avoir besoin du focus avec la commande ControlFocus , spécialement lorsqu'il se réfère à un controlID créer par le script lui même.
Opt("SendKeyDelay",...) modifie la durée de la pause entre les envois de touches.
Opt("SendKeyDownDelay",...) modifie la durée de maintien d'une touche avant qu'elle ne soit relâchée pendant une frappe clavier.
###Related###
<a href="ControlCommand.htm">ControlCommand</a>, <a href="Send.htm">Send</a>, <a href="ControlSetText.htm">ControlSetText</a>, <a href="ControlFocus.htm">ControlFocus</a>, <a href="SendKeyDelay.htm">SendKeyDelay (Option)</a>, <a href="SendKeyDownDelay.htm">SendKeyDownDelay (Option)</a>
###Example###
@@IncludeExample@@
Traducteur : legend
Contributeurs (pour les modifications avant le Wiki) : Tlem