ptg 22 22 507 Automating Dreamweaver Introduction You can't change time; it plods forward at sixty minutes an hour, twenty-four hours a day. Unfortunately, when you're involved in creating a complex Web site, and up against a deadline, there never seems to be enough time in the day. Adobe understands the need for efficiency in their appli- cations, and Dreamweaver is no exception. Built into the structure of the program are ways to help you get the job done, and get it done quickly. However, it's not just about fin- ishing a project fast, it's also about doing it right. Again, Dreamweaver creates a perfect balance between efficiency and quality. For example, you're working along, and suddenly decide that 6 steps ago, you deleted something that should not have been deleted. No problem, just use the History panel to go back in time and correct the error. That's great, but the History panel is much more than multiple undos. It actually allows you to automate repetitive tasks by creating com- mands out of selected history steps. Here's another one: You're almost finished with your site; it's 75 pages, all nicely checked out and ready to go. Then you discover a misspelling that occurs on all the pages. No prob- lem, you simply access Find and Replace and correct the error. But Find and Replace is more that just a simple text corrector; you can search for specific source code, text within tags, even search for a specific tag. In addition, if it's some- thing that you search for often, you can save the search as a query and use it over and over again. What You’ll Do Use the History Panel Undo and Redo History Steps Replay History Steps Copy History Steps Between Documents Save History Steps as Commands Use and Manage History Commands Record Commands for Temporary Use Set History Panel Preferences Use Advanced Find and Replace for Text Use Advanced Find and Replace for Tags Create and Use a Search Query From the Library of Wow! eBook ptg 508 Chapter 22 The History panel helps you automate and streamline the way you work in Dreamweaver. As you work in Dreamweaver, the History panel tracks all your steps behind the scenes for the entire document or only for individual or all objects. With the History panel, you can undo or redo steps to correct mistakes, replay selected steps for new tasks to streamline repetitive work, or record steps for replay from the Commands menu to automate your work. The History panel doesn’t replace the Undo, Redo, and Repeat commands on the Edit menu, it simply tracks every step you per- form. When you undo or redo one or more commands, the History panel displays the results; the Undo/Redo slider moves accord- ing to the commands you select. You can open the History panel usi ng the Window menu like any of the other panels in Dreamweaver. Each step you take in the active document during a work session (since you created or opened the document) appears on a separate line in the History panel. Steps you take in one Dreamweaver document don’t appear in other documents’ History panel lists. The first step you perform in a session appears at the top of the list and the last step appears at the bottom. If a red X appears in the icon for a step, it indicates Dreamweaver cannot save or replay the step. Unlike other panels in Dreamweaver, the History panel includes a slider on the left side you can use to undo/redo steps; the Undo/Redo slider ini- tially points to the last step you performed. As the History panel records each step taken to the active document, it consumes memory and hard disk space. If you no longer need the steps in the History panel and want to free up some memory, you can clear the entire list with the Clear History command on the Options menu. When you close a document, Dreamweaver clears the History panel. The bottom of the History panel includes buttons to replay selected steps, copy selected steps to the Clipboard, and create a command from selected steps. Using the History Panel History steps History panel Options menu Clear History command From the Library of Wow! eBook ptg Chapter 22 Automating Dreamweaver 509 As you change the current open document, you begin to see the History panel record each action you make. For example, type in a line of text and a typing layer displays in the History panel. Now, select the text and change it to italic: the History panel displays the change. Each action in the document creates a new action layer in the panel. Now, continue on for a few steps, and then you realize that you didn't want to italicize the text. As long as that history step is still in the History panel, you can go in and undo it. If the step you need to change is the last one, then all you need to do is press A+Z (Mac), or Ctrl+Z (Win). If you change your mind you can always press A+Y (Mac), or Ctrl+Y (Win) to redo the last undo… sound confusing? Not really; however, if it is, then the History panel eliminates the confusion by giving you a visual list of all your his- tory steps. Undoing and Redoing History Steps Undo or Redo Multiple History Steps Open the Web page you want to use. Open the History panel. Perform several actions within the document to create a running history. ◆ To redo steps, undo one or more actions. In the History panel, perform a multiple undo or redo using one of the following methods: ◆ Drag the slider up (undo) or down (redo) on the History panel to the desired step in the History panel. ◆ Click the slider bar next to the step you want to undo or revert to and the slider will scroll automatically to that step. NOTE Any actions performed after the undo overwrite the undone actions and create a new history for the document from that point forward. A redo can be performed only so long as you haven't performed a multiple undo, and then created new steps. 4 3 2 1 2 3 4 From the Library of Wow! eBook ptg 510 Chapter 22 You can replay steps from the History panel to the same object or to a different object in the document. You can replay steps only in the order in which you performed them; you can’t rearrange the order of the steps in the History panel. If a red X appears in the icon for a step, it indicates Dreamweaver cannot save or replay the step. Replaying History Steps Replay History Steps to the Same Object or Another Object Open the Web page containing the steps you want to replay. Open the History panel. Select the steps you want: ◆ One Step. Click a step. ◆ Adjacent Steps. Drag from one step to another or click the first step, hold down the Shift key, and then click the last step. ◆ Nonadjacent Steps. Hold down the A (Mac) or Ctrl (Win) key, and then click steps. Select the same object used in the History steps or another object. Click Replay in the History panel. The steps are replayed in order, and a new step called Replay Steps appears in the History panel. 5 4 3 2 1 5 1 4 3 2 From the Library of Wow! eBook ptg Chapter 22 Automating Dreamweaver 511 Each document only tracks its own set of steps in the History panel. When you close a document, Dreamweaver clears the History panel. If you want to use a set of steps in another document, you need to copy them from one History panel and paste them to another document. You can use the Copy Steps button on the History panel or the same com- mand on the Options menu to complete the task. When you paste steps into another document, Dreamweaver replays the steps and the History panel shows the steps as only one step called Paste Steps (Mac) or Paste (Win). Copying History Steps Between Documents Copy Steps Between Documents Open the Web page containing the steps you want to copy. Open the History panel. Perform several actions within the document to create a running history. Select the steps (called a History action) that you want to copy. Click the Copy Steps button in the History panel. Click in the document to place the insertion point where you want to paste the steps or select an object to apply the steps. Click the Edit menu, and then click Paste. Dreamweaver executes the saved History steps at the insertion point of the cursor. 7 6 5 4 3 2 1 4 2 3 5 7 6 From the Library of Wow! eBook ptg 512 Chapter 22 The History panel records the steps you take in the order in which you perform them in Dreamweaver. If you perform the same set of steps several times while you work on a document, you can save the steps in the History panel as a command on the Commands menu, which you can reuse again and again. This is where the real power is located. Dreamweaver stores the commands you save for future use in any doc- ument. While History records most actions performed while working on a page, there are some things that it can't record, such as dragging an object from one place on the page to another. If a black line separating the steps or a red X appears in the icon for a step, it indicates Dreamweaver cannot save or replay the step. Saving History Steps as Commands Save History Steps as a Command Open the Web page you want to use. Open the History panel. Perform several steps within the page (in this example, a copyright notice is created using a specific font and formatting). IMPORTANT When selecting the text to change its formatting do not click and drag; instead use the left arrow key while holding down the shift key. Dreamweaver records all of the steps within a box in the History panel. NOTE If you see a black line separating the steps, or a red X, that indicates the steps cannot be saved or replayed as a single command. When finished creating the copyright symbol, select all of the steps that you want saved as a command, by clicking and dragging on the steps in the History panel. 4 3 2 1 1 4 5 2 3 From the Library of Wow! eBook ptg Chapter 22 Automating Dreamweaver 513 Click the Save Steps button in the History panel. Enter a descriptive name for the command. Click OK. To reuse the comman d, cl ic k th e Commands menu, and then click the command name. The bottom of the Commands menu displays a list of your saved history commands. 8 7 6 5 7 6 Workarounds for Steps Not Recorded While History records most actions performed while working on a page, there are some things that it can't record. For example, some mouse movements, like selecting objects by clicking and dragging, can't be saved or played back as part of a saved command. Should they occur during the recording process, those movements appear in the History panel as a black mouse-movement divider line between the steps. One way to prevent those black lines from appearing is to go into Code view and use the arrow keys. For example, you can use the arrow keys in Code view to reposition the insertion point in the document before performing the next step of the command. In addi- tion to the mouse movements that can't be recorded, there are a few other actions that can't be recorded as part of a saved command, such as dragging an object from one place on the page to another. These types of actions display a small red X next to the action layer in the History panel (the red X is a bad thing). For Your Information From the Library of Wow! eBook . the day. Adobe understands the need for efficiency in their appli- cations, and Dreamweaver is no exception. Built into the structure of the program are ways to help you get the job done, and. change. Each action in the document creates a new action layer in the panel. Now, continue on for a few steps, and then you realize that you didn't want to italicize the text. As long as that. NOTE Any actions performed after the undo overwrite the undone actions and create a new history for the document from that point forward. A redo can be performed only so long as you haven't