clipboard
If called with one parameter passed, then the payload will be copied both as ANSI and UTF-8 text on the clipboard.
If called without any parameters, then the contents from the clipboard will be pasted into the return value, which is always
a string, even if copied numbers are recalled. The clipbaord works across the different applications in your system.
You will be notified with a brief message if the clipboard is not accessible, which is the case if the utilities (in MacOS and LINUX)
are not available.
Note: Non-text contents copied on the clipboard (e.g. files, images, graphic objects, audio) cannot be pasted back.
Indirect parameter passing is disabled.
In LINUX systems, the command 'xclip' will be used. To install it, type 'sudo apt install xclip'.
In MACOS systems, the commands 'pbcopy' and 'pbpaste' will be used. These commands should be part of MacOS standard installation.
In Windows systems, internal C/C++ operating system calls are used.
0,1
No. | Type | Description |
---|---|---|
Opt. 1 input |
valid types | Text to copy The specified contents will be copied onto the clipboard. All non-string types, e.g. numerals, will be converted to strings. |
Type | Description |
---|---|
string | Clipboard contents The text contents on the clipboard will be returned. |
echo("Copy a text to the clipboard");
clipboard("Copied text");
echo("Paste the contents in a different application, e.g. an editor, Word, Excel, etc.");
echo("You have 5 seconds to copy some other text. Sleeping for 5 seconds ...");
sleep(5);
echo("Current contents on the clipboard: ", clipboard() );
Copy a text to the clipboard
Paste the contents in a different application, e.g. an editor, Word, Excel, etc.
You have 5 seconds to copy some other text. Sleeping for 5 seconds ...
Current contents on the clipboard: Copied text