Archive for the ‘scripting’ Category

James Talmage’s Great Illustrator Scripts

Wednesday, February 25th, 2009

[Editor’s note: James has some great scripts that bring Freehand functionality into Illustrator. Ones I like are a better “replace with symbol” script than mine or John’s. Another draws legend boxes for each color used in the artwork. Two others add the ability to deselect paths that were only partially selected, or to select the unselected portions of paths is awesome. Thanks John vdH!]

Republished from James Talmage’s site.
View all of Jame’s scripts.

You’re a graphics person, right? Conventional wisdom says you’re a decidedly right-brained person. You use Illustrator to draw things, not to mess with cryptic code.

Maybe. But even if you’re the kind of Illustrator user who steers away from rulers, snaps, and numerically-entered values, and instead dives right for the Paintbrush, Symbol Sprayer, and Warp Tool, you still use Illustrator to get graphic things done and to use its features and commands. Scripting enhances both of those things.

Automation
Let’s face it: Repetition gets old, fast. It’s long been said that necessity is the mother of invention. I tend to think most cool inventions are the offspring of that cranky old couple, Laziness and Boredom. Some of the scripts in this collection arose from the shamelessly selfish desire to end the repetitious tedium of certain tasks.

But isn’t automation what Illustrator Actions are for? Well, yes. But Illustrator’s Actions Palette lets you create mere “macros.” With Actions, you can record and play back a series of most operations that you would normally perform by using the tools and commands that are directly accessible in Illustrator’s user interface. But scripts allow you to do more.

New Functionality
If little Invention was borne of daddy Laziness and mommy Boredom, he’s also been at least baby-sat by cousin Curiousity. Many of the scripts shared here were self-inflicted experiments, inspired by comments, complaints, and double-dog-dares in the Illustrator User-to-User Forums where I often hang out for recreation.

Scripting can enable you poke around a bit “under the hood” of Illustrator’s user interface, and manipulate many things from which the normal interface isolates you. For example, did you know that…

  • An Illustrator file has an internal list referred to as the “inkList” which determines the color separation plates?
  • A path can be designated closed or open, regardless of whether the whole path or just a part of it is selected?
  • You don’t have to settle for merely defining an ellipse in terms of the height and width settings of the Ellipse Tool’s dialog; you can define it like a technical illustrator often wants to: in terms of size and angle?

So it’s about more than merely automating repetitive tasks. It’s also about doing things which can’t be done with the normal feature set. Scripting effectively lets you add your own new “features” to Illustrator. All it takes is an ulterior motive, a little experimentation, and a bit of creativity. See? You don’t have to turn off the right side of your brain, after all.

Which Scripts of James’ Nathaniel Recommends:

  • Cleanup Scripts (zip | html)
  • JET_FixRegColorFromFH.jsx
    When opening a FreeHand file, Illustrator fails to assign AI’s [Registration] swatch to paths and text having FreeHand’s Registration swatch. Instead, it imports FH’s Registration swatch as a process swatch.
  • JET_RemoveSegmentsShorterThan.jsx
    Reduces the number of anchorpoints on selected paths, according to a minimum specified by the user. Removes from each selected PathItem, segments shorter than the measure entered by the user. Useful for certain types of path simplification and cleanup chores, as in imported DXF files.
  • JET_RemoveShortSegment.jsx
    General path simplification. Allows the user to specify the minimum number of segments to be retained. This script removes the shortest segment from each selected PathItem that has more than the number of segments entered by the user.
  • JET_RemoveShortSegmentsUntil.jsx
    General path simplification. Allows the user to specify the number of segments to be left for each path. This script repeatedly removes the shortest segment from each selected PathItem until the number of segments is no more than the number entered by the user.
  • Draw Scripts (zip | html)
  • JET_Centroid.jsx
    Finds the centroid (center of gravity) of selected triangles and other straight-sided multigon paths and draws a user-defined circle at that location. To use, make a selection which includes normal paths. Then call the script.

  • JET_ReplaceWithSymbol.jsx
    Replaces selected items with Instances of a Symbol from the Symbols Panel. The desired Symbol can be defined by its index number (its number of occurrance in the Panel). The document must have at least one Symbol defined. Simply select some objects. Then run the script.


  • Label Scripts (zip | html)
    JET_X_SwatchesLegend.jsx
    Creates a series of labeled squares at the bottom left of the Artboard, each filled with one Swatch in the Swatches Panel. Useful for adding a “color legend” on pages of identity graphics, to specify colors. For each named Swatch in the Swatches Palette, the script draws a square filled with the Swatch color, and creates beside it a PointType object containing the name of the Swatch. The text labels are filled with Registration color. A prompt allows the user to set the desired size of the squares (in points). The label text size is 1/3 the size of the squares.

  • Path Scripts (zip | html)
    (Various scripts)
    The batch of scripts I call PathScripts are those which manipulate paths, anchorPoints and handles. Most of these are my cheezy workarounds for features which FreeHand users take for granted, but which Illustrator still lacks.
  • Selection Scripts (zip | html)
    It’s no secret that Illustrator’s path/point/handle selection interface is just about the most cumbersome of all. In fact, only the most devoted Illustrator-only users deny it. These scripts are mere workarounds for some of the awkward selection chores; but they do make life a little easier in a few common situations.
  • JET_SelectSameLength2ptPaths.jsx
    Selects paths in the document which have 2 points and are the same length as the currently selected 2-point path. Purpose: to select the individual dashes of dashed lines which commonly come into AI from converted DXF files. Useful for removing “hidden lines” from such files.

  • JET_MarqueeDeselectPartials.jsx
    RWhen making marquee selections in Illustrator, all objects crossed or touched by the selection marquee are selected. Unlike most other drawing programs, Illustrator does not provide a Contact Sensitive toggle setting to cause marquee selection to select only objects which are fully enclosed by the marquee. This script deselects paths in the current selection which are only partially selected.

  • JET_MarqueeSelectRest.jsx
    When making marquee selections in Illustrator, all objects crossed or touched by the selection marquee are selected. Unlike most other drawing programs, Illustrator does not provide a Contact Sensitive toggle setting to cause marquee selection to select only objects which are fully enclosed by the marquee. This script finds paths in the current selection which are only partially selected, and adds their unselected points to the selection.
  • Transform scripts (zip | html)
    Transformation Scripts is another category for which I anticipate hacking out additional scripts. One can imagine a wide range of re-iterative transformation routines, applicable at the object/path/points/handles level beyond those already in Illustrtor’s feature set.
  • JET_StackTopToBottom.jsx
    This script re-stacks the selected objects according to their vertical positions, top to bottom. After running the script, the selected object positioned highest on the page will be rearmost; the one lowest on the page will be frontmost. This is mainly useful for correcting the stacking order of individual PointType textFrames in imported CAD drawings before concatenating them into a single AreaType textFrame, as in a parts list.

Illustrator Script: Gimmie an Eye! (Wundes)

Tuesday, February 24th, 2009

John Wundes has a new script for Adobe Illustrator called “Gimmie an Eye!”, useful for the artists among us. It creates eyes with random characteristics for color, shape, and iris. Each eye is grouped, and both eyes are grouped together. No manual settings are available. If you don’t like the output, just make another set until you find something you like. 

Download JSX. View HTML page for script.

To install and use new scripts you have to:

  • Quit Illustrator
  • Copy the files into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

Illustrator Script: SelectPathsBySize.jsx (Wundes)

Monday, February 23rd, 2009

[Editor’s note: John Wundes has updated his Select Path Items script for Illustrator. It still needs the ability to select by number of path points (see my script for that: page, download), but it has other very nice options, including a GUI exposing all the settings. Good job, John!]

Republished from John Wundes’s js4ai blog (1 | 2).

Download script (download page).

Updates in version 3

  • Rebuilt the processing engine from scratch, and now it is much faster.
  • There is also now a floating text field that updates as pathItems are processed in real time. This way, it still may take a long time to finish, but at least you have a very rudimentary progress bar to let you know that the system hasn’t taken a dump on you.
  • It also tells you when it’s complete, and reports the total processing time.

Updates in version 2

  • More Selections: Rebuilt interface to select objects based on Size, Area, Width, or by Height.
  • Exact Same Size: Added “Exact” option to the “less than” and “more than” radio-buttons (Thanks to Nathaniel for that suggestion)
  • Default Selection: If one object is selected, starts threshold at that size. (Also thanks to Nathaniel’s input…)
  • Added Tool Tips: If you mouse-over the dialog elements, you now get helpful tooltips. (Now I just need someone to help me translate them into other languages…)

Create Calendars Automatically in Illustrator: Version 5 (Kelso)

Tuesday, February 17th, 2009

[Editor’s note: I have updated my Calendar script to version 5. It now automatically formats the text with tab stops, date box grid, and art placeholders. Tooltips help explain the options and the script will automatically create a document if one is not open. Over 25 new features, updates, and bug fixes. Screenshots and native Illustrator template files included at end of post.

Magicien de calendrier, Kalender-Zauberer, Mago del calendario, 日历巫术师, カレンダーの魔法使い, Чудодей календара.]

ai cs3 logoI was asked recently if I could automate the creation of calendars in Adobe Illustrator. It turns out there are a couple script for accomplishing this in InDesign (best is from sselberg), but only pre-built templates for Illustrator. If you need a new year, you’d have to search for a new template, which is lame. New script to the rescue! Thanks go to Joyce for this suggestion.

NOTE: The script is free to download and use. There is no license fee for publication of calendars based on the script. I reserve the right in the future to start charging a fee for the script. But this version is free.

Download version 5 of Calendar Script (100 k).

To install new scripts you need to:

  • Download the binary file using “Save as”. The file contents look like gobly-gook.
  • Quit Illustrator
  • Copy the file into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator, you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

NOTE: You will need version CS3 or CS4 of Illustrator. If you have CS or CS2, get a trial version of CS4 from Adobe. Also see posts about version 3 and version 4 of the Calendar script.

New features and bug fixes in version 5:

NEW FEATUES

  1. NEW: Tab stops supported!!! Date numbers are automatically spaced over the correct distance :) Big thanks go to N at Adobe Developer Support on this one.
  2. NEW No longer requires an open document, one will be created for you in the right page size if necessary.
  3. NEW “help” tooltips on all the wizard options (thanks John!). Tooltips are only in English now, other languages in future update.
  4. NEW Wall calendar style has grid of date boxes.
  5. NEW Wall, page, and compact calendar styles has art hole (for placement of photos, etc).
  6. NEW starting month and starting and ending year now relative to the current date (was always Jan 2009)
  7. NEW if 12-up type calendar selected, the current year’s 12 months are auto enabled
  8. NEW mini Page calendar type for making the mini calendars
  9. NEW mini Wall calendar type for making the mini calendars
  10. NEW Tabloid calendar type for big wall calendars for each month with big big numbers
  11. NEW mini Tabloid calendar type for making the mini calendars
  12. NEW Compact calendar type for calendars that are suitable for newspaper

UPDATED FEATURES

  1. UPDATE: Existing templates updated with tab stops, text sizes, other formatting
  2. UPDATE mini “business card” type calendar uses underlining for the day header, removed trailing tab, and adjusted gutter width
  3. UPDATE Page calendar type now based on letter page size with big numbers
  4. UPDATE Wall calendar type now based on tabloid page size with date numbers in corner of grid cells
  5. UPDATE Wall calendar type now auto-shrinks the text frame if a month has a short number of weeks.

BUG FIXES

  1. BUG FIX: Month lines now auto-centered
  2. BUG FIX: Leading space in month name line removed
  3. BUG FIX: Fail on selected text if it is point or path. Now creates new text frame at the same location.
  4. BUG FIX: Changing calendar size / style now sets the right day header abbreviation (shorten, letter)
  5. BUG FIX: Change of character format from month header to date in calendar page function (remove underlining)
  6. BUG: Page 12-up style calendar now the same size and style as a Page 1-up but with extra months (had been compact like). Expand or link the text frame to see additional content that is hidden at first.
  7. BUG: Abbreviation for “Jan” lacked the . period (thanks John).
  8. BUG: Custom language did not show the current settings for English (default) to edit. Now it does (disabled Holiday for now).
  9. BUG: Canceling “custom language” dialog now returns to previous language preset, not English.
  10. BUG: Enabling multi-month calendars via check box now works after choosing a single month calendar preset.
Version 6 Plans
  • Holidays and lunar phases are still not supported. Please stay tuned for version 6. What types of holidays do you want to see supported? Do you need iCal support?
  • Add multi-lingual tooltips. Refine translation of main interface for supported languages.
  • Automatically create and position the before-month and after-month mini-calendars.
  • Timeline calendar format (three linear, sequential rows of year, month, and dates)
  • Sports (game day) calendar format with support via “holiday” interface
  • Option to flowing multiple month calendars to new text blocks (via artboards in CS4+)
  • Orientation option when dealing with multiple months text blocks (horizontal, vertical, grid)
  • Any other suggestions? I’ll take a couple month breather and then return to this project.
Screenshots showing English, German, and Chinese interfaces. Also the custom language settings dialog.

There are several sizes of calendars:

  1. Tabloid calendar with larger date numbers grid (no boxes) on tabloid size 2/3rds of page.
  2. Tabloid mini 1 month that fits below the main calendar in 1/6th of tabloid size page (prior month, next month).
  3. Wall calendar with smaller dates in box grid (boxed dates) on tabloid size half-page with room for half page of art (horizontal / landscape 8.5 x 11 inch page).
  4. Wall mini 1 month calendar that fits in a date square in a wall calendar (prior month, next month).
  5. Page calendar, larger dates fill grid (no boxes) on 8.5 x 11 inch page.
  6. Page calendar, larger dates fill grid (no boxes) – 12 months at a time option.
  7. Page mini calendar, calendar that fits in a date square in a page calendar (prior month, next month).
  8. Compact calendar, 12 months small enough to fit on a single 8.5 x 11 inch page with artwork.
  9. Mini calendar, 12 months small enough to fit on a business card.

All calendars are Multi-lingual. Languages include English, Deutsch, Español, Français, 中文, 日本語, русский язык, and custom. This affects both the graphical dialog for creating the calendars and the month and day words in the calendar itself when it is created.

NOTE: While character and paragraph styles are created for each style of calendar (you can have multiple calendar types in one document), there is an error with Adobe Illustrator where you do not actually see this script-created styles until you either (a) save the document – thanks JC, or (b) switch back to the document from another (open or new) document.

SCREENSHOTS
Tabloid (1 month on tabloid 11 x 17 inch page – with artwork)
Download native Illustrator file.
Wall (1 month on tabloid 11 x 17 inch page – horizontal 8.5 x 11 inch – with artwork)
Download native Illustrator file.
Page (1 month on portrait 8.5 x 11 inch page with artwork)
Download native Illustrator file.
Compact (12 months on portrait 8.5 x 11 inch page)
Download native Illustrator file.
Mini (business card)
Download native Illustrator file.

Tutorial for ArcGIS web mapping API for JavaScript (ESRI)

Tuesday, February 10th, 2009

[Editor's note: This tutorial from ESRI walks the user thru a short project using the new ArcGIS web mapping API for Javascript.]

Republished from ESRI ArcUser magazine.
Winter 2009. View code snippits.
List of sites using ArcGIS API for Javascript.

Add a Map to a Web Page in Three Simple Steps
Getting started with the ArcGIS API for JavaScript

By Bronwyn Agrios, ESRI Education Services

Giving a wider audience access to your geographic data and maps through a Web page is almost effortless when you embed a simple map into a new or existing Web site using the ArcGIS API for JavaScript. Although ArcGIS Server provides many methods for adding a spatial component to a Web site, the ArcGIS API for JavaScript lets you use ArcGIS Server services to build lightweight, high-performance, pure browser GIS applications. ArcGIS API for JavaScript is hosted by ESRI and free to use. There are no licensing or service fees associated with its use.

Use the ArcGIS API for JavaScript to embed a map or perform a task such as querying spatial data in your Web application. The best way to get started using the ArcGIS API for JavaScript is to use the application samples and services provided by ESRI. If needed, you can modify these samples to include your own services and custom functionality in a mashup that incorporates multiple layers and functionalities in a single application.

This tutorial shows you how to access ArcGIS Online services through a simple Web application created using the JavaScript API. ArcGIS Online is a family of Web-based services and resources that lets you populate applications with base data hosted by ESRI and access tasks. In this exercise, you will be using only spatial content from ArcGIS Online in a JavaScript API application so you won’t even need to set up and maintain an installation of ArcGIS Server.

The Flagler County Property Appraiser Web site used the ArcGIS API for JavaScript to create an application that helps citizens find real property information including land, building, assessed, and taxable values.

Step 1

Embedding a Hosted Map in a New Web Page To create a Web page that contains an embedded map from a hosted service, you do not need to have ArcGIS Server installed or possess mapmaking or programming skills.

The following section will help familiarize you with the ArcGIS API for JavaScript samples on the ArcGIS Server Resource Center that you can use to create this page.

ArcGIS Resource Centers provide you with one-stop access to help resources, blogs, communities, and other information on all ArcGIS products. Navigate to resources.esri.com and select ArcGIS Server or any other
products. To learn more about the available samples, you will make a local copy of some sample JavaScript code and make it available through a new hosted Web page using the following steps:

(more…)

Bullet Graphs for Not-to-Exceed Targets (Visual Business Intelligence)

Wednesday, January 28th, 2009

[Editor’s note: The bullet graph is an alternative to circular gauges and meters commonly used on dashboards with a graph that provides a richer data display using less space. The bullet graph consists of five primary components: text label, a quantitative scale along a single linear axis, the featured measure usually as dark black line, one or two comparative or target measures of performance (optional), and from two to five ranges shown as background fills along the quantitative scale to declare the featured measure’s qualitative state like bad, satisfactory, and good (optional) All use the same quantitative scale. Flex component with source code from Agile UI. Google charts version from Dealer Diagnostics. Excel version from Excel User.

Correction on 2010 March 18: The image of the dashboard above is from Robert Allison. Get the SAS/Graph code to create the dashboard.]

Republished from Visual Business Intelligence. Monday, February 4th, 2008 at 2:54 pm.

Image above from Stephen Few’s Information Dashboard Design book seen here.
View PDF format Bullet Graph Design Specification from Stephen Few on the bullet graph. He’s got other useful information design writeups in his Library.

When I designed the bullet graph back in 2005, I did it to solve a particular problem related to dashboard displays. The graphical widgets that software vendors were providing to display single measures, such as year-to-date sales revenue, consisted mostly of circular gauges and meters, which suffered from several problems. Most of them conveyed too little information, did so unclearly, and wasted a great deal of space on the screen. The bullet graph was my alternative, which was designed to convey a rich story clearly in little space.

Bullet Graph Description

Since their introduction, a number of dashboard vendors now support bullet graphs, either as a predesigned display widget or as a display that can be easily constructed using their design tools. Now that bullet graphs are being used a great deal, they are being put to the test, and best practices are being developed to use them effectively.

One challenge that is faced by any graphical display of a single measure compared to another, such as a target, is the fact that the target usually functions as a point that the measure should reach or exceed, such as a sales target, but sometimes it functions as a point that the measure should stay below, such as an expense target. Here is a series of bullet graphs, which are designed in the typical manner:

Bullet Graphs for Not-to-Exceed Targets 1.jpg

Two of the measures—expenses and defects—work the opposite of the others in that the goal is to remain below the target. The background fill colors on these bullet graphs, which vary from dark gray to indicate “poor performance” through to the lightest gray to indicate “good performance,” are arranged from poor on the left to good on the right for revenue, average order size, and new customers, but in reverse for expenses and defects. The reversed sequence serves as a visual cue that expenses and defects should remain below the target. This cue, however, is not strong. It would be useful if something that stood out more signaled this difference.

We might be tempted to replace the varying intensities of a single color—in this case varying intensities of gray—with distinct hues, to make the reversal of the qualitative scale more apparent, such as by using the traditional traffic light colors that are so popular on dashboards.

Bullet Graphs for Not-to-Exceed Targets 2.jpg

This does cause expenses and defects to more clearly stand out as different from the other measures, but at what cost? Even if we ignore the fact that most people who are colorblind (10% of males and 1% of females) cannot distinguish green and red, we are still left with an overuse of color that makes the dashboard appear cluttered and visually overwhelming, as well as a dramatically weakened ability to use color to draw viewers’ eyes to particular areas that need attention. Is there a better way to make certain bullet graphs look different without introducing other more troubling problems?

Here’s a suggestion: not only reverse the sequence of the qualitative scale, but also the direction of the quantitative scale. Using expenses as an example, the quantitative scale could run from 0 at the right of the bullet graph with values increasing leftwards. The bar that encodes the expense measure would then also run from the right edge of the bullet graph leftwards. The bar running from right to left serves as a stronger visual cue that the target works differently, as you can see below:

Bullet Graphs for Not-to-Exceed Targets 3.jpg

Although it is not conventional for a quantitative scale to run from right to left, except in the case of negative values, this is easy to read and the unconventionality actually causes it to pop out more clearly. In fact, expenses and manufacturing defects are measures that we can easily think of as negative values (for example, expenses reduce profit and defects reduce manufacturing productivity).

I would like to encourage all the vendors out there that support bullet graphs to support this functionality and for those who use them to take advantage of it.

Take care,

Signature

Create Calendars Automatically in Illustrator: Version 4 (Kelso)

Thursday, January 8th, 2009

[Editor’s note: I have updated my Calendar script to version 5 on 17 February 2009. Magicien de calendrier, Kalender-Zauberer, Mago del calendario, 日历巫术师, カレンダーの魔法使い, Чудодей календара.

Get version 5 and read more about the changes and see new templates.

WARNING! The information below is OUT OF DATE! ]

[Editor's note: I have updated my Calendar script to version 4. I now support multiple languages and fixed a few bugs. New video helps users set up tabs and change character styles. Magicien de calendrier, Kalender-Zauberer, Mago del calendario, 日历巫术师, カレンダーの魔法使い, Чудодей календара.]

ai cs3 logoI was asked recently if I could automate the creation of calendars in Adobe Illustrator. It turns out there are a couple script for accomplishing this in InDesign (best is from sselberg), but only pre-built templates for Illustrator. If you need a new year, you’d have to search for a new template, which is lame. New script to the rescue! Thanks go to Joyce for this suggestion.

Download version 4 of Calendar Script (71k).

NOTE: You will need version CS3 or CS4 of Illustrator. If you have CS or CS2, get a trial version of CS4 from Adobe. Also see post about version 3 of the Calendar script.

New features and bug fixes in version 4:

  1. Multi-lingual: Languages added for English, Deutsch, Español, Français, 中文, 日本語’, русский язык, and custom. This affects both the graphical dialog for creating the calendars and the month and day words in the calendar itself when it is created.
  2. No longer need to have text frame selected, one will be created for you. If a text frame IS selected, it will be used.
  3. Added ability to easily stylize weekend (Saturday and Sunday) dates numbers (eg gray or red).
  4. Equal row spacing between months checkbox now works.
  5. Buttons for current year and month now work.
I’m waiting on Adobe to let me know how to do the tab stops. In the meantime I’ve created a better video showing how to set these manually yourself (below) and change the character styles after the calendar is created.
Holidays and lunar phases are still not supported. Please stay tuned for version 5.
Screenshots showing English, German, and Chinese interfaces. Also the custom language settings dialog.

To install new scripts you need to:

  • Quit Illustrator
  • Copy the files into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

There are several sizes of calendars:

  1. Wall calendar with smaller dates in box grid (you add the boxes).
  2. Wall mini 1 month calendar that fits in a date square in a wall calendar (prior month, next month).
  3. Page calendar, larger dates fill grid (no boxes).
  4. Page calendar, larger dates fill grid (no boxes) – 12 months at a time option.
  5. Mini calendar, 12 months small enough to fit on a business card.
Screenshots
Traditional wall calendar with boxed dates and mini calendars for prior and next month, room above for a photo or illustration (January 2009). You make your own grid and the two wall mini months. Download editable Illustrator file.
Page calendar where dates fill entire box (no lines). You make your own wall mini calendars. Download editable Illustrator file.
Mini 12 month calendar sized to fit on business card with all 12 months of the year (shown larger than life below). Download editable Illustrator file.

View video demonstration of script (click to play, 9.3 megs):

How to Script in Adobe Illustrator (Adobe)

Wednesday, January 7th, 2009

[Editor’s note: I get asked frequently how to get into automating Illustrator via scripting. My favorite language is JavaScript (it’s cross platform) but there is also AppleScript (Mac) and Visual Basic (PC). A listing of all my scripts is here, including my recent script for creating calendars. Adobe does a good job of getting you started with several introductory and intermediate manuals. Plus they even offer a free toolkit application for writing the JavaScripts. The new scripting guides for CS4 are up on Adobe’s site, including how to use Flash panel inside Illustrator to make more interesting graphical user interfaces (or hit testing). There’s new information on using TabStops in there over CS3 and documentation on how to script the new Artboards feature. Give it a try!]

Republished from Adobe.com.

ADOBE ILLUSTRATOR CS4 SCRIPTING

A script is a series of commands that tells Illustrator to perform one or more tasks. Adobe Illustrator CS4 supports scripts written in AppleScript, JavaScript or VBScript. Sample scripts are included in the Adobe Illustrator CS4 installer and get installed with the product. The latest available scripting documentation is provided below:

SAMPLES

Adobe Illustrator CS3 FlashPanel Sample

The FlashPanel sample for Adobe Illustrator CS3 shows how to script Illustrator from Flash using ScriptUI’s FlashPlayer control. The sample illustrates how rich user interfaces created by Flash authoring tools such as Adobe Flex Builder 2 can interact with Illustrator’s scripting object model.

Building the Data Desk: Lessons From the L.A. Times (Knight Digital Media Center)

Thursday, December 4th, 2008

[Editor’s note: Great article on how data, including GIS, maps, and Google mashups can be leveraged in news media environments from a veteran of the LA Times. Thanks Aly! (and bon voyage)]

Republished from Knight Digital Media Center (OJR). By Eric Ulken on Nov. 21, 2008.

In early 2007, when the Los Angeles Times launched its Homicide Report blog — an effort to chronicle every homicide in Los Angeles County — it was clear that there were important geographic and demographic dimensions to the information that a blog format wouldn’t fully capture. What we needed was a ChicagoCrime.org-style map that would let users focus on areas of interest to them, with filters that would enable them to “play” with the data and explore trends and patterns for themselves. Problem was, the web staff (of which I was a part) lacked the tools and the expertise to build such a thing, so the blog launched without a map. (Sound familar?)

It took several months to secure the tech resources and a couple more months to create wireframes and spec out requirements for what would become the Homicide Map, with the help of a couple of talented developers and a project manager on part-time loan from the website’s IT department. We were fortunate, of course: We actually had access to this kind of expertise, and since then we’ve hired a couple of dedicated editorial developers. I’m aware that others might not have it so good.

Last week, Robert Niles argued that news organizations should be in the business of creating “killer apps”. Put another way, there is a need to develop tools that hew to the content rather than the other way around. But creating the functionality Robert describes takes a closer connection between news thinking and tech thinking than is possible within news organizations’ traditional structures and skill sets.

In this post, I’ll try to squeeze some wisdom out of the lessons we learned in the process of assembling the Times’ Data Desk, a cross-functional team of journalists responsible for collecting, analyzing and presenting data online and in print. (Note: I left the Times earlier this month to work on some independent projects. I am writing this piece with the blessing of my former bosses there.)

Here, then, are 10 pieces of advice for those of you building or looking to build a data team in your newsroom:

  1. Find the believers: You’ll likely discover enthusiasts and experts in places you didn’t expect. In our case, teaming up with the Times’ computer-assisted reporting staff, led by Doug Smith, was a no-brainer. Doug was publishing data to the web before the website had anybody devoted to interactive projects. But besides Doug’s group, we found eager partners on the paper’s graphics staff, where, for example, GIS expert Tom Lauder had already been playing with Flash and web-based mapping tools for a while. A number of reporters were collecting data for their stories and wondering what else could be done with it. We also found people on the tech side with a good news sense who intuitively understood what we were trying to do.
  2. Get buy-in from above: For small projects, you might be able to collaborate informally with your fellow believers, but for big initiatives, you need the commitment of top editors who control the newsroom departments whose resources you’ll draw on. At the Times, a series of meetings among senior editors to chart a strategic vision for the paper gave us an opportunity to float the data desk idea. This led to plans to devote some reporting resources to gathering data and to move members of the data team into a shared space near the editorial library (see #8).
  3. Set some priorities: Your group may come from a variety of departments, but if their priorities are in alignment, disparate reporting structures might not be such a big issue. We engaged in “priority alignment” by inviting stakeholders from all the relevant departments (and their bosses) to a series of meetings with the goal of drafting a data strategy memo and setting some project priorities. (We arrived at these projects democratically by taping a big list on the wall and letting people vote by checkmark; ideas with the most checks made the cut.) Priorities will change, of course, but having some concrete goals to guide you will help.
  4. Go off the reservation: No matter how good your IT department is, their priorities are unlikely to be in sync with yours. They’re thinking big-picture product roadmaps with lots of moving pieces. Good luck fitting your database of dog names (oh yes, we did one of those) into their pipeline. Early on, database producer Ben Welsh set up a Django box at projects.latimes.com, where many of the Times’ interactive projects live. There are other great solutions besides Django, including Ruby on Rails (the framework that powers the Times’ articles and topics pages and many of the great data projects produced by The New York Times) and PHP (an inline scripting language so simple even I managed to learn it). Some people (including the L.A. Times, occasionally) are using Caspio to create and host data apps, sans programming. I am not a fan, for reasons Derek Willis sums up much better than I could, but if you have no other options, it’s better than sitting on your hands.
  5. Templatize: Don’t build it unless you can reuse it. The goal of all this is to be able to roll out projects rapidly (see #6), so you need templates, code snippets, Flash components, widgets, etc., that you can get at, customize and turn around quickly. Interactive graphics producer Sean Connelley was able to use the same county-level California map umpteen times as the basis for various election visualizations in Flash.
  6. Do breaking news: Your priority list may be full of long-term projects like school profiles and test scores, but often it’s the quick-turnaround stuff that has the biggest immediate effect. This is where a close relationship with your newsgathering staff is crucial. At the Times, assistant metro editor Megan Garvey has been overseeing the metro staff’s contributions to data projects for a few months now. When a Metrolink commuter train collided with a freight train on Sept. 12, Megan began mobilizing reporters to collect key information on the victims while Ben adapted an earlier Django project (templatizing in action!) to create a database of fatalities, complete with reader comments. Metro staffers updated the database via Django’s easy-to-use admin interface. (We’ve also used Google Spreadsheets for drama-free collaborative data entry.) … Update 11/29/2008: I was remiss in not pointing out Ben’s earlier post on this topic.
  7. Develop new skills: Disclaimer: I know neither Django nor Flash, so I’m kind of a hypocrite here. I’m a lucky hypocrite, though, because I got to work with guys who dream in ActionScript and Python. If you don’t have access to a Sean or a Ben — and I realize few newsrooms have the budget to hire tech gurus right now — then train and nurture your enthusiasts. IRE runs occasional Django boot camps, and there are a number of good online tutorials, including Jeff Croft’s explanation of Django for non-programmers. Here’s a nice primer on data visualization with Flash.
  8. Cohabitate (but marriage is optional): This may be less of an issue in smaller newsrooms, but in large organizations, collaboration can suffer when teams are split among several floors (or cities). The constituent parts of the Times’ Data Desk — print and web graphics, the computer-assisted reporting team and the interactive projects team — have only been in the same place for a couple months, but the benefits to innovation and efficiency are already clear. For one thing, being in brainstorming distance of all the people you might want to bounce ideas off of is ideal, especially in breaking news situations. Also, once we had everybody in the same place, our onetime goal of unifying the reporting structure became less important. The interactive folks still report to latimes.com managing editor Daniel Gaines, and the computer-assisted reporting people continue to report to metro editor David Lauter. The graphics folks still report to their respective bosses. Yes, there are the occasional communication breakdowns and mixed messages. But there is broad agreement on the major priorities and regular conversation on needs and goals.
  9. Integrate: Don’t let your projects dangle out there with a big ugly search box as their only point of entry. Weave them into the fabric of your site. We were inspired by the efforts of a number of newspapers — in particular the Indianapolis Star and its Gannett siblings — to make data projects a central goal of their newsgathering operations. But we wanted to do more than publish data for data’s sake. We wanted it to have context and depth, and we didn’t want to relegate data projects to a “Data Central“-type page, something Matt Waite (of Politifact fame) memorably dubbed the “data ghetto.” (I would link to Waite’s thoughtful post, but his site unfortunately reports that it “took a dirt nap recently.”) I should note that the Times recently did fashion a data projects index of its own, but only as a secondary way in. The most important routes into data projects are still through related Times content and search engines.
  10. Give back: Understand that database and visualization projects demand substantial resources at a time when they’re in very short supply. Not everyone in your newsroom will see the benefit. Make clear the value your work brings to the organization by looking for ways to pipe the best parts (interesting slices of data, say, or novel visualizations) into your print or broadcast product. For example, some of the election visualizations the data team produced were adapted for print use, and another was used on the air by a partner TV station.

When I shared this post with Meredith Artley, latimes.com’s executive editor and my former boss, she pointed to the formation about a year ago of the interactive projects team within the web staff (Ben, Sean and me; Meredith dubbed us the “cool kids,” a name that stuck):

“For me, the big step was creating the cool kids team — actually forming a unit with a mandate to experiment and collaborate with everyone in the building with the sole intention of creating innovative, interactive projects.”

And maybe that should have been my first piece of advice: Before you can build a data team, you need one or more techie-journalists dedicated full-time to executing online the great ideas they’ll dream up.

What else did I miss? If you’ve been through this process (or are going through it, or are about to), I hope you’ll take a minute to share your insights.

jquery.timepickr.js (Haineault)

Wednesday, December 3rd, 2008

[Editor’s note: Graceful javascript GUI for setting time based on intuitive method. Thanks Peter!]

Republished from Haineault.com. Get the source code there.

Experimental code !

This is my humble attempt to enhance web time picking.

For the moment I’d call it a toy project, it might stay in experimental state evitam eternam.. I just wanted to see if I could create a better time picker.
I’ve seen lots of time pickers styles and approaches, but none seems to focus on user experience accross many platforms and beautiful degradation.

So I’ve determined a set of goals to achieve a better time picker.

Goals

  • Unobtrusive
  • Graceful degradation
  • Using maximum 2 clicks
  • Intuitive keyboard navigation
  • Be touch friendly (think iphone, tablet pc, etc..)

Demo

View video of GUI in action
(or click on image below, javascript embed don’t work in WordPress, sorry)

Basic usage

$(function(){
    $('#test-1').timepickr({handle: '#trigger-test'});
});

Options

Options Default Description
handle false handle is a dom element which will open the menu upon click
hours true display hours
minutes true display minutes
seconds false display seconds
range24 $.range(0, 24) available hours to pick in 24 format (0, 23)
range12 $.range(0, 12) available hours to pick in 12 format (1, 12)
rangeMin ['00', '15', '30', '45'] available minutes to pick
rangeSec ['00', '15', '30', '45'] available minutes to pick
apm ['am', 'pm'] AM/PM labels
convention 12 hour convention (12 or 24)
val false Initial value
dropslide object dropslide options

Tested browsers

  • Mozilla Firefox 2 (Windows)
  • Mozilla Firefox 3.0.3 (Linux)
  • Mozilla Firefox 3.0.3 (Windows)
  • Epiphany Web Browser 2.22.2 (Linux)
  • Safari 3.1.2 (Windows)
  • Microsoft Internet Explorer 6
  • Microsoft Internet Explorer 7

Todo

  • Internationalization (different time formats, ex 24h)
  • Custom positioning (left, center, right)
  • am/pm mouse follow should be optional
  • Fix remaining behavior bugs
  • Test browser compatibility
  • Make animation more smooth
  • Make all options work
  • Support for seconds
  • Allow custom handler (click clock icon = open picker)
  • keynav: esc = leave & reset
  • keynav: enter, space = commit
  • keynav: arrows = navigate
  • Labels for hour, min, sec
  • Allow custom positioning/orientation of am/pm picker
  • try to make a vertical version of it