CLIPBOARD$ (function): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 16: Line 16:
;Example 1:Passing a string value between two running programs no matter where they are located.
;Example 1:Passing a string value between two running programs no matter where they are located.
{{CodeStart}}
{{CodeStart}}
'=================
{{Text|<nowiki>'=================</nowiki>|#919191}}
'=== Program 1 ===
{{Text|<nowiki>'=== Program 1 ===</nowiki>|#919191}}
'=================
{{Text|<nowiki>'=================</nowiki>|#919191}}


{{Cl|PRINT}} "Start Program2 to read your text entries! Empty entry quits!"
{{Cl|PRINT}} {{Text|<nowiki>"Start Program2 to read your text entries! Empty entry quits!"</nowiki>|#FFB100}}
{{Cl|_CLIPBOARD$}} = "Entry program started!"           'set clipboard initially
{{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"Entry program started!"</nowiki>|#FFB100}} {{Text|<nowiki>'set clipboard initially</nowiki>|#919191}}


DO
{{Cl|DO}}
  {{Cl|LINE INPUT}} "Enter some text to send to other program: ", text$
    {{Cl|LINE INPUT}} {{Text|<nowiki>"Enter some text to send to other program: "</nowiki>|#FFB100}}, text$
  {{Cl|IF...THEN|IF}} text$ = "" {{Cl|THEN}} {{Cl|EXIT DO}}
    {{Cl|IF}} text$ = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Cl|THEN}} {{Cl|EXIT DO}}
  {{Cl|_CLIPBOARD$}} = text$
    {{Cl|_CLIPBOARD$}} = text$
{{Cl|LOOP}}
{{Cl|LOOP}}


Line 32: Line 32:
{{CodeEnd}}
{{CodeEnd}}
{{CodeStart}}
{{CodeStart}}
'=================
{{Text|<nowiki>'=================</nowiki>|#919191}}
'=== Program 2 ===
{{Text|<nowiki>'=== Program 2 ===</nowiki>|#919191}}
'=================
{{Text|<nowiki>'=================</nowiki>|#919191}}


{{Cl|PRINT}} "Enter text in Program1 and this program will read it. Esc key quits!"
{{Cl|PRINT}} {{Text|<nowiki>"Enter text in Program1 and this program will read it. Esc key quits!"</nowiki>|#FFB100}}


DO: {{Cl|_LIMIT}} 100
{{Cl|DO}}: {{Cl|_LIMIT}} {{Text|100|#F580B1}}
  text$ = {{Cl|_CLIPBOARD$ (function)|CLIPBOARD$}}                      'function returns clipboard contents
    text$ = CLIPBOARD$ {{Text|<nowiki>'function returns clipboard contents</nowiki>|#919191}}
  {{Cl|IF...THEN|IF}} {{Cl|LEN}}(text$) {{Cl|THEN}}
    {{Cl|IF}} {{Cl|LEN}}(text$) {{Cl|THEN}}
    {{Cl|PRINT}} text$
        {{Cl|PRINT}} text$
    {{Cl|_CLIPBOARD$}} = ""                       'clear clipboard after a read
        {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>""</nowiki>|#FFB100}} {{Text|<nowiki>'clear clipboard after a read</nowiki>|#919191}}
  {{Cl|END IF}}
    {{Cl|END IF}}
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} = {{Cl|CHR$}}(27)
{{Cl|DO...LOOP|LOOP UNTIL}} {{Cl|INKEY$}} = {{Cl|CHR$}}({{Text|27|#F580B1}})


{{Cl|END}}
{{Cl|END}}
Line 54: Line 54:
;Example 2:A minimized program that pops up when Ctrl + Shift is entered anytime in '''Windows''' and adds clipboard text to be Pasted:
;Example 2:A minimized program that pops up when Ctrl + Shift is entered anytime in '''Windows''' and adds clipboard text to be Pasted:
{{CodeStart}}
{{CodeStart}}
'"ClippyBoard" program uses GetKeyState Win API to monitor a specific key combination.
{{Text|<nowiki>'"ClippyBoard" program uses GetKeyState Win API to monitor a specific key combination.</nowiki>|#919191}}
'This demo will maximize the window and focus on program when Shift+A is pressed.
{{Text|<nowiki>'This demo will maximize the window and focus on program when Shift+A is pressed.</nowiki>|#919191}}


{{Cl|DECLARE DYNAMIC LIBRARY}} "user32"
{{Cl|DECLARE}} {{Cl|DYNAMIC}} {{Cl|LIBRARY}} {{Text|<nowiki>"user32"</nowiki>|#FFB100}}
  {{Cl|FUNCTION}} FindWindowA%& ({{Cl|BYVAL}} ClassName {{Cl|AS}} {{Cl|_OFFSET}}, WindowName$) 'find process handle by title
    {{Cl|FUNCTION}} {{Text|FindWindowA%&|#55FF55}} ({{Cl|BYVAL}} ClassName {{Cl|AS}} {{Cl|_OFFSET (function)|_OFFSET}}, WindowName$) {{Text|<nowiki>'find process handle by title</nowiki>|#919191}}
  {{Cl|FUNCTION}} GetKeyState% ({{Cl|BYVAL}} nVirtKey {{Cl|AS}} {{Cl|LONG}}) 'Windows virtual key presses
    {{Cl|FUNCTION}} {{Text|GetKeyState%|#55FF55}} ({{Cl|BYVAL}} nVirtKey {{Cl|AS}} {{Cl|LONG}}) {{Text|<nowiki>'Windows virtual key presses</nowiki>|#919191}}
  {{Cl|FUNCTION}} ShowWindow& ({{Cl|BYVAL}} hwnd {{Cl|AS}} {{Cl|_OFFSET}}, {{Cl|BYVAL}} nCmdShow {{Cl|AS}} {{Cl|LONG}}) 'maximize process
    {{Cl|FUNCTION}} {{Text|ShowWindow&|#55FF55}} ({{Cl|BYVAL}} hwnd {{Cl|AS}} {{Cl|_OFFSET (function)|_OFFSET}}, {{Cl|BYVAL}} nCmdShow {{Cl|AS}} {{Cl|LONG}}) {{Text|<nowiki>'maximize process</nowiki>|#919191}}
  {{Cl|FUNCTION}} GetForegroundWindow%& 'find currently focused process handle
    {{Cl|FUNCTION}} {{Text|GetForegroundWindow%&|#55FF55}} {{Text|<nowiki>'find currently focused process handle</nowiki>|#919191}}
  {{Cl|FUNCTION}} SetForegroundWindow& ({{Cl|BYVAL}} hwnd {{Cl|AS}} {{Cl|_OFFSET}}) 'set foreground window process(focus)
    {{Cl|FUNCTION}} {{Text|SetForegroundWindow&|#55FF55}} ({{Cl|BYVAL}} hwnd {{Cl|AS}} {{Cl|_OFFSET (function)|_OFFSET}}) {{Text|<nowiki>'set foreground window process(focus)</nowiki>|#919191}}
{{Cl|DECLARE LIBRARY|END DECLARE}}
{{Cl|END DECLARE}}


title$ = "Clippy Clipboard (Ctrl+Shift)" 'title of program window
title$ = {{Text|<nowiki>"Clippy Clipboard (Ctrl+Shift)"</nowiki>|#FFB100}} {{Text|<nowiki>'title of program window</nowiki>|#919191}}
{{Cl|_TITLE}} title$ 'set program title
{{Cl|_TITLE}} title$ {{Text|<nowiki>'set program title</nowiki>|#919191}}
hwnd%& = FindWindowA(0, title$ + {{Cl|CHR$}}(0)) 'find this program's process handle
hwnd%& = {{Text|FindWindowA|#55FF55}}({{Text|0|#F580B1}}, title$ + {{Cl|CHR$}}({{Text|0|#F580B1}})) {{Text|<nowiki>'find this program's process handle</nowiki>|#919191}}


{{Cl|SCREEN}} 13
{{Cl|SCREEN}} {{Text|13|#F580B1}}
{{Cl|_SCREENMOVE}} {{Cl|_SCREENMOVE|_MIDDLE}}
{{Cl|_SCREENMOVE}} {{Cl|_MIDDLE}}


{{Cl|COLOR}} 10: {{Cl|PRINT}}
{{Cl|COLOR}} {{Text|10|#F580B1}}: {{Cl|PRINT}}
{{Cl|PRINT}} " Press Ctrl+Shift to see clipboard menu."
{{Cl|PRINT}} {{Text|<nowiki>" Press Ctrl+Shift to see clipboard menu."</nowiki>|#FFB100}}


{{Cl|_DELAY}} 4
{{Cl|_DELAY}} {{Text|4|#F580B1}}
x& = ShowWindow&(hwnd%&, 2) 'minimize
x& = {{Text|ShowWindow&|#55FF55}}(hwnd%&, {{Text|2|#F580B1}}) {{Text|<nowiki>'minimize</nowiki>|#919191}}


{{Cl|DO...LOOP|DO}}: {{Cl|_LIMIT}} 30 'save CPU usage while waiting for key press
{{Cl|DO}}: {{Cl|_LIMIT}} {{Text|30|#F580B1}} {{Text|<nowiki>'save CPU usage while waiting for key press</nowiki>|#919191}}


  {{Cl|IF...THEN|IF}} GetKeyState(16) < 0 {{Cl|AND (boolean)|AND}} GetKeyState(17) < 0 {{Cl|THEN}} '<==== Shift+A
    {{Cl|IF}} {{Text|GetKeyState|#55FF55}}({{Text|16|#F580B1}}) < {{Text|0|#F580B1}} {{Cl|AND (boolean)|AND}} {{Text|GetKeyState|#55FF55}}({{Text|17|#F580B1}}) < {{Text|0|#F580B1}} {{Cl|THEN}} {{Text|<nowiki>'<==== Shift+A</nowiki>|#919191}}
    FGwin%& = GetForegroundWindow%& 'get current process in focus
        FGwin%& = {{Text|GetForegroundWindow%&|#55FF55}} {{Text|<nowiki>'get current process in focus</nowiki>|#919191}}
    y& = ShowWindow&(hwnd%&, 1) 'maximize minimized program
        y& = {{Text|ShowWindow&|#55FF55}}(hwnd%&, {{Text|1|#F580B1}}) {{Text|<nowiki>'maximize minimized program</nowiki>|#919191}}


    {{Cl|IF...THEN|IF}} FGwin%& <> hwnd%& {{Cl|THEN}} z& = SetForegroundWindow&(hwnd%&) 'set focus when necessary
        {{Cl|IF}} FGwin%& <> hwnd%& {{Cl|THEN}} z& = {{Text|SetForegroundWindow&|#55FF55}}(hwnd%&) {{Text|<nowiki>'set focus when necessary</nowiki>|#919191}}
    {{Cl|_DELAY}} 1
        {{Cl|_DELAY}} {{Text|1|#F580B1}}
    GetKey
        {{Text|GetKey|#55FF55}}
    x& = ShowWindow&(hwnd%&, 2) 'minimize after letter key entry
        x& = {{Text|ShowWindow&|#55FF55}}(hwnd%&, {{Text|2|#F580B1}}) {{Text|<nowiki>'minimize after letter key entry</nowiki>|#919191}}
    {{Cl|COLOR}} 10: {{Cl|PRINT}}
        {{Cl|COLOR}} {{Text|10|#F580B1}}: {{Cl|PRINT}}
    {{Cl|PRINT}} " Press Ctrl+Shift to see clipboard menu."
        {{Cl|PRINT}} {{Text|<nowiki>" Press Ctrl+Shift to see clipboard menu."</nowiki>|#FFB100}}
  {{Cl|END IF}}
    {{Cl|END IF}}
{{Cl|LOOP}}
{{Cl|LOOP}}




{{Cl|SUB}} GetKey
{{Cl|SUB}} {{Text|GetKey|#55FF55}}
{{Cl|CLS}}
    {{Cl|CLS}}
{{Cl|COLOR}} 12: {{Cl|PRINT}}: {{Cl|PRINT}} {{Cl|_CLIPBOARD$ (function)|CLIPBOARD$}}
    {{Cl|COLOR}} {{Text|12|#F580B1}}: {{Cl|PRINT}}: {{Cl|PRINT}} {{Cl|_CLIPBOARD$ (function)|_CLIPBOARD$}}
{{Cl|DO...LOOP|DO}}: {{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} = ""
    {{Cl|DO}}: {{Cl|DO...LOOP|LOOP UNTIL}} {{Cl|INKEY$}} = {{Text|<nowiki>""</nowiki>|#FFB100}}
{{Cl|_DELAY}} 1
    {{Cl|_DELAY}} {{Text|1|#F580B1}}
{{Cl|CLS}}
    {{Cl|CLS}}
{{Cl|COLOR}} 11: {{Cl|PRINT}} "Select a letter clipboard option:"
    {{Cl|COLOR}} {{Text|11|#F580B1}}: {{Cl|PRINT}} {{Text|<nowiki>"Select a letter clipboard option:"</nowiki>|#FFB100}}
{{Cl|PRINT}}
    {{Cl|PRINT}}
{{Cl|PRINT}} "A = Address"
    {{Cl|PRINT}} {{Text|<nowiki>"A = Address"</nowiki>|#FFB100}}
{{Cl|PRINT}} "C = Cell phone"
    {{Cl|PRINT}} {{Text|<nowiki>"C = Cell phone"</nowiki>|#FFB100}}
{{Cl|PRINT}} "E = Email"
    {{Cl|PRINT}} {{Text|<nowiki>"E = Email"</nowiki>|#FFB100}}
{{Cl|PRINT}} "F = First Name"
    {{Cl|PRINT}} {{Text|<nowiki>"F = First Name"</nowiki>|#FFB100}}
{{Cl|PRINT}} "H = Home phone"
    {{Cl|PRINT}} {{Text|<nowiki>"H = Home phone"</nowiki>|#FFB100}}
{{Cl|PRINT}} "L = Last Name"
    {{Cl|PRINT}} {{Text|<nowiki>"L = Last Name"</nowiki>|#FFB100}}
{{Cl|PRINT}} "N = Name"
    {{Cl|PRINT}} {{Text|<nowiki>"N = Name"</nowiki>|#FFB100}}
{{Cl|PRINT}} "M = MAC address"
    {{Cl|PRINT}} {{Text|<nowiki>"M = MAC address"</nowiki>|#FFB100}}
{{Cl|PRINT}} "P = Password"
    {{Cl|PRINT}} {{Text|<nowiki>"P = Password"</nowiki>|#FFB100}}
{{Cl|PRINT}} "W = Work name"
    {{Cl|PRINT}} {{Text|<nowiki>"W = Work name"</nowiki>|#FFB100}}
{{Cl|PRINT}} "X = QUIT!"
    {{Cl|PRINT}} {{Text|<nowiki>"X = QUIT!"</nowiki>|#FFB100}}
{{Cl|PRINT}} "Z = Zip code"
    {{Cl|PRINT}} {{Text|<nowiki>"Z = Zip code"</nowiki>|#FFB100}}
{{Cl|COLOR}} 14: {{Cl|PRINT}}
    {{Cl|COLOR}} {{Text|14|#F580B1}}: {{Cl|PRINT}}
{{Cl|PRINT}} "Another letter will skip or X = {{Cl|EXIT}}!"
    {{Cl|PRINT}} {{Text|<nowiki>"Another letter will skip or X = EXIT!"</nowiki>|#FFB100}}


K$ = {{Cl|UCASE$}}({{Cl|INPUT$}}(1))
    K$ = {{Cl|UCASE$}}({{Cl|INPUT$}}({{Text|1|#F580B1}}))


{{Cl|SELECT CASE}} K$ 'The following text should be your personal user info:
    {{Cl|SELECT CASE}} K$ {{Text|<nowiki>'The following text should be your personal user info:</nowiki>|#919191}}
  {{Cl|CASE}} "A": {{Cl|_CLIPBOARD$}} = "my address"
        {{Cl|CASE}} {{Text|<nowiki>"A"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"my address"</nowiki>|#FFB100}}
  {{Cl|CASE}} "C": {{Cl|_CLIPBOARD$}} = "cell number"
        {{Cl|CASE}} {{Text|<nowiki>"C"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"cell number"</nowiki>|#FFB100}}
  {{Cl|CASE}} "E": {{Cl|_CLIPBOARD$}} = "myemail"
        {{Cl|CASE}} {{Text|<nowiki>"E"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"myemail"</nowiki>|#FFB100}}
  {{Cl|CASE}} "F": {{Cl|_CLIPBOARD$}} = "formal name"
        {{Cl|CASE}} {{Text|<nowiki>"F"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"formal name"</nowiki>|#FFB100}}
  {{Cl|CASE}} "H": {{Cl|_CLIPBOARD$}} = "home number"
        {{Cl|CASE}} {{Text|<nowiki>"H"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"home number"</nowiki>|#FFB100}}
  {{Cl|CASE}} "L": {{Cl|_CLIPBOARD$}} = "lastname"
        {{Cl|CASE}} {{Text|<nowiki>"L"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"lastname"</nowiki>|#FFB100}}
  {{Cl|CASE}} "M": {{Cl|_CLIPBOARD$}} = "modempassword"
        {{Cl|CASE}} {{Text|<nowiki>"M"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"modempassword"</nowiki>|#FFB100}}
  {{Cl|CASE}} "N": {{Cl|_CLIPBOARD$}} = "name"
        {{Cl|CASE}} {{Text|<nowiki>"N"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"name"</nowiki>|#FFB100}}
  {{Cl|CASE}} "P": {{Cl|_CLIPBOARD$}} = "password"
        {{Cl|CASE}} {{Text|<nowiki>"P"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"password"</nowiki>|#FFB100}}
  {{Cl|CASE}} "X": {{Cl|END}}
        {{Cl|CASE}} {{Text|<nowiki>"X"</nowiki>|#FFB100}}: {{Cl|END}}
  {{Cl|CASE}} "Z": {{Cl|_CLIPBOARD$}} = "zipcode"
        {{Cl|CASE}} {{Text|<nowiki>"Z"</nowiki>|#FFB100}}: {{Cl|_CLIPBOARD$}} = {{Text|<nowiki>"zipcode"</nowiki>|#FFB100}}
{{Cl|END SELECT}}
    {{Cl|END SELECT}}
{{Cl|CLS}}
    {{Cl|CLS}}
{{Cl|PRINT}}
    {{Cl|PRINT}}
{{Cl|PRINT}}
    {{Cl|PRINT}}
{{Cl|COLOR}} 14: {{Cl|PRINT}} {{Cl|_CLIPBOARD$ (function)|CLIPBOARD$}}
    {{Cl|COLOR}} {{Text|14|#F580B1}}: {{Cl|PRINT}} {{Cl|_CLIPBOARD$ (function)|_CLIPBOARD$}}
{{Cl|BEEP}}
    {{Cl|BEEP}}
{{Cl|_DELAY}} 2
    {{Cl|_DELAY}} {{Text|2|#F580B1}}
{{Cl|END SUB}}
{{Cl|END SUB}}
{{CodeEnd}}
{{CodeEnd}}
Line 145: Line 145:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [https://qb64phoenix.com/forum/showthread.php?tid=1238 Featured in our "Keyword of the Day" series]
* [[_CLIPBOARD$]] (statement)
* [[_CLIPBOARD$]] (statement)
* [[_CLIPBOARDIMAGE (function)]], [[_CLIPBOARDIMAGE]] (statement)
* [[_CLIPBOARDIMAGE (function)]], [[_CLIPBOARDIMAGE]] (statement)

Latest revision as of 17:52, 25 May 2024

The _CLIPBOARD$ function returns the current Operating System's clipboard contents as a STRING.


Syntax

result$ = _CLIPBOARD$


Description

  • Text returned can contain the entire contents of a copied file or web page or text from a previous _CLIPBOARD$ statement.
  • 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.


Examples

Example 1
Passing a string value between two running programs no matter where they are located.
'=================
'=== Program 1 ===
'=================

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
'=================
'=== Program 2 ===
'=================

PRINT "Enter text in Program1 and this program will read it. Esc key quits!"

DO: _LIMIT 100
    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.

Example 2
A minimized program that pops up when Ctrl + Shift is entered anytime in Windows and adds clipboard text to be Pasted:
'"ClippyBoard" program uses GetKeyState Win API to monitor a specific key combination.
'This demo will maximize the window and focus on program when Shift+A is pressed.

DECLARE DYNAMIC LIBRARY "user32"
    FUNCTION FindWindowA%& (BYVAL ClassName AS _OFFSET, WindowName$) 'find process handle by title
    FUNCTION GetKeyState% (BYVAL nVirtKey AS LONG) 'Windows virtual key presses
    FUNCTION ShowWindow& (BYVAL hwnd AS _OFFSET, BYVAL nCmdShow AS LONG) 'maximize process
    FUNCTION GetForegroundWindow%& 'find currently focused process handle
    FUNCTION SetForegroundWindow& (BYVAL hwnd AS _OFFSET) 'set foreground window process(focus)
END DECLARE

title$ = "Clippy Clipboard (Ctrl+Shift)" 'title of program window
_TITLE title$ 'set program title
hwnd%& = FindWindowA(0, title$ + CHR$(0)) 'find this program's process handle

SCREEN 13
_SCREENMOVE _MIDDLE

COLOR 10: PRINT
PRINT " Press Ctrl+Shift to see clipboard menu."

_DELAY 4
x& = ShowWindow&(hwnd%&, 2) 'minimize

DO: _LIMIT 30 'save CPU usage while waiting for key press

    IF GetKeyState(16) < 0 AND GetKeyState(17) < 0 THEN '<==== Shift+A
        FGwin%& = GetForegroundWindow%& 'get current process in focus
        y& = ShowWindow&(hwnd%&, 1) 'maximize minimized program

        IF FGwin%& <> hwnd%& THEN z& = SetForegroundWindow&(hwnd%&) 'set focus when necessary
        _DELAY 1
        GetKey
        x& = ShowWindow&(hwnd%&, 2) 'minimize after letter key entry
        COLOR 10: PRINT
        PRINT " Press Ctrl+Shift to see clipboard menu."
    END IF
LOOP


SUB GetKey
    CLS
    COLOR 12: PRINT: PRINT _CLIPBOARD$
    DO: LOOP UNTIL INKEY$ = ""
    _DELAY 1
    CLS
    COLOR 11: PRINT "Select a letter clipboard option:"
    PRINT
    PRINT "A = Address"
    PRINT "C = Cell phone"
    PRINT "E = Email"
    PRINT "F = First Name"
    PRINT "H = Home phone"
    PRINT "L = Last Name"
    PRINT "N = Name"
    PRINT "M = MAC address"
    PRINT "P = Password"
    PRINT "W = Work name"
    PRINT "X = QUIT!"
    PRINT "Z = Zip code"
    COLOR 14: PRINT
    PRINT "Another letter will skip or X = EXIT!"

    K$ = UCASE$(INPUT$(1))

    SELECT CASE K$ 'The following text should be your personal user info:
        CASE "A": _CLIPBOARD$ = "my address"
        CASE "C": _CLIPBOARD$ = "cell number"
        CASE "E": _CLIPBOARD$ = "myemail"
        CASE "F": _CLIPBOARD$ = "formal name"
        CASE "H": _CLIPBOARD$ = "home number"
        CASE "L": _CLIPBOARD$ = "lastname"
        CASE "M": _CLIPBOARD$ = "modempassword"
        CASE "N": _CLIPBOARD$ = "name"
        CASE "P": _CLIPBOARD$ = "password"
        CASE "X": END
        CASE "Z": _CLIPBOARD$ = "zipcode"
    END SELECT
    CLS
    PRINT
    PRINT
    COLOR 14: PRINT _CLIPBOARD$
    BEEP
    _DELAY 2
END SUB
Code by Ted Weissgerber
Explanation: The program will run minimized until Ctrl + Shift is entered and will pop up to ask for a letter choice that contains the text you want in the clipboard. More letter choices can be added. Text can be pasted into a web page or entry box and the program will minimize until it is needed later. The program uses very little resources!


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link