Function Reference


_ClipBoard_GetPriorityFormat

Retrieves the first available clipboard format in the specified list

#include <Clipboard.au3>
_ClipBoard_GetPriorityFormat ( $aFormats )

Parameters

$aFormats Array with the following format:
[0] - Number of formats (n)
[1] - Format 1
[2] - Format 2
[n] - Format n

Return Value

Success: The first clipboard format in the list for which data is available
Failure: Format not found due to:
-1 - Clipboard has data, but not in any of the formats requested
0 - Clipboard is empty

Related

_ClipBoard_CountFormats, _ClipBoard_EnumFormats

See Also

Search GetPriorityClipboardFormat in MSDN Library.

Example

#include <Clipboard.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
        Local $aFormats[3] = [2, $CF_TEXT, $CF_OEMTEXT]

        ; Create GUI
        GUICreate("Clipboard", 600, 400)
        $g_idMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
        GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
        GUISetState(@SW_SHOW)

        ; See if there is any text in the clipboard
        MemoWrite("Priority formats .:. " & _ClipBoard_GetPriorityFormat($aFormats))
        MemoWrite("Unicode available .: " & _ClipBoard_IsFormatAvailable($CF_UNICODETEXT))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Write message to memo
Func MemoWrite($sMessage = "")
        GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite