Visio Advent Calendar
I’ve created a Visio file that’s full of all sorts of goodies. Just open the file every day from now until December 25th and you’ll get a new visual, Visio treat!
What’s Behind Door #3…
The .vsd file consists of 25 doors, with a Visio suprise behind each one! When you open the file the drawing knows which day it is and opens the appropriate doors.
Note: you may have to wait up to one minute for the doors to update, because of the way the date functionality works. This just adds to the suspense. By the time you’re back from the coffee machine, your daily treat should be waiting for you!
Here’s an example of what you should see on December 1st:
How It Works
The magic works by using the ShapeSheet, of course! In the Page’s ShapeSheet, there are a few special user-cells with the following formulas:
User.now = NOW()
User.currentMonth = MONTH(User.now)
User.currentDay = DAY(User.now)
User.day = IF(User.currentMonth<>12,0,User.currentDay)
You can see the Page’s ShapeSheet by deselecting all shapes on the page, and choosing Window > Show ShapeSheet from the menu. User.now holds the raw date information. Since the NOW() function only updates every minute, you may have to wait a bit when you open the drawing to see the latest changes.
User.currentMonth and User.currentDay parse the data from User.now, so that we can check the month and day in User.day.
Each Door shape has a custom property called: Prop.OpenDay. The shapes have the values 1 through 25 stored in this property. Another cell in the door shapes determines whether the doors are open or closed:
User.doorsClosed = ThePage!User.day
So if the Page’s day-value isÂ greater than or equal to the shape’s Prop.OpenDay, then the doors will be open, and we’ll be able to see the treat behind the doors. Each door shape is a multi-shape that contains the closed- and the open-doors. The GeometryN.NoShow cells are used to show and hide the shapes, depending on the state of User.doorsClosed.
The door shapes are on the Doors layer, andÂ some of the background arch-shapes and explanatory text are on the Backgrounds layer. These layers are locked by default, so you won’t end up accidentally selecting unimportant shapes while you’re trying to play with your newly-exposed goody-shapes.
Since using the View > Layer Properties… dialog is a pain in the butt, I’ve added quick access to viewing and locking these two layers in the Page’s context menu. Simply right-click a blank area of the page, and you’ll see the following menu:
You can quickly change the visibility and locked state of the two layers via these menu items.