[Date Index] [Thread Index] [Author Index]
Re: Push to clipboard?
Your 4 steps can be challenged easily one by one: 1. It can be another notebook, which is already opened, and I want to put a large list after a new assigment (like "newVar = [paste value here]"), I definitely don't want to use NotebookPut, or similar constructs creating a NEW notebook object. 2. Your method suggests that the actual value of the variable is onscreen. What if it is not displayed at all? What if it is extremely long, and I didn't print it on screen, but still want to move it to another application? Yes, still I can print it in Mathematica, and then copy it, but this is obviously not the solution I'm looking for. 3. There is no current selection, only a variable, which is possibly not even printed to screen. 4. The whole point of push to clipboard is not to deal with files at all. istvan > > The clipboard is meant to be used for things that have been selected > (manually or programmatically) from some place (in Mathematica: a notebook). > Any other unconventional use would not adhere to the standard GUI > conventions (tautologically) and probably reflects a not very well > thought out interface. > > In practice: ask yourself why do you want to copy a variable (I > suppose you mean the value of a variable) to the clipboard? To paste > it somewhere else I bet. OK, where to? > 1- If it is another notebook, than you do not need the clip, just type > the variable in the other notebook. > 2- If it is another place in another program (Word, email,ect), just > select what you want , type ctrl-C and than paste it in the other > program. > 3- If you get tired to type ctrl-C you can make a button which copies > to the clip the current selection. But also in this case you need to > have something selected, so that the operation makes sense. > 4- You may also consider Saving/Exporting your variable in a specific > format ,so it can be read into another program. > > So, you see, you only need the clip in case number 2 and 3. In these > cases you need to select something which has been already calculated > and is displayed on a notebook. The selection can be done > programmatically, maybe using cell tags, but one way or the other you > must select something. > There is no direct way to place an expression on the clip, as far as I > know. > Of course, what you can always do, is a button which creates a > temporary nb, places your variable there, selects it and copies it, > than erases the nb. Perhaps the temporay nb could be more or less > invisible (I am not sure about this).