RE: Re: Re: Using Mathgroup Effectively -- cutting and pasting expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg35325] RE: [mg34943] Re: [mg34910] Re: Using Mathgroup Effectively -- cutting and pasting expressions
- From: "DrBob" <majort at cox-internet.com>
- Date: Mon, 8 Jul 2002 03:17:54 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
I had been using the palette described below under 4.1. I tried to recreate it under 4.2 and found that I can't! After evaluating the code, the "Copy As InputForm" button appears on the screen, but I can't save it. I remember that being easy to do under 4.1. If I close the palette, Mathematica doesn't ask if I want to save it. If I select "Save As..." Mathematica assumes I'm trying to save something else. If I close everything but the palette, there's no "Save" or "Save As" options under File. Am I missing something, or is this really bizarre? Bobby Treat -----Original Message----- From: Omega Consulting [mailto:omega_consulting at yahoo.com] To: mathgroup at smc.vnet.net Subject: [mg35325] [mg34943] Re: [mg34910] Re: Using Mathgroup Effectively -- cutting and pasting expressions At 01:15 AM 6/12/2002, Dave Collins wrote: >Of course, if this were a carefully formatted notebook, I'd need to discard >the changes after conversion and copying. Given all the other options >under the "Edit|Copy as" menu, it would be nice if Wolfram would add >"Copy as input form", perhaps with the option of making it the default. > >-- Dave Collins Here's code for a palette that does just that. It takes a selection and passes it through Cell>Convert To>InputForm and then does Edit>Copy As>Plain Text (all without altering the original selection). NotebookPut@ Notebook[{Cell[BoxData@ButtonBox["Copy As InputForm", ButtonFunction :> Module[{cpy, cpynb, evalnb}, cpy = NotebookRead@InputNotebook[]; If[cpy === {}, Return[]]; cpynb = NotebookCreate[Visible -> False]; NotebookWrite[cpynb, cpy]; SelectionMove[cpynb, All, Notebook]; FrontEndExecute[{FrontEndToken[cpynb, "SelectionConvert", "InputForm"]}]; evalnb = NotebookPut@ Notebook[ Map[Cell[#, "Input"] &, { BoxData@RowBox@{"cpynb", "=", ToBoxes@cpynb}, "FrontEndExecute[{FrontEndToken[cpynb, \"CopySpecial\",\"PlainText\"]}]", "NotebookClose[cpynb]", "NotebookClose[EvaluationNotebook[]]"}], Visible -> False]; SelectionMove[evalnb, All, Notebook]; SelectionEvaluate@evalnb; ], ButtonEvaluator -> Automatic, Active -> True], "Text"]}, WindowClickSelect -> False, ShowCellBracket -> False, WindowSize -> {150, Fit}, WindowElements -> {}, WindowFrame -> "Palette", WindowFrameElements -> {"CloseBox"}, ClosingAutoSave -> True ] -------------------------------------------------------------- Omega Consulting "The final answer to your Mathematica needs" Spend less time searching and more time finding. http://www.wz.com/internet/Mathematica.html