Documentation |
Adobe InDesign Calendar Wizard |
Calendar Generation:
The script is able to generate a set of calendars from a start month up to and including the end month. The range of years in the drop down box are determined by the current year minus three to the current year plus ten.When generating the calendar, there are a number of useful options listed below:
The mini-calendars are hard-coded to be 0.75 inches square. This is the
smallest size I could make. In the script the variable called
miniCalendarSize sets the size. The first two numbers determine the upper
left corner, presently ("2", "2"). The last two set the bottom right
corner ("2.75", "2.75"). To make the calendar bigger, enlarge the values
of the last two numbers. Note, the table is moved after it is built, so
all that matters is the relative spacing between the two points.
When making multiple tables per page, the mini-calendars don't really make
much sense and they make the formatting look really ugly. I decided that
at four calendars per page, somebody might find it useful, but above that
no. So, I put a lockout which prevents the mini calendar from being
activated at greater than four calendars per page.
To add a new language, the script needs to be modified in two places. Towards the top is a list of langageOptions. (Do a word search for "settings.languageOptions".) Add the english name for the new language into the list in alphabetical order. The second modification is made in the "selectLangauge" subroutine at the bottom of the script. To add another language copy and paste an else/if block and modify it as needed. The english name of the language in the firt part modification to match the name of the langage in the second modification.
v. Add Work Week
If the "Include Work Weeks" checkbox is selected, the script will add a
column to the left with a number indicating the week of the year
vi. Add Non-Month Days
If the "Include Non-Month Days" checkbox is selected, the days of the
preceding and following month that are in the first or last weeks of the
month will be included.
vii. Highlight Sundays
If selected, the column of sundays will be given a distinct cell and
paragraph style. (the default color is red). If "Highlight Sundays" and
"Include Non-Month Days" are both selected, the non-month sundays will
also be given a distinct cell and paragraph style.
viii. Highlight Holidays
If selected, the dates with holidays will be given a distinct cell and
paragraph style. (the default color is red). If "Highlight Sundays"
is selected and the holiday is a sunday, the holidayDate style will be
applied.
B. Layout Options
-------------------------------------------------------
The calendars may be placed in a number of ways.
The script will try and generate the calender in a predefined text frame
if a text frame is selected or the cursor is in a text frame and the page
type is set to either 'AUTO' or 'Current Text Frame'. When generating
into the current frame, a calendar for only one month may be produced.
If a text frame is not selected, the "Auto" page type will create a new
document and add a page in either landscape or portrait mode depending
upon the setting in the dialog box. When the script generates a new page
or pages it can place 1, 2, 4, 6, 8, 9, 10, or 12 calendars per page in a
grid layout.
If the user selects "Current Document" as the page type, the script
will use the current document adding pages if necesssary. This is particularly
useful in conjunction with the custom calendar placement/sizeing to get
multiple calendars on the same page.
A custom page size may be selected by entering in the desired height
and width (numbers or a decimal only). By specifying both an height and
a width, these fields become active and will override the standard
page selection fields.
Optionally, the value of the page margins can be specified. Note -
the margin field works independanty of the height and width and can
also be used when a standard page size is selected. It was included
with the custom height and width to make the dialog box look pretty.
There are a set of four text entry boxes for specifying the size and
position of the calendar. The text entry boxes are graphically presented
for specifying the top and bottom, left and right corners of the calendar.
The script will ignore these values unless all four have numeric (and
numeric only values)
D. Calendar Decoration
-------------------------------------------------------
i. Use of Styles
The script makes extensive use of color swatches, paragraph and cell
styles to mke the final result easy to customize.
Below is a map of the styles. With a few exceptions called out below,
the styles exist as both paragraph and cell styles. Note the cell
styles will use the identically named paragraph style.
cal_base --
|
-- cal_title (used for the name of the month)
-- cal_day (used for the name of the weekday)
-- cal_date -- (used for the date of the week)
| |
| -- cal_date_splitCellSecondLine (used for the lower value when dividing a cell into two days)
-- cal_text (used for text in the cells of the text layer; see cal_textText for cell style)
-- cal_sunday (used for the date of the week in sunday cells)
-- cal_holidayDate (used for the date of the week in holiday cells)
-- cal_nonMonthSunday (used for the date of the week when a sunday not of the current month)
-- cal_nonMonthDay (used for days not in the current month)
-- cal_workWeek (used for the cells that identify the work week)
-- cal_holiday -- (used for cells in the holiday layer; see cal_holidayText for cell style)
| |
| -- cal_holidayA (The holiday 'A' style as selected by the user; no corresponding cell style)
| -- cal_holidayB (The holiday 'B' style as selected by the user; no corresponding cell style)
| -- cal_holidayC (The holiday 'C' style as selected by the user; no corresponding cell style)
| -- cal_holidayD (The holiday 'D' style as selected by the user; no corresponding cell style)
-- cal_moon (used for the cells in the moon layer; see cal_moonText for the cell style)
-- cal_pictures (used for the cells in the picture layer; see cal_picturesText for cell style)
-- cal_leftMiniCalendar (used to control the cell with the left mini-calendar)
-- cal_rightMiniCalendar (used to control the cell with the right mini-calendar)
-- calMini_base -- (base style used in the mini-calendars)
|
-- calMini_title (see cal_title)
-- calMini_day (see cal_day)
-- calMini_text (see cal_text)
-- calMini_date -- (see cal_date)
| |
| -- calMini_date_splitCellSecondLine (see cal_date_splitCellSecondLine)
-- calMini_sunday (see cal_sunday)
-- calMini_holidayDate (see cal_holidayDate)
-- calMini_nonMonthSunday (see cal_nonMonthSunday)
-- calMini_nonMonthDay (see cal_nonMonthDay)
Additional Cell Styles (i.e. ones that don't have a paragraphs style complement)
cal_base --
|
-- cal_title -- (used for the top row)
| |
| -- cal_holidayTitle
| -- cal_moonTitle
| -- cal_picturesTitle
| -- cal_textTitle
-- cal_text -- (used for all other rows)
|
-- cal_holidayText
-- cal_moonText
-- cal_picturesText
-- cal_textText
Table Styles
cal_date
cal_holiday
cal_text
cal_moons
cal_pictures
iii. Holiday A, B, C, and D Styles
When generating the calendar, there are four checkboxes next to each of
the available holiday sets. If a box is checked, the holidays defined by
that list will be placed in the cell with that style applied. The desire
is to highlight different types of holidys (for eample, Christian holidays
vs. birthdays). If two or more checkboxes are selected, the first
alphabetically will be used. (i.e., if A & B are selected, A will be
used).
ii. Colorspace
The scipt can generate color swatches in RGB, CMYK, or LAB color space.
This is controled by a drop down menu in the calender generation gui.
iii. Style Sets
When using the custom calendar placement, it is sometimes desireable
to place more than one calendar on a page and have different styles for
each of the calendars. There is therefore a dropdown menu in the custom
calendar size section for the style set. This will add the number as a
suffix to each of the styles generated by that run of the script. This
allows the generation of multiple calendars each with a distinct set
of styles to control it's appearance.
E. Multi-Layer Calendar
-------------------------------------------------------
When I started to develop and use this script, I found it a pain to create
the calendar, type in one cell, tab to the next and promptly delete the
date by typing over it. My solution was to generate the calendar as
multiple super-imposed tables putting each on their own layer. The
calendar currently supports up to 5 layers: calDates, calHolidays,
calPictures, calMoons, and calText. By default, only the text layer is
selected. This will place the table with the calendar dates on the
current layer and a second super-imposed table on a new layer called
calText.
In general the multi-layer scheme works really well; however, there is a
complication. If you want to resize any of the cells in the calendar or
the calendar itself, all three associated tables need identical
modifications. This is rather painful to do manually. The solution to these
problems are fitCalendarToFrame.js and realignCalendarTables.js.
i. Layers
a. Use Calendar Layer
If the "Use Calendar Layer" is selected, the table with the dates will be
placed on a new layer called calDates rather than the current layer.
b. Add Holidays Layer
A superimposed table will be created with holiday cell and paragraphs styles
applied and placed in the calHolidays layers. Any seleced holdays will be added
entered into the appropriate cell of the holidays table. The holidays table and
layer will be automaticaly generated if any of the holiday sets are selected.
c. Add Picture Layer
A superimposed table will be created with picture cell and paragraphs
styles applied and placed in the calPictures layers. Each cell of the
table contains an empty rectangular frame into which a picture may be
placed.
d. Add Moon Phases
A superimposed table will be created with moon cell and paragraphs
styles applied and placed in the calMoons layers. The new, full, half
waxing, and half waning moons will be placed in the appropriate cell.
The full moon will be a solid circle, the new moon a circle with no fill.
I don't completely trust the algorithm used to compute the phase of the
moon, so use with caution.
e. Add Text Layer
A superimposed table will be created with text cell and paragraphs
styles applied and placed in the calText layers. It shold be the
top layer and provides a place to enter any text desired.
ii. fitCalendarToFrame.js
fitCalendarToFrame is another javascript which is used to resize all
layers of the calendar with even cell spacing into the selected text
frame. If the work week is included, it will be given a 0.25" cell width.
caution: The adobe script engine fails to work on cells that are not
visible. This can be quite a pain when tring to reduce the size of the
calendar. Sometimes it works to run the script several times because as
cells in the top are reduced, cells in the bottom become visible.
When executed with a calendar table selected, it becomes the master. All
of the layers of the calendar will be adjusted to the selected table. If
no frame is selected, a dialog box is brought up and the user needs to
specifiy which calendar and frame will be the master. Under the hood,
each calendar table has a label such as calendarDates1, calendarHolidays1,
and calendarText1. The number is the id of the calendar. So a page with
four calendars will have calendarDates1, calendarDates2, , calendarDates3,
and calendarDates4. To figure out which calendar has which label, select
it and open up the "Scripts Labels" pallete. As an options, all may be
selected in which case every calendar in the document will be adjusted.
iii. realignCalendarTables.js
realignCalendarTablse.js is another javascript which is used to align
all of the calendar layers to a particular one. For example, if un-even
column spacing is desired one layer can be tweeked into place and this
script would push the other layers into an exact super-position of the
tweeked table.
The rules for selecting the table are the same as for the
fitCalendarToFrame.js script.
F. Holidays
-------------------------------------------------------
Version 2 of the calendar wizard had the ability to automatically place
holidays defined by a formatted list from an active text frame; In version
3 the ability has been expanded to pull multiple lists from the current
text frame, a file anywhere on the computer, or from text files in a
pre-defined directory.
If two holidays are listed for the same date, they will both be printed in
the cell seperated by a new line. If the text of a holiday exactly
appears in two of more lists, only the first occurance will be printed.
Note text of the holidays must be exact. Any differences in
spelling, capitalization, or extra space will cause the script to consider
them different and print both.
i. Holiday List Format:
The format of a holiday is either: mm-dd-yyyy:text or mm-dd:text
Note, the script does not use leading 0's, so use 1-1 for January 1st
rather than 01-01. The text could be anything. For example:
1-1:New Year's Day
1-19-2009:Martin Luther King Jr.'s Birthday
For holidays which occur on the same date every year, such as new year's
day or somebody's birthday, it's best to use the format "mm-dd". When the
holiday changes from year to year, such as Easter, use "mm-dd-yyyy".
The longer the holiday list is, the longer it will take to generate
a calender regardless if the holidays occur in that month or not.
ii. Selecting a Holiday List
When selecting a holiday list there are four styles: A, B, C, and D.
Checking any of the sytles will trigger the script to use that holiday
list. The particular style is simply there to allow the user to
differentiate between different types of holidays (for example Christian
Holidays and birthdays) The first style in alphabetical order is the one
that will be used if multiple styles are selected.
iii. Loading from the Current Frame
The list of holidays can be typed into a text frame. If the frame is selected
and a style for the "From Current Frame" is selected, the script will load
and print the holidays from that frame.
Note, when selected, the behavior of "Auto" for the page setting changes.
In this case a new document will be created so the date information is not
destroyed. If you want to replace the holiday text with the calendar, set
Page to "Current Text Frame".
iv. Loading from a Custom File
If selected, the script will bring up a dialog box in which one or more
files may be selected. They are expected to be simple text files (not
MW Word documents) that adhere to the holiday list format described above.
Notepad or some other simple text editor is a good tool to use for
generating the text files rather than a Word Processor like MS Word. If you
do use Word or OpenOffice, be sure to save the file as a simple text file (.txt)
v. Loading from Pre-Defined Files
In InDesign version above CS2, when the script runs, it will look for a
folder called "holidays" next to the script itself. In CS1 and CS2, the
folder must be at "<InDesign Install Folder>/Presets/Scripts/calendarWizard".
On the calendarWizard interface, a set of checkboxes will be created for
every file that ends in ".holidays" inside that folder. The files are
expected to conform to the holiday list specification.
=======================================================
VI. Behavior Rules
=======================================================
=======================================================
VII. To Do
=======================================================
Add a templating feature
Add a dropdown for which style set to apply (when multiple
calendars per page are used and different styles are
desired on the different calendars.)
Add the ability to add other units.
=======================================================
VIII. Bugs
=======================================================
In CS2, the upper right cell has a right border:As far as I can tell, this
is a bug in the javascript interpreter in CS an CS2. I don't know how to
fix it.
=======================================================
IX. QA Plan
=======================================================
=======================================================
X. History
=======================================================
A. Version 1.0
B. Version 2.0
C. Version 3.0
=======================================================
XI: Notes:
=======================================================
Troubleshooting:
The script causes InDesing to Hang:
The script is very slow - especially in CS and CS2. Give it plenty of time
to work and everything will start to work.
Key Features:
Calendar Generation, Page Layout, Cell Content, Styling
The script can generate a calendar
Key Use Cases:
I want a simple calendar for the year that I can print out and mark up:
Key Features
Email the Author - Scott Selberg |