Clipboard retrieve/paste command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Clipboard retrieve/paste command
# 1  
Old 06-21-2012
Clipboard retrieve/paste command

I mainly use Max/MSP for my audio programming, but today I am working on a project that requires the use of shell. Is it possible to do this?
Retrieve the contents of the clipboard.
Send a keystroke to an application without loosing focus, for example, I want to initiate a paste command (with command-v) to an application.
I'm on Mac OS X 10.5.8.
Thanks!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Solaris 10 : command to copy text to the clipboard.

I'm searching a command to copy text to the clipboard. xclip and xsel are commands which are available on several kind Linux and Unix OS, but is unfortenuately not available on solaris 10. REF : xpt.sourceforge.net/techdocs/nix/x/general/xwin12-Xclipboard/single/ clipboard of openSolaris is... (9 Replies)
Discussion started by: droopy4u
9 Replies

2. Shell Programming and Scripting

Can't paste in command line.

Hello. I've made a simple script which asks the user to input a hash and then runs a command that replaces the variable $hash with what the user inserted. The ting is that when the programm asks for input I can't paste anything there..! any clues?? :wall: (8 Replies)
Discussion started by: louboulos
8 Replies

3. UNIX for Dummies Questions & Answers

Copying a command/line to clipboard

hi all, i am newbie to Unix scripting.. I am writing a script which will have a line of commands, which needs to be copied to clipboard. Any ideas welcome.. Usage:: I am using the script in this way, The script will have some lines (like below) export TERM=xterm; cd test_env; TMOUT=0 ... (1 Reply)
Discussion started by: gkarthik.gk
1 Replies

4. UNIX for Advanced & Expert Users

Xterm configuration : how to copy/paste in the CLIPBOARD

Hi, I can paste what is in the CLIPBOARD but I can't get xterm copy. and in fact I think I'm not able to select well with the cursor (I don't want to use the mouse)... here is my ~/.Xresources file : XTerm*highlightSelection: true XTerm*VT100.translations: #override \n\ None ... (5 Replies)
Discussion started by: xib.be
5 Replies

5. UNIX for Dummies Questions & Answers

paste command

input1 15 150 input2 x 10 100 input3 y 20 200 z 34 44 cmd paste -d "\t" input1 input2 input3 >>output output (1 Reply)
Discussion started by: repinementer
1 Replies

6. Shell Programming and Scripting

command paste with variables

Hi. I have an interesting problem and i couldn't find out the solution. I have two variables in which there are a lot of lines finished by \n. I would like to concatenate this two variables into one in this format: var1var2 var1var2 . . . I could do this simply by command paste but it works... (32 Replies)
Discussion started by: samos
32 Replies

7. Shell Programming and Scripting

how to retrieve only the Use% value from df command

when I do a df -k for a particular mount i get the result like this Filesystem 1K-blocks Used Available Use% Mounted on /dev/ 4128448 3527496 391240 91% / I need to extract the value 91 from this and use it in my script in an if condition. How will i do it Please advice. (8 Replies)
Discussion started by: codeman007
8 Replies

8. UNIX for Dummies Questions & Answers

How to retrieve the typed command

For examples, I have typed 4 commands in the command prompt: ls -la rm -rf /home/user1 du -k /home find . -name "abc.out" -print And now I want to retrieve the command which begin with letter "r" (i.e. rm -rf /home/user1), what can I do? (5 Replies)
Discussion started by: laum
5 Replies

9. UNIX for Advanced & Expert Users

paste command

I wonder if any body can help me with a command i am struggling with. I have a file with around 400 lines in, in a program i have it pulls out each line at a time so that data from the line can be cross referenced with another file. If it finds a match it pulls out a ocde from the second file, this... (5 Replies)
Discussion started by: mariner
5 Replies
Login or Register to Ask a Question
clipboard(n)						       Tk Built-In Commands						      clipboard(n)

__________________________________________________________________________________________________________________________________________________

NAME
clipboard - Manipulate Tk clipboard SYNOPSIS
clipboard option ?arg arg ...? _________________________________________________________________ DESCRIPTION
This command provides a Tcl interface to the Tk clipboard, which stores data for later retrieval using the selection mechanism (via the -selection CLIPBOARD option). In order to copy data into the clipboard, clipboard clear must be called, followed by a sequence of one or more calls to clipboard append. To ensure that the clipboard is updated atomically, all appends should be completed before returning to the event loop. The first argument to clipboard determines the format of the rest of the arguments and the behavior of the command. The following forms are currently supported: clipboard clear ?-displayof window? Claims ownership of the clipboard on window's display and removes any previous contents. Window defaults to ".". Returns an empty string. clipboard append ?-displayof window? ?-format format? ?-type type? ?--? data Appends data to the clipboard on window's display in the form given by type with the representation given by format and claims own- ership of the clipboard on window's display. Type specifies the form in which the selection is to be returned (the desired "target" for conversion, in ICCCM terminology), and should be an atom name such as STRING or FILE_NAME; see the Inter-Client Communication Conventions Manual for complete details. Type defaults to STRING. The format argument specifies the representation that should be used to transmit the selection to the requester (the second column of Table 2 of the ICCCM), and defaults to STRING. If format is STRING, the selection is transmitted as 8-bit ASCII characters. If format is ATOM, then the data is divided into fields separated by white space; each field is converted to its atom value, and the 32-bit atom value is transmitted instead of the atom name. For any other format, data is divided into fields separated by white space and each field is converted to a 32-bit integer; an array of integers is transmitted to the selection requester. Note that strings passed to clipboard append are concatenated before conversion, so the caller must take care to ensure appropriate spacing across string boundaries. All items appended to the clipboard with the same type must have the same format. The format argument is needed only for compatibility with clipboard requesters that do not use Tk. If the Tk toolkit is being used to retrieve the CLIPBOARD selection then the value is converted back to a string at the requesting end, so format is irrelevant. A -- argument may be specified to mark the end of options: the next argument will always be used as data. This feature may be con- venient if, for example, data starts with a -. clipboard get ?-displayof window? ?-type type? Retrieve data from the clipboard on window's display. Window defaults to ".". Type specifies the form in which the data is to be returned and should be an atom name such as STRING or FILE_NAME. Type defaults to STRING. This command is equivalent to "selection get -selection CLIPBOARD". Note that on modern X11 systems, the most useful type to retrieve for transferred strings is not STRING, but rather UTF8_STRING. EXAMPLES
Get the current contents of the clipboard. if {[catch {clipboard get} contents]} { # There were no clipboard contents at all } Set the clipboard to contain a fixed string. clipboard clear clipboard append "some fixed string" You can put custom data into the clipboard by using a custom -type option. This is not necessarily portable, but can be very useful. The method of passing Tcl scripts this way is effective, but should be mixed with safe interpreters in production code. # This is a very simple canvas serializer; # it produces a script that recreates the item(s) when executed proc getItemConfig {canvas tag} { set script {} foreach item [$canvas find withtag $tag] { append script {$canvas create } [$canvas type $item] append script { } [$canvas coords $item] { } foreach config [$canvas itemconf $item] { lassign $config name - - - value append script [list $name $value] { } } append script } return [string trim $script] } # Set up a binding on a canvas to cut and paste an item set c [canvas .c] pack $c $c create text 150 30 -text "cut and paste me" bind $c <<Cut>> { clipboard clear clipboard append -type TkCanvasItem [getItemConfig %W current] # Delete because this is cut, not copy. %W delete current } bind $c <<Paste>> { catch { set canvas %W eval [clipboard get -type TkCanvasItem] } } SEE ALSO
interp(n), selection(n) KEYWORDS
clear, format, clipboard, append, selection, type Tk 8.4 clipboard(n)