MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: New Mathematica menu: New Package

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56944] Re: [mg56917] Re: New Mathematica menu: New Package
  • From: Zhengji Li <zhengji.li at gmail.com>
  • Date: Wed, 11 May 2005 05:23:58 -0400 (EDT)
  • References: <d5mvks$e3d$1@smc.vnet.net> <200505100742.DAA08315@smc.vnet.net>
  • Reply-to: Zhengji Li <zhengji.li at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Actually, I have already suffered a lot from modifying MenuSetup.tr.

What I want to do is just a singal click, and get a new file of which
the first cell is the "InitializationCell" and in "InputForm".

On 5/10/05, David Bailey <dave at remove_thisdbailey.co.uk> wrote:
> Zhengji Li wrote:
> > Dear all,
> >     It seems to be very difficult to create/save a package file from
> > the menu of mathematica. But mathematica's main menu is
> > "programmable", so I would like
> > to insert a menu item which can create a .m file. Anyone need this ?
> >
> >    Modify Menusetup.tr in the directory (on Windows, I do not know what it is on
> > Mac, etc) $InstallDir\SystemFiles\FrontEnd\TextResources\Windows:
> >
> > Menu["Mathematica",
> > {
> >       Menu["&File",
> >       {       Menu["&New",
> >               {
> >                   Item["&Notebook", "New", MenuKey["n", Modifiers->{Control}]],
> >                   Item["&Package", KernelExecute[
> >                     NotebookWrite[NotebookCreate[WindowTitle -> "Untitled.m"],
> >                             Cell["(* Title: *)\n\n(* Author: *)\n\n(*
> > Content: *)\n\n(* Keywords: *)\n\n(* Version:
> > 0.1*)\n\nBeginPackage[\"...`\"];\n\nBegin[\"`Private\"];\n\n\n\nEnd[];\nEndPackage[]",
> >                              "Input",
> >                              PageWidth->Infinity,
> >                                 InitializationCell->True,
> >                                 ShowSpecialCharacters->False,
> >                                 FormatType->InputForm
> >                                                        ]
> >                                                ]
> >                                        ], MenuEvaluator->Automatic
> >                   ]
> >               }],
> >              ..... other File menu items
> >
> >    The magic here is to "MenuEvaluator->Automatic" to let the kernel
> > execute the command.
> >
> >    Best regards.
> >
> I too like to extend the menu system, however you don't need to go to
> such trouble to create packages - just set the package up in a notebook
> with the relevant cells marked as 'Initialization cells' and use the
> AutoGeneratedPackage option.
> 
> Anyone modifying the menusetup.tr file should be careful to close
> Mathematica and take a copy of the file first. Mathematica only reads
> this file as it starts up, and  if it finds an error, it just gives up
> with a pretty un-informative message - so beware!
> 
> 
> David Bailey
> http://www.dbaileyconsultancy.co.uk
> 
>


  • Prev by Date: Re: Math5.0 frustrated Compatibility Problem
  • Next by Date: Re: Math5.0 frustrated Compatibility Problem
  • Previous by thread: Re: New Mathematica menu: New Package
  • Next by thread: Re: New Mathematica menu: New Package