Sunday, May 19, 2013

Using variables

OmniGraffle has a number of variables related to objects, canvases, and the current document that come in handy. (This is a fixed set of variables; you cannot define your own variables.)

The menu Edit > Insert Variable exposes a number of them, but there are others.


Here I'll describe how they are used and call out some of the more useful ones.

You can put a string representing a variable in any object's text. The variable string is shown when you are editing the object's text, and the variable's value is shown otherwise. Variables are formatted with a preceding "<%" and a terminating "%>". For example, the variable for the current date is entered as <%Date%>.

You can mix variables with static text, and include multiple variables in a single object's text. For example, "Page <%#%> of <%TotalPages%>" could display as "Page 3 of 58" in, say, a page footer. Or, you might put "Last modified by <%Modifier%> on <%ModificationDate%>" on your title page.

In addition to those found in the Insert Variable menu, there are many that are associated with the Data Inspector. Each value here can display in an object's text using a variable.


The field variables above are:
  • <%Copyright%>
  • <%Version%>
  • <%Subject%> 
  • <%Description%>
  • <%Comments%>

The variables associated with the drop-down at the bottom are listed below. If multiple values are entered for a drop-down category, these are delimited by carriage returns when displayed.
  • <%Authors%>
  • <%Organizations%>
  • <%Languages%>
  • <%Keywords%>
  • <%Projects%>

Variables useful in headers, footers, and title pages

If you don't have document templates set up for your standard work documents, you should go about doing that: it's a time saver. In such a template, you can have your predefined headers, footers, and title pages populated with variables, so you never have to touch them; instead, let the variables do the work.
  • <%Canvas%> (name of the current canvas): This serves handily as the page title.
  • <%#%> (current page number)
  • <%TotalPages%> (total number of pages) 
  • <%Subject%> (document title): That's how I use it, anyway. Define in the Data Inspector.
  • <%Projects%> (project code name(s)): Typically, a single value. Define in the Data Inspector.
  • <%Organizations%> (your organization(s) or team name(s)): Typically, a single value. Define in the Data Inspector.
  • <%Creator%> (document author): I assume Omnigraffle is picking this value up from OSX, or perhaps the product registration.
  • <%Authors%> (document author(s)): Typically a single value, and usually you. Define in the Data Inspector if you don't like the value <%Creator%> is returning.
  • <%Version%> (the document version): Define in the Data Inspector.
  • <%ModificationDate%> (the date of your most recent save): I just use this as the document date, rather than showing both creation and modification dates.

Variables useful within the document

<%Length%> can be assigned only to a line label, and suddenly that line becomes useful for documenting other objects' dimensions, since the variable updates as you change the line length:


<%Width%> and <%Height%> are useful for document the dimensions of an object. Put
"<%Width%> by <%Height%>" in an object's text to automatically document your wireframes: 



1 comment:

  1. I would like to set the variables %ModificationDate% and %Creator% to universal time format; i.e., yy.mm.dd rather than their present US time format of mon da yr.

    How can I reset these? I know how to create a new variable that behaves properly but it would be preferable to reset these variables once and for all. Thanks

    ReplyDelete