About Commands
In the last chapter, you learned about attaching behaviors to
your Web page. You learned that when a viewer did an event, such
as clicking on a mouse, they would create an action - maybe a JavaScript
action or play a sound or open an alert box. Suddenly, your page became
more interactive and dynamic. Commands are the next step from there;
Commands is Dreamweaver's way to automate some of the basic work you do
in producing your Web page. Dreamweaver's Commands can modify an existing
page and help you minimize some of the production process.
When you work with objects, you insert a block of HTML into the <body>
of your Web page. In the last chapter, when you worked with behaviors,
you attached JavaScript function to the <head>
and attributes of one tag. But with Commands, you can do these
two tasks and more. Commands are more powerful to use within Dreamweaver
than either the behaviors or the objects. The Rollover Image object in
your Behaviors is actually a complex Command created by Dreamweaver. Another
example is the ability to sort information in a table. By selecting a
table, then Command > Sort Table, you can easily reorganize
a table. Think of the time saved in cutting and pasting. |
And because Dreamweaver is built so that you can change and add to
its functions, you can create your own Commands. In your lab exercise
for Chapter 18, you created an email link using your History palette.
Or you can use the Command menu, and record and replay your actions. For
programmers and developers, Dreamweaver's accessible files can assist
in creating your own custom palettes, customize commands, and even adjust
the Menu XML file. For those of you interested in customizing Dreamweaver
further, I would suggest the Dreamweaver 3 Bible by Joseph W. Lowery.
If you go to Commands you should be able to see email link
(or whatever you named it in the exercise) as an available option in the
dropdown list. What Dreamweaver does is gives you the capability to record
all the actions you did onscreen, and then replay them as needed. By saving
the actions as a Command, you can then access for use whenever you wanted.
Most every onscreen action can be repeated; those that cannot will appear
with either a red x or a black line within the History palette. The Weinman
book's exercise showed you one way you could create a Command for later
use. Another way is by recording and replaying your commands.
Recording and Replaying Commands
Suppose you have a series of images on your Web page that you would like
to change. For each image, you want to put a border of 2 pixels around
each, and you wish the alignment to be centered (or left- or right-aligned.)
Call up the page that you created using the Command > Create Web
Photo Album exercise in Chapter 18. Or better yet, create your own
Web Photo album using your own folder of images. Highlight the first image
and choose Commands > Start Recording. (If you prefer, you can
use the keyboard shortcut, Ctrl-Shift-X or Command-Shift-X.) Next, use
the Properties Inspector and change its border and the alignment. Then
choose Commands > Stop, or the same keyboard shortcut. Select
the next image and choose Commands > Play Recorded Command,
or the keyboard shortcut, Ctrl-P or Command-P.
Notice that the actions that you did on the first image were recorded
and then replayed for each image it was applied to. Think of the
time you saved not having to choose the same actions within the Property
Inspector for each image. The only thing you cannot record and replay
within Dreamweaver are your mouse functions. Instead, you will have to
use your arrow keys and keyboard commands. An example of this would be
highlighting with your mouse. Dreamweaver will ask you if you would like
to stop recording if you tried to do record this action. Likewise, Dreamweaver
cannot record tab and Shift-Tab keys. To record this movement, you must
use your Home and End keys, in combination with your Arrow keys.
Return to Top
Handling History palette
commands
In the lab exercise, you used the History palette to create a command
for an email link. It instantly was added to the bottom of the Commands
menu list. Once you learned the value of this trick, you can see how the
list can grow and become a little unwieldy to use. However, in Dreamweaver,
you can manage these custom added items either by renaming them or deleting
them in the Dreamweaver Edit Command List function. To manage History
palette recorded commands:
- Choose Commands > Edit Command List
- To remove a command, select it and choose Delete
- To rename a command, select it and enter the new name or alter the
existing one. Note the Edit Command List affects only those commands
saved from the History palette.
Return to Top
The standard commands
These are the standard commands that come with Dreamweaver 3:
- Start/Stop Recording: Stops and starts the recording of a sequence
of user commands
- Play Recorded Commands: Executes the last recorded command
- Edit Command List: Opens the Edit Command List dialog box so
that you can arrange and delete your custom items
- Get More Commands: Connects you to the Dreamweaver Online Resource
Center
- Clean Up HTML: removes redundant or unnecessary HTML code from
your page
- Clean Up Word HTML: cleans up unnecessary HTML from a document
converted in Microsoft Word
- Add/Remove Netscape Resize Fix: This is a workaround to a problem
involving the use of layers in a Netscape 4.x browser. <div>
tags can lose there positioning when resized; this command causes browsers
to reload when necessary.
- Optimize Image in Fireworks: This is one of the lab exercises
in Chapter 18. Quickly opens Fireworks and rescales, recrops, color
corrects and exports to a different format, images in a given folder.
- Create Web Photo Album: Another lab exercise, this turns a
folder of images into thumbnails, with links to the original image
- Apply Source Formatting: If ever needed, this allows HTML pages
created outside of Dreamweaver to be styled to resemble Dreamweaver-created
code. It's useful if you use the Window > HTML Source a lot.
- Set Color Scheme: A very early exercise done in lab, it actually
is a sophisticated Command that sets the colors for a current page's
background, text and links.
- Sort Table: For those of you who have worked with spreadsheets,
you are familiar with how this works. In Dreamweaver, you can perform
a one- or two-level sort on any table, and proscribe the column as ascending
or descending.
- Format Table: 17 different predesigned formats that can be
applied to a selected table
These standard commands can be very useful as you work on your Web pages.
Return to Top
Summary
Although this is a course on Dreamweaver 3, it makes sense to mention
the use of Fireworks within your Dreamweaver lesson, in this closing paragraph.
You should have already used this very helpful feature doing the lab exercise
in Chapter 18. There is no Web designer in the world that hasn't at one
time or another been asked to modify a graphic during a presentation.
With the Command, Optimize Image in Firework, at your fingertips,
you can easily make those changes. Yet another time-saver created by Macromedia
for you to explore in your lab exercises!
|