Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Clipboard.AddText

Adds text to the clipboard.

Component Version macOS Windows Linux Server iOS SDK
Clipboard 13.2 ✅ Yes ❌ No ❌ No ❌ No ❌ No
MBS( "Clipboard.AddText"; text; type )   More

Parameters

Parameter Description Example
text The new txt for the clipboard. "Hello World"
type The data type.
By default NSStringPboardType, but can be other Mac types.
""

Result

Returns OK or error.

Description

Adds text to the clipboard.
This function allows on macOS to put multiple things on the clipboard, like both a text representation and a xml one.
So if user pastes to a text editor, they get the text editor, but if they paste into your app, you can get back the xml.

Examples

Add two text things and query back:

# set
Set Variable [ $r ; Value: MBS( "Clipboard.SetText"; "Hello World" ) ]
Set Variable [ $r ; Value: MBS( "Clipboard.AddText"; "{\"text\": \"Hello World\", \"RowID\": 123 }"; "JSON" ) ]
# query
Set Variable [ $$json ; Value: MBS( "Clipboard.GetText"; "JSON") ]
Set Variable [ $$text ; Value: MBS( "Clipboard.GetText"; "") ]

Add both xml and text to clipbord:

# put script step on clipboard
Set Variable [ $r ; Value: MBS( "Clipboard.SetFileMakerData"; "auto"; "<fmxmlsnippet type=\"FMObjectList\"><Step enable=\"True\" id=\"62\" name=\"Pause/Resume Script\"><PauseTime value=\"ForDuration\"></PauseTime><Calculation><![CDATA[1]]></Calculation></Step></fmxmlsnippet>" ) ]
# and a text for Text editors
Set Variable [ $r ; Value: MBS( "Clipboard.AddText"; "Pause/Resume Script [ Duration (seconds): 1 ]"; "" ) ]
# now you can paste in code editor

See also

Release notes

Blog Entries

This function is free to use.

Created 15th April 2023, last changed 16th April 2023


ClearRegistration - Clipboard.Clear