|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Clipboard Commands > Get Clipboard Text > CLB. - Clipboard Operations |
SPR Script Language
CLB.WideToString
Retrieves clipboard text as a wide string and converts it to a string.
Intention
The CLB.WideToString command in SPR fetches the current clipboard content as a wide string (UTF-16) and converts it to a standard string for use in scripts. You can optionally specify a variable ($$RES) to store the result. This is useful for capturing text from the clipboard, such as copied data from external applications, and making it available for SPR processing.
It’s like a bridge from your clipboard to your robot—CLB.WideToString grabs wide text and converts it for easy use in SPR scripts.
Illustration
📋 Clipboard Text: Copy "Hello World" to the clipboard.
📥 Fetch: CLB.WideToString|$$OUT puts "Hello World" into $$OUT.
Syntax
CLB.WideToString|$$RES
Parameter Explanation
P1 - $$RES - (Variable, String, Optional)
The variable to store the converted clipboard text (e.g., $$RES). If omitted or invalid, the text is returned but not stored.
Examples
'***********************************
' CLB.WideToString - Sample 1: Get Clipboard Text
'***********************************
' Copy "Hello World" to clipboard manually first
CLB.WideToString|$$TEXT
MBX.Clipboard: $$TEXT (shows "Hello World")
MBX.Ready
'
'***********************************
' CLB.WideToString - Sample 2: No Output Variable
'***********************************
' Copy "Test Data" to clipboard manually first
CLB.WideToString
' Text retrieved but not stored
MBX.Ready
'
Remarks
- Retrieves clipboard text as a wide string (UTF-16) and converts it to SPR’s string format.
- Useful for capturing text from applications supporting wide characters.
- If the clipboard is empty or not text, returns an empty string.
Limitations
- Only retrieves text data; non-text clipboard content is ignored.
- Conversion depends on WStringToString; may lose data if SPR’s string format is limited (e.g., ANSI).
See also: