Robust identifier for notebook objects?
- To: mathgroup at smc.vnet.net
- Subject: [mg124645] Robust identifier for notebook objects?
- From: Szabolcs <szhorvat at gmail.com>
- Date: Sat, 28 Jan 2012 06:35:08 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
Dear MathGroup members, I need to create a palette that will have an associated notebook (for logging some information). The palette needs to feel like it is part of the GUI/Front End: it must keep working uninterrupted even if the kernel is restarted (meaning I can't store permanent state in the kernel) Question: How can I verify whether the logging notebook is already open in the front end, and retrieve a handle to it? Is this best done by setting a special name to the logging notebook, and searching for a notebook with this name? A bit more practical example: How can I create a palette button that: 1. if the logging notebook does not exist yet, it creates it 2. if it does exist, it toggles its visibility 3. keeps working across kernel restarts 4. keeps working even if we close and open the palette (the palette will be installed to the Palettes menu, so it can be easily closed and reopened) The logging notebook is auto-generated, and it will never be saved to disk. (It does not need to persist across front end restarts.) Notes: * Point (4) above rules out using DynamicModule variables, even though they are owned by the front end. * It is also acceptable to persist not the logging notebook itself, but the data that it contains. I'm not sure how to make this persist through both kernel restarts and palette open/close though, so just toggling notebook visibility is easier. * Is there any way to store information for the current front end session only (maybe through $FrontEndSession)? Thank you for any replies in advance, Szabolcs -- New Mathematica site launched! http://mathematica.stackexchange.com/