CLB. - Clipboard Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Clipboard Commands > Set Clipboard Text >

CLB. - Clipboard Operations

CLB.Clip All

Previous Top Next


SPR Script Language

 

CLB.Clip All

Trims specified words and characters from both sides of clipboard text.

 

Intention

 

The CLB.Clip All command in SPR directly modifies the clipboard text by trimming a comma-separated list of case-sensitive words ($$WRD) and individual characters ($$CHR) from both the left and right sides. Words are only removed if they appear at the edges, not in the middle after allowed letters, while characters are trimmed regardless of order or frequency. This operates directly in the clipboard, preserving Unicode content like emojis.

 

Think of it as telling your robot, “Cut these words and characters off the ends of the clipboard text, but leave the middle alone,”—and it cleans up the edges while keeping emojis and special characters intact.

 

Illustration

Suppose the clipboard contains:

"START Hello World END"

- 🔍 CLB.Clip All|START,END| trims "START" and "END" as words and spaces as characters, leaving "Hello World" in the clipboard.
- 🔍 If the clipboard has "*START*Text*END*", CLB.Clip All|START,END|* trims "START", "END", and "*", leaving "Text".

 

 

Real life Sample:

 

   AID.SetModel|deepseek-chat

   $$PRO+$crlf$Do not add descriptions to the content like "refined_text:" or "emoji" to the content.

   $$PRO+Do not add "refined_text:" or "reim:" or text:" or  "tweet" or any other explanations what the output is, to the content.$crlf$
   ' Deepseek will still add stuff to the output. So we just trim it away.

   AID.Ask|$$PRO|$$RES|1

   DBP.Got: $$RES

   $$WEG=} :{"$crlf$

   $$WRD=refined_text,text,tweet,emoji

   CLB.clipall|$$WRD|$$WEG

 

Syntax

 

CLB.Clip All|$$WRD[|$$CHR]

 

Parameter Explanation

 

P1 - $$WRD - (Variable, String)

A comma-separated list of case-sensitive words to trim from both sides (e.g., $$WRD as "START,END"). Required. Words are only removed if they appear at the edges.

 

P2 - $$CHR - (Variable, String, Optional)

A string of individual characters to trim from both sides (e.g., $$CHR as "* "). If omitted, only words from $$WRD are trimmed.

 

Examples

 

'***********************************

' CLB.Clip All - Sample 1: Trim Words and Spaces

'***********************************

CLB.Set|START Hello World END ' Set clipboard

CLB.Clip All|START,END| 

CLB.Get|$$TXT ' Get trimmed text

MBX.Trimmed: $$TXT ' Displays "Hello World"

'

'***********************************

' CLB.Clip All - Sample 2: Trim Words and Characters

'***********************************

CLB.Set|*START*Text*END*

CLB.Clip All|START,END|*

CLB.Get|$$TXT

PRT.Trimmed: $$TXT ' Prints "Text"

'

'***********************************

' CLB.Clip All - Sample 3: Trim Unicode with Words

'***********************************

CLB.Set|BEGIN 🌟 你好 END ' Unicode "Hello" in Chinese with emoji

CLB.Clip All|BEGIN,END| 🌟

CLB.Get|$$TXT

MBX.Trimmed: $$TXT ' Displays "你好" (preserves Unicode)

'

 

Remarks

 

- Trims words from $$WRD only at the start or end, not in the middle after allowed letters (case-sensitive).

- Trims all characters in $$CHR from both sides, in any order or frequency.

- Works directly in the clipboard, preserving Unicode (e.g., emojis, non-ASCII text).

- If $$WRD is empty, only $$CHR is trimmed; if both are empty, no trimming occurs.

 

Limitations

 

- Requires text in the clipboard; fails silently if empty or non-text.

- Words in $$WRD must match exactly (e.g., "start" won’t trim "START").

- No status code returned; use CLB.Get to verify results.

 

See also:

 

CLB.Set Text

CLB.Get Text

CLB.Trim