The Mathematica Journal
Volume 9, Issue 3


In This Issue
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
News Bulletins
New Resources

Download This Issue 

About the Journal
Editorial Policy
Staff and Contributors
Back Issues
Contact Information

In and Out
Edited by Paul Abbott


Q: I am using the following code to automatically close my graphics groups.

The problem is that when I only generate a single cell, OpenCloseGroup will generate a beep. How can I prevent that beep or test if GeneratedCell selected a single cell or several cells?

A: John Fultz ( answers: You can test if multiple cells have been selected using

If the length is greater than 1, then you can use the OpenCloseGroup token.

CellInformation is new to version 5 and is, in general, a very good way to test various properties of the selection without having to do a NotebookRead (which could get very expensive if you have a selection that consumes a lot of memory). CellInformation takes a notebook argument and returns a list of lists, one for each cell in the selection (only one if you have only selected a single cell or the content of a cell). Each list contains rules along with information about the object that is selected (similar to the way NotebookInformation works).

  • The first argument of CellInformation must be a NotebookObject.
  • The rules currently returned are as follows.

Of course, since this is part of the undocumented packet interface, we reserve the right to make changes to it. I hope to see this or something like it promoted to a documented function similar to NotebookInformation in the future.

About Mathematica | Download Mathematica Player
© Wolfram Media, Inc. All rights reserved.