Home > Language Reference > UI Automation Functions > WriteUIA


The WriteUIA function waits until the field specified by its UIA descriptor is ready for use and then writes text into it.


Used to fill automatically a form.

Video: How to use WriteUIA WinTask x64 function for automatically entering data in any field exposed to UI Automation framework, for example in a WinForms application.


ret=WriteUIA(<uia_descriptor> , <text>)


<uia_descriptor>, string, UIA descriptor of the UI element where to write <text> within the desktop. Use Spy to find the UIA descriptor of the UI element.

<text>, string, text to type in the text field. Special keystrokes (Alt, Shift, <, ...) must be specified using their keyboard mnemonics.

Return value

Ret, optional numeric return code. If the function succeeds writing within 30 seconds (this default value can be changed using #ActionTimeout), the function returns 0. If the function fails, the return value is a nonzero value (see UI Automation Functions Error Codes).


If the field is not empty, WriteUIA writes the text after the existing text. If you want to delete the existing text, use "<End><Shift <Home>>" string before the text to type, for example
WriteUIA("[APP='Application.exe',CLASS='WindowsForms10.EDIT*',AUTOID='tbFirstName']","<End><Shift <Home>>New text").

The system variable #SendKeysDelay (set to 0 by default) slows down the typing of characters. A small delay is added between each keystroke (for example, if WriteUIA sends "z<Ctrl a>", there will be a delay between z  Ctrl and a).

See also

How to use UI Automation functions


'Select the Arial font in the Word Ribbon toolbar
WriteUIA("[APP='WINWORD.EXE',CLASS='NetUIHWND'][NAME='Font',ROLE='tool bar'][NAME='Font:',ROLE='combo box']","Arial")