Get text from clipboard

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


Get text from clipboard String

ParameterTypeDescription
This command does not require any parameters
Function resultStringReturns the text (if any) present in the Clipboard

Description

Get text from clipboard returns the text present in the clipboard.

If the text is correctly extracted from the Clipboard, the command sets the OK variable to 1. If the Clipboard is empty or does not contain any text, the command returns an empty string, sets the OK variable to 0, and generates an error -102. If there is not enough memory to extract the text from the Clipboard, the command sets the OK variable to 0 and generates an error -108.

4th Dimension text fields and variables can contain up to 32,000 characters. If there are more than 32,000 characters in the Clipboard, the result returned by Get text from clipboard will be truncated when placed into the field or variable receiving the value. To handle very large Clipboard text contents, first test the size of the data using the command Test clipboard. Then, if the text exceeds 32,000 characters, use the command GET CLIPBOARD instead of Get text from clipboard.

Example

The following example tests the for the presence of text in the Clipboard, then, depending on the size of the data, extracts the text from the Clipboard as text or as a BLOB:

   $vlSize:=Test clipboard ("TEXT")
   Case of
      : ($vlSize<=0)
         ALERT ("There is no text in the clipboard.")
      : ($vlSize<=32000)
         $vtClipData:=Get text from clipboard
         If (OK=1)
            ` Do something with the text
         End if
      : ($vlSize>32000)
         GET CLIPBOARD ("TEXT";$vxClipData)
         If (OK=1)
            ` Do something with the BLOB
         End if
   End case

See Also

GET CLIPBOARD, GET PICTURE FROM CLIPBOARD, Test clipboard.

System Variables

If the text is correctly extracted, OK is set to 1; otherwise OK is set to 0 and an error is generated.

Error Handling

If there is not enough memory to extract the text, an error -108 is generated.

If there is no text in the Clipboard, an error -102 is generated.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next