CLIPBOARD$: Difference between revisions
Jump to navigation
Jump to search
Wiki Pages
Main Page with Articles and Tutorials
QB64 specific keywords (alphabetical)
Original QBasic keywords (alphabetical)
QB64 OpenGL keywords (alphabetical)
Keywords by Usage
Got a question about something?
Frequently Asked Questions about QB64
QB64 Phoenix Edition Community Forum
Links to other QBasic Sites:
Pete's QBasic Forum
Pete's QBasic Downloads
m (Protected "CLIPBOARD$" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))) |
No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_CLIPBOARD$}} | {{DISPLAYTITLE:_CLIPBOARD$}} | ||
The | The '''_CLIPBOARD$''' statement copies the [[STRING]] value into the system clipboard. | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:{{Parameter| | : [[_CLIPBOARD$]] = {{Parameter|string_expression$}} | ||
{{PageDescription}} | {{PageDescription}} | ||
* | * {{Parameter|string_expression$}} is the string value to be sent to the clipboard. | ||
* The string | * The string value will replace everything previously in the clipboard. | ||
* Assemble long text into one string variable value before using this statement. | |||
* Add CHR$(13) + CHR$(10) CRLF characters to move to a new clipboard line. | |||
* When copying text files, end line CRLF characters 13 and 10 do not have to be added. | |||
* Numerical values can be converted to strings using [[STR$]], [[_MK$]], [[MKI$]], [[MKL$]], [[MKS$]], [[MKD$]], [[_BIN$]], [[HEX$]] or [[OCT$]]. | |||
* The clipboard can be used to copy, paste and communicate between running programs. | * The clipboard can be used to copy, paste and communicate between running programs. | ||
{{PageExamples}} | {{PageExamples}} | ||
;Example:Set 2 lines of text in the clipboard using a carriage return to end text lines | |||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl| | {{Cl|DIM}} CrLf {{Cl|AS}} {{Cl|STRING}} * {{Text|2|#F580B1}} {{Text|<nowiki>'define as 2 byte STRING</nowiki>|#919191}} | ||
CrLf = {{Cl|CHR$}}({{Text|13|#F580B1}}) + {{Cl|CHR$}}({{Text|10|#F580B1}}) {{Text|<nowiki>'carriage return & line feed</nowiki>|#919191}} | |||
{{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"This is line 1"</nowiki>|#FFB100}} + CrLf + {{Text|<nowiki>"This is line 2"</nowiki>|#FFB100}} | |||
{{Cl|PRINT}} {{Cl|_CLIPBOARD$ (function)|_CLIPBOARD$}} {{Text|<nowiki>'display what is in the clipboard</nowiki>|#919191}} | |||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStart}} | |||
This is line 1 | |||
This is line 2 | |||
{{OutputEnd}} | |||
{{ | |||
{{ | |||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[_CLIPBOARD$ ( | * [https://qb64phoenix.com/forum/showthread.php?tid=1238 Featured in our "Keyword of the Day" series] | ||
* [[_CLIPBOARD$ (function)]] | |||
* [[_CLIPBOARDIMAGE (function)]], [[_CLIPBOARDIMAGE]] (statement) | * [[_CLIPBOARDIMAGE (function)]], [[_CLIPBOARDIMAGE]] (statement) | ||
* [[CHR$]], [[ASCII]] (code table) | |||
{{ | {{PageReferences}} |
Latest revision as of 12:27, 19 November 2024
The _CLIPBOARD$ statement copies the STRING value into the system clipboard.
Syntax
- _CLIPBOARD$ = string_expression$
Description
- string_expression$ is the string value to be sent to the clipboard.
- The string value will replace everything previously in the clipboard.
- Assemble long text into one string variable value before using this statement.
- Add CHR$(13) + CHR$(10) CRLF characters to move to a new clipboard line.
- When copying text files, end line CRLF characters 13 and 10 do not have to be added.
- Numerical values can be converted to strings using STR$, _MK$, MKI$, MKL$, MKS$, MKD$, _BIN$, HEX$ or OCT$.
- The clipboard can be used to copy, paste and communicate between running programs.
Examples
- Example
- Set 2 lines of text in the clipboard using a carriage return to end text lines
DIM CrLf AS STRING * 2 'define as 2 byte STRING CrLf = CHR$(13) + CHR$(10) 'carriage return & line feed _CLIPBOARD$ = "This is line 1" + CrLf + "This is line 2" PRINT _CLIPBOARD$ 'display what is in the clipboard |
This is line 1 This is line 2 |
See also
- Featured in our "Keyword of the Day" series
- _CLIPBOARD$ (function)
- _CLIPBOARDIMAGE (function), _CLIPBOARDIMAGE (statement)
- CHR$, ASCII (code table)