Commands & Syntax > Commands > Clipboard >

Replace text - < clp_replace_text >() ... [Pro]

www.perfectkeyboard.com

 

Clipboard Replace text
<clp_replace_text>("Old text","New text",What,Method)
Available in: Professional edition

This command modifies current clipboard content (all textual formats) by replacing or inserting a portion of the text in the clipboard. It is possible to replace string or matching wildcard or matching regular expression by other string.

 

#

Parameter name

Parameter description

1

Old text

Current text in the clipboard to match.

2

New text

New text to be inserted to the clipboard.

3

What

Tells whether plain text, wildcard or regular expression should be used to match the current text in the clipboard. The values are "text", "wildcard" or "regex".

4

Method

Tells how to insert new text. Options are:
replace - The matching text in the clipboard is replaced by new text
insert_before - New text is inserted right in front of the matching text
insert_after - New text is inserted next to the matching text

 

Example (Macro Steps):

 

1

<#> <#>This macro shows how to replace xxx text in clipboard by current date

2

Clipboard COPY "Put date here: xxx"

3

Date & Time : DATE Insert or save to Variable Format=Windows user default - long, Separator=/, Day leading zero=Yes, Month leading zero = Yes, Day shift = 0, Variable for result = vDate

4

Clipboard Replace text Old text = "xxx", New text = "%vDate%", What = "Text", Method = "Replace text"

Example (Plain Text):

 

<#>This macro shows how to replace xxx text in clipboard by current date

<clpput>("Put date here: xxx")<#>

<date>(21,"/",1,1,0,"vDate")<#>

<clp_replace_text>("xxx","%vDate%",text,replace)