CLIPBOARD$
From QB64 Wiki
The _CLIPBOARD$ function returns the current Operating System's clipboard contents as a STRING.
- result$ = _CLIPBOARD$
Description:
- Text returned can contain the entire contents of a copied file or web page.
- The string returned can also contain formatting like CRLF (CHR$(13) + CHR$(10)) end of line characters.
- The clipboard can be used to copy, paste and communicate between running programs.
Example: Passing a string value between two running programs no matter where they are located.
Program1:
PRINT "Start Program2 to read your text entries! Empty entry quits!" _CLIPBOARD$ = "Entry program started!" 'set clipboard initially DO LINE INPUT "Enter some text to send to other program: ", text$ IF text$ = "" THEN EXIT DO _CLIPBOARD$ = text$ LOOP SYSTEM
Program2:
PRINT "Enter text in Program1 and this program will read it. Esc key quits!" DO text$ = _CLIPBOARD$ 'function returns clipboard contents IF LEN(text$) THEN PRINT text$ _CLIPBOARD$ = "" 'clear clipboard after a read END IF LOOP UNTIL INKEY$ = CHR$(27) END
- Explanation: Compile and run both programs at once to see the interaction. You could also run them on different paths.
See also: