# ClipWait

Waits until the clipboard contains data.

    ClipWait [, SecondsToWait, 1]

### Parameters

SecondsToWait | If omitted, the command will wait indefinitely. Otherwise, it will wait no longer than this many seconds (can contain a decimal point or be an expression). Specifying 0 is the same as specifying 0.5.
1 | If this parameter is omitted, the command is more selective, waiting specifically for text or files to appear ("text" includes anything that would produce text when you paste into Notepad). If this parameter is 1 (can be an expression), the command waits for data of any kind to appear on the clipboard.

### ErrorLevel

If the wait period expires, ErrorLevel will be set to 1. Otherwise (i.e. the clipboard contains data), ErrorLevel is set to 0.

### Remarks

It's better to use this command than a loop of your own that checks to see if this clipboard is blank. This is because the clipboard is never opened by this command, and thus it performs better and avoids any chance of interfering with another application that may be using the clipboard.

This command considers anything convertible to text (e.g. HTML) to be text. It also considers files, such as those copied in an Explorer window via Control-C, to be text. Such files are automatically converted to their filenames (with full path) whenever the clipboard variable (%clipboard%) is referred to in the script. See Clipboard for details.

When 1 is present as the last parameter, the command will be satisified when any data appears on the clipboard. This can be used in conjunction with ClipboardAll to save non-textual items such as pictures.

While the command is in a waiting state, new threads can be launched via hotkey, custom menu item, or timer.

### Related

Clipboard, WinWait, KeyWait

### Example

    clipboard = ; Empty the clipboard
    Send, ^c
    ClipWait, 2
    if ErrorLevel
    {
        MsgBox, The attempt to copy text onto the clipboard failed.
        return
    }
    MsgBox, clipboard = %clipboard%
    return