Chapter 6. Automating and Extending Fireworks

In this chapter

Although Macromedia has done an outstanding job of balancing Fireworks’s powerful functionality with its easy-to-use interface, they also recognize that you might want to customize the way Fireworks works to meet your needs. In this chapter, we take a look at how you can use Fireworks to reduce your design time by making repetitive tasks a snap and enhancing the Fireworks interface.

The plain truth is that although a lot of graphic and web design is fun, some repetitive tasks can become mundane. A while back, I designed a website for a client who collected and sold stamps. At any given time, he had several thousand stamps in his collection and the vast majority of them were for sale. He contracted with me to create a website for him and to digitize all the stamps so his customers could view the stamp prior to purchasing it. In addition, he wanted to put a digital watermark on the image with his company logo, so that other philatelists (the fancy name for stamp collectors) wouldn’t “borrow” his images for use on their sites. This meant that for each stamp, I would have to

  • Scan the stamp.

  • Add a digital watermark to the full image.

  • Resize the stamp for display on the site.

  • Create a thumbnail of the stamp.

For a single stamp, that process would take about 10 minutes to do, which doesn’t sound like much until you start getting into the sheer size of the project. At 10 minutes each, 3,000 stamps would take 30,000 minutes or 50 hours. At $50/hour, that’s almost $2,500 dollars—a price that my client just wouldn’t be able to stomach.

Luckily, automating the process in Fireworks helped me cut the time required to complete the entire process of digitizing the images to less than 15 hours.

Automating Tasks

The first step in automating any task is to identify what the fundamental steps are. Some steps you can automate, whereas others require a level of detail or attention that might not be suitable for automation. After you identify those tasks that can be automated, Fireworks 8 offers three sets of tools that can assist you:

  • Find and Replace—. Used to search for and replace elements within a file or multiple files. You can specify an asset, such as text, color, URLs, and fonts, and find and replace that asset in a PNG file.

  • Batch Process—. Used to convert entire groups of image files into other formats or to change their color palettes. Batch Process also applies custom optimization settings to groups of files and resizes a group of files.

  • Commands—. Used to create shortcuts for commonly used features or to create a script that can perform a complex series of steps.

Find and Replace

Find and Replace comes into play when you need to make global changes to elements of source PNG files. Elements that can be modified with Find and Replace include text, fonts, colors, and URLs.

Note that changes made with Find and Replace are undoable. For example, you search your source PNG files for the word “insomnia” and replace it with the word “sleeplessness.” If you decide to change the word again, you cannot undo that change. However, you can run another Find and Replace. Run a find for the word “sleeplessness” and replace it with the original word “insomnia.”

All Find and Replace commands are handled through the Find panel. Access it by choosing Window, Find or Edit, Find and Replace (see Figure 6.1). You can also use the Ctrl+F keyboard command to open the Find panel.

All Find and Replace operations are handled through the Find panel.

Figure 6.1. All Find and Replace operations are handled through the Find panel.

From the Search pop-up menu, choose a source for the search:

  • Search Selection—. Finds and replaces elements in the currently selected objects and text.

  • Search Frame—. Finds and replaces elements in only the current frame.

  • Search Document—. Finds and replaces elements in the active document.

  • Search Files—. Finds and replaces elements across multiple files.

From the Find pop-up menu, select an attribute for which to search. The options in the panel change according to your selection.

Next, click one of the following buttons to conduct a Find and Replace operation:

  • Find—. Locates the next instance of the element.

  • Replace—. Changes a found element with the contents of the Change To option.

  • Replace All—. Finds and replaces every instance of a found element in the search range.

As long as a file is not open, the act of replacing objects in multiple files automatically saves those changes. Unfortunately, this doesn’t allow you to undo any changes that are made to documents that aren’t open. To give yourself some extra insurance, you can create backups when you use Find and Replace in multiple files. With the Find panel open, click the Options menu in the top-right corner of the panel. Select Replace Options to launch the Replace Options dialog box (see Figure 6.2).

The Replace Options dialog box specifies how multiple-file Find and Replace operations are handled.

Figure 6.2. The Replace Options dialog box specifies how multiple-file Find and Replace operations are handled.

Select from among the following options:

  • Save and Close Files (if checked)—. This option has Fireworks save and close selected files that are not currently open when the Replace operation is completed.

  • Backup Original Files—. This option has three options to choose from: Select Choose No Backups to have no file backups made; select Overwrite Existing Backups to create one set of backups and overwrite them if multiple operations are performed; and choose Incremental Backups to create a set of backups for every Find and Replace operation completed.

Click OK to save the settings.

Batch Processing

Batch Processing is often performed as a series of simultaneous tasks on a group of files. In contrast to Find and Replace, Batch Processing is used on external files that you want to manipulate is some common way. This is usually used to export a series of files to fit a certain size, such as thumbnails and the larger images that they display.

The best way to create a batch process is to use the Batch Wizard by choosing File, Batch Process. The wizard presents three screens, enabling you to accomplish a batch process in a jiffy.

On the first screen (see Figure 6.3) you can add files that will be used to create the batch. Files can be added from more than one directory.

The first screen in the Batch Process Wizard is where you add files to create the batch.

Figure 6.3. The first screen in the Batch Process Wizard is where you add files to create the batch.

When you have created the batch, click the Next button to continue.

The second screen (see Figure 6.4) is used to add tasks that tell Fireworks what to do to the files in the batch. The following are some of the most commonly used tasks:

  • Export—. This task specifies how the batch will be re-exported. When selected, all the export presets appear.

  • Scale—. This task scales the graphics to a specific size (such as thumbnails) to fit an area, or to a percentage.

  • Find and Replace—. This task opens the Batch Replace dialog box so you can use the Find and Replace operations in PNG files.

  • Rename—. This task enables you to add a prefix or suffix to the files.

  • Commands—. This task displays a list of some of the commands that you may use frequently when manipulating an image for the web.

The second screen in the Batch Process Wizard is where you add tasks that are to be applied to the batch.

Figure 6.4. The second screen in the Batch Process Wizard is where you add tasks that are to be applied to the batch.

When you have added your tasks, click the Next button to continue.

The last screen of the wizard (see Figure 6.5) is where you specify the files’ output destination, as well as what should happen to the original files. If the results are satisfactory, you can even save the batch process as a script that you can use again to repeat the exact batch process in the future.

The third screen in the Batch Process Wizard is where you choose the output destination and specify the fate of the original files.

Figure 6.5. The third screen in the Batch Process Wizard is where you choose the output destination and specify the fate of the original files.

Make your selections and click the Batch button. Fireworks does all the work so you can kick back and take a much deserved break!

Creating Custom Commands with the History Panel

Custom commands are similar to batch scripts in that they automate tasks, so you don’t have to do all the work. The difference, however, is that whereas batch processes are limited in what functions they can perform, a custom command can be made of nearly any action you can perform in Fireworks.

The simplest way to create a custom command is to use the History panel (Window, History). The History panel is a record of all the steps you have recently taken when working in a document. If you want to automate a sequence of those steps, you can use the History panel to create a custom command.

By default, the History panel shows up to 20 steps. You can increase or decrease this number in the General tab of the Preferences dialog (Edit, Preferences in Windows or Fireworks, Preferences on the Mac).

To create commands with the History panel, execute a series of modifications that are to be used in your command. Using the History panel Options menu, highlight the steps you want to use in the command, and then select Save As Command (see Figure 6.6). The Save Command dialog box appears. Enter a name for your new command. Press OK.

Use the Save As Command option to save your History panel options as a custom command.

Figure 6.6. Use the Save As Command option to save your History panel options as a custom command.

Your very own command now has a home in the Commands menu. Use it again and again. If you find yourself becoming a commands junkie and need to get rid of a few outdated commands, you can rename or delete commands in the Manage Saved Commands dialog box (Commands, Manage Saved Commands).

In the case of digitizing the stamps, the custom command feature saved the day. In analyzing the complete set of steps that was required to scan a stamp, I found they looked something like this:

  1. Acquire the image into Fireworks with the File > Scan, Twain Acquire command.

  2. Add the digital watermark to the image with the text tool.

  3. Set the opacity of the watermark to 20% so it doesn’t obstruct the view of the stamp.

  4. Crop the stamp for display on the site.

  5. Export the stamp.

  6. Export the stamp a second time as a thumbnail.

  7. Save the PNG file.

Fortunately, I was able to create a custom command that took care of the digital watermark and the cropping of the image, so I was able to combine three of the more time-consuming tasks into one automated task that took seconds to run.

Extending Fireworks

The last Fireworks tool that can be leveraged to save you time is the Fireworks Extension Manager. The Extension Manager lets you import, install, and delete extensions in Macromedia applications to extend the capabilities of each of the development applications. In other words, you can add more features to the program that weren’t included when it was first installed on your computer.

Built into Fireworks is a set of extensibility features. These features are built on an open architecture that enables users and third-party developers to add more goodies to the program.

The most common way to extend Fireworks is through commands. When you save a file, you are using a command. Although this command comes with Fireworks, it was created just like any other custom command script.

Commands are written in a special Fireworks version of JavaScript. If you’re a JavaScript ace, the language will come easily to you.

Editing Command Scripts

Commands are usually stored in scripts called command scripts. All these scripts are located in the Commands folder on your hard drive. The Commands folder location is specific to settings you used when you installed Fireworks. Each time you create a new custom command, a script is created in the folder so that you can reuse that command over and over.

If you ever need to manually edit one of the scripts (or just want to see what one looks like), simply navigate to the folder that contains the scripts and open it in a text editor such as Notepad. As you can see in Figure 6.7, each command is written in JavaScript and can be easily edited and saved.

Any saved command can be edited in a text editor.

Figure 6.7. Any saved command can be edited in a text editor.

Tip

If you choose to edit your custom commands manually, it’s a good idea to make a backup of the original command before you edit it.

Installing Extensions

Fireworks, along with Dreamweaver and Flash, is part of the Macromedia Exchange, a place where developers who create command scripts can distribute and exchange them. Macromedia tests each script to make sure it works and contains no harmful code (such as viruses) before posting it to the exchange. After it is posted, however, you can download it and easily add the functionality to Fireworks on your workstation. To review the extensions available for Fireworks, click Help, Fireworks Exchange and the exchange opens in your browser.

Tip

You can also get to the various exchanges by going to www.macromedia.com and choosing Downloads, Exchange from the navigation menu.

Installing extensions is a snap. Simply find the extension that suits your needs, download it to your computer, and then double-click on the extension. After that, the Extension Manager (see Figure 6.8) takes care of the rest.

The Extension Manager can be used to install new Extensions as well as manage your Extensions collection.

Figure 6.8. The Extension Manager can be used to install new Extensions as well as manage your Extensions collection.

To view the details of any installed extensions, simply choose which application you want to review and then click on the extension to review its functionality.

Uninstalling an extension is just as easy as installing it. Simply open the Extension Manager (Help, Manage Extensions), choose the application you want to review, select the extension you would like to delete, and choose File, Remove Extension.

Troubleshooting

I’d like to print my Fireworks graphics but am having resolution problems.

Fireworks is designed for creating web graphics. Although you can use it for print graphics, you need to up the resolution. Set the resolution of your image (Property inspector, Image Size button) so the number of PPI (pixels per inch) is equal to the number of DPI (dots per inch) your printer uses.

I created a custom style and accidentally selected Reset Styles from the Styles panel pop-up menu. Are my styles lost forever?

Most definitely. Your painstakingly created styles have been shuttled off to graphics la-la land. Choosing Reset Styles restores the 97 factory defaults and permanently removes any custom styles you may have created. Unfortunately, this action is not undoable.

Best Practices—Knowing When to Use Batch Processing

Have you ever started a process and after hours and hours of hard work, realized that you could have made your life a lot easier (and maybe gotten more sleep) if you had known about a tool or feature prior to starting? Trust me, we have all been there—or will be there at some time in our careers.

For this reason, it’s a good idea for you to spend some time familiarizing yourself with the Batch Processing tools in Fireworks. Even if you’re spending only a couple of hours batch processing made-up steps and applying them to sample graphics, knowing the steps to follow and how long it takes to create and apply a batch process can help you automate redundant tasks in the future.

But knowing how to use batch processing isn’t enough. You need to also know when to use it. Before you begin any long project that will require hours of work, take some time to determine whether or not there are some steps that you could automate. If there are, create a batch process or custom command and save yourself some time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.220.22