Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Creating & Using Multiple Clipboards

nchernoff

Administrator
May
42
2
Staff member
Migrated From JP Software Wiki

Windows Clipboard


4NT has built-in support for the Windows clipboard. The CLIP: name and the @CLIP[] function are used to access the Windows clipboard. You can copy a block of text to the clipboard using this syntax:

Code:
type foo.txt > clip:

You can access the lines in the clipboard in a FOR loop like this:

Code:
for %f in (@clip:) do echo %f

or

Code:
echo %@clip[2]

Private Clipboards

The only problem with the Windows clipboard is that there is just one. Once you overwrite it with something new, you've lost whatever was there previously. Using directory aliases and a simple function definition you can easily support multiple private clipboards.

Directory aliases were introduced with 4NT v8 (I think). They provide a shorthand way to reference a specific directory.

Code:
alias clp:=c:\temp
function clp=`%@line[clp:%1,%2]`

I can now name my clipboards clp:1, clp:2, clp:3, etc.

Code:
type foo.txt > clp:1

for %f in (@clp:1) do echo %f

echo %@clp[1,2]
Note that these "clipboards" are private to 4NT and won't be usable by other Windows applications. They are just disk files however. In the case of clp:1, the file is named c:\temp\1. So, you could access the file from a windows app.
 

Similar threads

Back
Top