home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / downloads / 401065 / WPO11 / Data1.cab / _6084E2E7BC5049848E4E068B128ED9A5 < prev    next >
Text File  |  2003-03-07  |  29KB  |  614 lines

  1. Generating and editing Corel Presentations macros by using PerfectScript
  2.  
  3. With PerfectScript, the command-based macro language of WordPerfect Office, you can combine statements to automate routine tasks and simplify large ones.
  4.  
  5. In this section, you'll learn about
  6.  
  7.   understanding components of macro commands
  8.   
  9.   using types of macro commands
  10.   
  11.   understanding syntax
  12.   
  13.   using macro conventions
  14.   
  15.   formatting macros
  16.   
  17.   using programming commands
  18.   
  19.   using parameters
  20.   
  21.   using variables
  22.   
  23.   assigning variables in PerfectScript
  24.   
  25.   inserting commands with the Macro Command Browser
  26.   
  27.   using macro commands to retrieve information
  28.   
  29.   inserting codes into macros
  30.   
  31.   compiling macros using the macro compiler
  32.   
  33.   fixing compile errors
  34.   
  35.   editing and deleting macros in PerfectScript
  36.   
  37.   adding search capabilities to macros
  38.   
  39. Understanding components of macro commands
  40.  
  41. Recording and playing macros can simplify routine tasks, but when product commands are used together with PerfectScript programming commands, you can create more complex macros. By using product commands and programming commands, the functionality of WordPerfect Office features is combined with the customizing, decision making, and iterative capabilities of a programming language. Using programming commands also makes it possible to include the functionality of other applications in WordPerfect Office.
  42.  
  43. PerfectScript macros are composed using PerfectScript, the common macro language for all applications in WordPerfect Office. PerfectScript is a command-based language. When you record a macro, PerfectScript records the results of keystrokes or mouse selections instead of recording the keystrokes themselves. For example, instead of recording each keystroke required to change the top margin of a page to 2" (5.1 cm), the macro records the command:
  44.  
  45. MarginTop(MarginWidth:2.0")
  46.  
  47. PerfectScript also includes programming commands that direct the function of the macro. These commands let you prompt for user input, make decisions based on conditions in a document, access system variables, and so on. Using programming commands with product commands can automate long, complex tasks.
  48.  
  49. A written macro can include nonrecordable statements, which cannot be included in recorded macros that specify how a macro performs a task. Writing a macro provides greater flexibility to determine function than recording a macro. You can create a macro in WordPerfect and play it in the application for which it was written.
  50.  
  51. WordPerfect lets you include the functionality of other applications in WordPerfect Office with the PerfectScript language. A macro written in one application can open another application and perform tasks, giving you tools to use Quattro Pro, Corel Presentations, and WordPerfect together.
  52.  
  53. Macro commands consist of three parts: a command name, parameters, and separators. The table below describes these elements of syntax.
  54.  
  55.  
  56.  
  57. Component    Definition
  58.  
  59. Command names    Indicate the type of action to be performed. Some commands consist only of a command name, such as FileOpenDlg().
  60.  
  61. Parameters    Provide more information about the command, such as which options of a feature are active. Parameters are always enclosed in parentheses; for example, SelectTextChart(Chart:Bullets!).
  62.  
  63. Separators    Mark the parameters in a command. Semicolons separate individual parameters; parentheses enclose a series of parameters; braces enclose a series of repeating parameters.
  64.  
  65.  
  66.  
  67. In the example included in the following table, the statement selects the title, subtitle, or bullet chart for a slide that contains these elements. The 'Bullet!' enumeration will only work for bullet charts inserted from the layout layer. The command has one parameter called 'Chart'. The value of the parameter is set to 'Bullet!'. Other acceptable values for this parameter are 'Title!' and 'Subtitle!'. The various acceptable values for this type of parameter are called enumerations. Other parameter types accept values of the type string or numeric.
  68.  
  69.  
  70.  
  71. Statement    Parameter    Type    Acceptable values
  72.  
  73. SelectTextChart (Chart:Bullets!)    Chart    Enumeration    Bullets!
  74.  
  75. Title!            
  76.  
  77. Subtitle!            
  78.  
  79.  
  80.  
  81. Using types of macro commands
  82.  
  83. The PerfectScript programming language consists of Corel Presentations application commands and functions, and programming statements and functions. PerfectScript can do more than perform recorded Corel Presentations commands-it can extend the functionality of slide shows in a number of ways, such as prompting you for input, displaying messages, controlling other Corel and Windows-based applications, and performing and repeating commands. You can also build complete applications or Wizards so that a user with limited experience using Corel Presentations can still use some of the more complex functions.
  84.  
  85. There are three types of macro commands: product commands, OLE object commands, and programming commands. Product commands are specific to a product, such as Corel Presentations or Quattro Pro. OLE object commands perform tasks on an OLE object. Programming commands work across applications; they are PerfectScript commands.
  86.  
  87. Command names often describe an action, such as AlignObjectsLeft, BitmapBlur, SelectAllObjects, and ToolbarCopy. Command names are not case sensitive and usually do not contain spaces. Exceptions include programming commands that call a subroutine, such as Case call or OnCancel call.
  88.  
  89. A macro can use more than one application product and OLE object. Commands to the non-default application or OLE object require a prefix, which is specified in an application or object statement. In the following example,
  90.  
  91. A1.AboutDlg ()
  92.  
  93. A1 (followed by a period) is the prefix. It tells the compiler to use the application or object assigned A1 in a PerfectScript application or object statement.
  94.  
  95. Understanding syntax
  96.  
  97. Syntax refers to the grammatical rules that govern the form of macro statements and expressions. For example, the syntax of the following statement, which types "John Doe," is correct:
  98.  
  99. Type(Text: "John Doe")
  100.  
  101. The syntax of the next example is incorrect and produces an error message because the statement lacks a closing parenthesis:
  102.  
  103. Type(Text: "John Doe"
  104.  
  105. If you find it difficult to distinguish different parts of a macro, remember that you can add extra line spaces, tabs, and even font changes to make the macro more readable. As long as the commands are written correctly, the macro compiler ignores extra spaces and lines.
  106.  
  107. Using macro conventions
  108.  
  109. When you create macros in WordPerfect, you must obey macro command syntax for the macro to compile properly. You do not need to follow macro formatting conventions for a macro to compile correctly. However, you will improve the readability of a macro if you use these conventions.
  110.  
  111. Macro command syntax must be correct for a macro to compile. Understanding the following conventions used in WordPerfect macros will help you avoid common syntax errors:
  112.  
  113.   You can enter programming commands in uppercase, lowercase, or mixed case. The compiler is not case sensitive.
  114.   
  115.   Product commands, such as AboutDlg or AddSlide, are shown in mixed case.
  116.   
  117.   Corel Presentations system variables begin with Env, such as EnvCurrentSlideNumber or EnvSlideTitle. They are shown in mixed case and they return information about the application environment.
  118.   
  119.   Line wrapping does not affect macro execution.
  120.   
  121.   Do not insert a space in a command name unless the space is part of the syntax.
  122.   
  123.   Do not use hard returns, tabs, or indents in a character expression (a character string enclosed in double quotation marks).
  124.   
  125.   You can use spaces, tabs, indents, and hard returns before and after commands, or between parameters, to make a macro easier to read.
  126.   
  127.   Smart quotes in a macro create a compile-time syntax error.
  128.   
  129. Formatting macros
  130.  
  131. You can type commands into a macro that is saved in a file. If you want to improve the readability of a macro, you can format it so that it includes tabs, spaces, and font or text appearance changes. Formatting the macro does not affect how it works. The two forward slashes indicate comments within the macro formula. For example, WordPerfect records the following macro in this format:
  132.  
  133. // Create a chart
  134.  
  135. BeginDataChart()
  136.  
  137. ChartCreate (VertBar!;Button1!;Yes!;Yes!)
  138.  
  139. // Display subtitle which is off by default
  140.  
  141. ChartSubtitleToggle()
  142.  
  143. // Display the chart title
  144.  
  145. ChartTitlesDisplay(Title!;On!)
  146.  
  147. However, if you type the commands yourself or edit an existing macro, you can format the macro the way you want. For example, you can format it as follows:
  148.  
  149. // Create a chart
  150.  
  151. BeginDataChart()
  152.  
  153. ChartCreate (VertBar!;Button1!;Yes!;Yes!)
  154.  
  155.  
  156.  
  157.  
  158.  
  159. // Display subtitle which is off by default
  160.  
  161. ChartSubtitleToggle()
  162.  
  163.  
  164.  
  165.  
  166.  
  167. // Display the chart title
  168.  
  169. ChartTitlesDisplay(Title!;On!)
  170.  
  171. Using programming commands
  172.  
  173. Programming commands work across WordPerfect Office applications. They control macro functions, such as
  174.  
  175.   Repeating macro commands or statements a specified number of times or until certain conditions are met (For, Endfor, Repeat, Until, While, EndWhile)
  176.   
  177.   Invoking or jumping to a specified subroutine with Call or Go
  178.   
  179.   Specifying conditions under which other macro commands or statements operate (Case, IfElse, Endif, Switch, EndSwitch)
  180.   
  181. For example,
  182.  
  183. If (x = "A")
  184.  
  185. EditBackground
  186.  
  187. Else
  188.  
  189. EditLayouts
  190.  
  191. Endif
  192.  
  193. displays the background layer of a slide in edit mode if x equals the value "A". If x has another value, the subroutine displays the layout layer of a slide for you to edit. The If, Else, and Endif commands are programming commands. EditBackground and EditLayouts are product commands.
  194.  
  195. Using parameters
  196.  
  197. Commands often require parameters, which can be assigned values (data). Parameters are passed to the compiler (which translates the macro so that it can be played in the application) or passed between subroutines. In this WordPerfect command,
  198.  
  199. Advance (Where: AdvanceDown!; Amount: 1.0")
  200.  
  201. Advance is the command name, Where and Amount are parameters, and Advance Down! and 1.0" are parameter data. This command advances the insertion point down one inch. The parameter names, Where and Amount, are optional.
  202.  
  203. Data types
  204.  
  205. A data type represents information that is needed by a parameter or returned by a command (return value). In the command syntax, data types are displayed in italics. For example, the enumerations for the Rotation parameter of BoxCaptionRotation are Degrees90!, Degrees180!, Degrees270!, and None!. Only these enumerations can replace the data type in the command syntax. Enumerations are identified by a trailing exclamation point. The most common data types in product commands are string, enumeration, and numeric. Programming commands frequently use variables.
  206.  
  207. Parameter names
  208.  
  209. Using parameter names is optional. For example, the command InhibitInput (State: Off!) works just like the command InhibitInput (Off!). Some product commands have no parameters. Their syntax is usually written with empty parameters, such as PosScreenUp (). Some programming commands and all system variables have no parameters. Their syntax is the command name alone, such as Pause and ?FeatureBar.
  210.  
  211. Italics
  212.  
  213. Italics in macros syntax indicate parameter names or types to be replaced with data. For example, the syntax of GraphicsLineLength is
  214.  
  215. GraphicsLineLength (Length: measurement)
  216.  
  217. After you replace measurement with a number, the command might be
  218.  
  219. GraphicsLineLength (Length: 21)
  220.  
  221. or
  222.  
  223. GraphicsLineLength (21)
  224.  
  225. Punctuation
  226.  
  227. You must enclose parameters in parentheses(()). A missing parenthesis is a common error that prevents macros from compiling. Parentheses are optional for commands with no parameters but must be used with user-defined functions and procedures.
  228.  
  229. You must separate multiple parameters with semicolons (;). If you omit an optional parameter, include the semicolon in the syntax to keep following parameters in their correct positions. For example,
  230.  
  231. AbbreviationExpand (AbbreviationName:; Template: PersonalLibrary!)
  232.  
  233. or
  234.  
  235. AbbreviationExpand (; PersonalLibrary!)
  236.  
  237. Repeating parameters are enclosed in braces (<>)and are separated by semicolons. For example,
  238.  
  239. CASE (<test>: any ; {<Case>: any; <Label>: label; <Case>: and; <Label>: label...})
  240.  
  241. When data is supplied, the command could be
  242.  
  243. CASE (vChoice; {1; Exclaim; 2; Info; 3; Question; 4; Stop; 5; QuitMacro}; QuitMacro)
  244.  
  245. Product commands perform product tasks in a specific application. For example,
  246.  
  247. ShowSlide(Slide: 4)
  248.  
  249. displays the fourth slide in the current slide show in Corel Presentations.
  250.  
  251. Spaces between command names and the opening parenthesis of the parameter section and after semicolons in parameters are optional.
  252.  
  253. Product commands are specific for each application. They perform various functions in that application, such as
  254.  
  255.   displaying a dialog box(InitialCodesStyleDlg)
  256.   
  257.   specifying settings, such as styles (BorderBottomLine), user settings (PrefZoom), or attributes (font)
  258.   
  259.   enabling and disabling features (InhibitInput) or (TableCellIgnoreCalculation)
  260.   
  261.   performing actions, such as inserting a file (FileInsert) or code, (PrinterCommand), renaming a bookmark (BookmarkRename), converting comments to text (CommentConvert), or moving the insertion point (PosColBottom)
  262.   
  263.   playing macros that are included with the application (AddressMergeShippingMacro)
  264.   
  265. Product commands that report information (return value) about the state of an application or feature are sometimes called system variables. In Corel Presentations, system variables begin with a leading Env (EnvPaths). Some system variables in Corel Presentations have parameters as well as return values.
  266.  
  267. Using variables
  268.  
  269. A variable represents a place in memory where data is stored for use by a macro or a merge. As its name indicates, the data in a variable is changeable. All variables must be declared and named. The name and content are determined by the programmer. You can perform operations on variables and change the content. The variable name is used to access the value of the variable.
  270.  
  271. There are four different types of variables: local, global, persistent, and constant. When a variable is declared, its type determines how visible the variable is (scope) and how long the variable will exist in memory. By default, when a variable is declared, it is local.
  272.  
  273. Local, global, and persistent variables all have a valid use and purpose. It is important to understand the scope and duration of the variables in macros. In most situations, local variables should be used. Global and persistent variables may be a necessity in some cases, but should be used with care. Constant variables should be used sparingly, if at all.
  274.  
  275. Other programming languages force you to specify the type of data that will be stored in a variable. PerfectScript, however, is an untyped language-it does not force the user to specify the type of data that a variable will contain. If a variable called x was declared in WordPerfect, that variable could contain a text string or a number.
  276.  
  277. Declaring variables
  278.  
  279. Variables must be declared before they can be used. Declaring a variable instructs PerfectScript to set aside memory for the variable. When declaring a variable, you specify a name and, optionally, a value for the new variable. Variables may be initialized with a value at the time of declaration. The following sections show how to appropriately name variables and how to declare (and initialize) the four types of variables.
  280.  
  281. Naming variables
  282.  
  283. Variable names should be descriptive. Variable names must begin with a letter, can include any other combination of letters or numbers, must be 50 characters or less in length, and are not case sensitive. Variables that have a string value should be named with a lowercase 's' as the beginning character of the name. The lowercase 's' denotes string. Variables that have a numeric value should be named with a lowercase 'n' to denote number. Some example variable names follow:
  284.  
  285. // String values
  286.  
  287. sFirstName := "Claudia"
  288.  
  289. sAddress := "1625 East Nowhere St."
  290.  
  291. sBirthday := "6/12/69"
  292.  
  293. // Number values
  294.  
  295. nAge := 25
  296.  
  297. nTotal := 145.97
  298.  
  299. The preceding code sample shows some variable examples. Each variable above has a descriptive name to help you remember what type of value should be expected. The variables that were declared in these examples are local variables by default, because no variable type is specified.
  300.  
  301. Assigning variables in PerfectScript
  302.  
  303. A variable acts as a placeholder that represents a value, which can be text, numbers, or measurements, that can be used repeatedly in a macro. This value can be changed or manipulated. Variables are typically preceded by the letter "v." You can assign a variable.
  304.  
  305. To assign a variable
  306.  
  307.   Type Assign where you want to define the variable.
  308.   
  309. If you want to assign the text "Claudia" to the variable "vName", type Assign (vName;"Claudia").
  310.  
  311. Tip
  312.  
  313.   You can type a colon followed by the equals sign (:=) as a shortcut to assigning a variable. For example, you could type vName:="Claudia" for the above procedure.
  314.   
  315. Inserting commands with the Macro Command Browser
  316.  
  317. Product commands perform tasks that you would normally perform manually using WordPerfect Office applications. Many product commands require you to specify parameter values. These values give the application information about where and how to perform the task associated with the specified command. You can use the Macro Command Browser to choose commands and set parameters quickly.
  318.  
  319. You can use the Macro Command Browser to insert product or programming commands in a macro you are editing. If the command you choose has required parameters, you must set values for these before you insert the macro.
  320.  
  321. When you create macros using the Macro Command Browser, the commands are inserted in the correct format. If you type a macro without the Macro Command Browser, you must arrange macro commands and their elements in a precise order of syntax. Each macro command must be spelled correctly and must include all the required parameters and separators.
  322.  
  323. To insert a command using the Macro Command Browser
  324.  
  325. 1    If the Macro toolbar is not already displayed, click Tools  Macro  Macro toolbar.
  326.  
  327. 2    Click Commands.
  328.  
  329. 3    Choose a product from the Command type list box.
  330.  
  331. 4    Choose a command from the Commands list box.
  332.  
  333. If the Parameters list box does not display, proceed to step 7.
  334.  
  335. 5    Choose any parameters from the Parameters list box.
  336.  
  337. If the Enumeration list box does not display, proceed to step 7.
  338.  
  339. 6    Choose an enumeration from the Enumeration list box.
  340.  
  341. 7    Type any additional parameters in the Command box.
  342.  
  343. 8    Click Insert.
  344.  
  345. Note
  346.  
  347.   A parameter that is displayed in bold is a required parameter. The macro will not compile or run without it. Other parameters are optional and may, in some cases, be useless depending on the values given to required parameters.
  348.   
  349. Tips
  350.  
  351.   You can also insert system variables with the Macro Command Browser. System variables contain current system information, such as the current chart type or the default directory. In WordPerfect, system variables begin with a question mark (?). In Corel Presentations, system variables begin with the letters "Env."
  352.   
  353.   You can add blank lines to separate programming commands and subroutines.
  354.   
  355.   You can indent lines to show levels of nested commands.
  356.   
  357. Using macro commands to retrieve information
  358.  
  359. WordPerfect allows you to use commands, such as MessageBox or GetString, that gather information for macros. You can use these types of commands, for example, to prompt the user to type in information. For information about the MessageBox command, see the PerfectScript Programming Macros Help in the PerfectScript Macro Command Browser.
  360.  
  361. You can use the GetString command if you need to enter text that will be used by your macro. The GetString command uses the following format:
  362.  
  363. GetString (Var;Prompt Text; Title; MaxLength)
  364.  
  365. The Prompt text, Title, and Maximum length parameters are optional. The Var parameter specifies a string variable to load with text entered by the user. You can use the GetUnits command if you want the user to provide the macro with measurement information that can be used to move the insertion point and set margins. If you want the user to enter information for use in a numeric expression (such as addition or subtraction), you can use the GetNumber command. Both the GetUnits and GetNumber commands are similar to the GetString command; however, they do not use maximum parameter length. The user can use any of the abbreviations listed in the following table to represent units of measurement.
  366.  
  367.  
  368.  
  369. Unit of measurement    Abbreviation
  370.  
  371. WP Units (1200 per inch)    w
  372.  
  373. Points (72 per inch)    p
  374.  
  375. Millimeters    m
  376.  
  377. Centimeters    c
  378.  
  379. Inches    i or "
  380.  
  381.  
  382.  
  383. Note
  384.  
  385.   If the user doesn't type a unit of measurement with the number when prompted, WordPerfect uses WP Units as the default unit of measurement.
  386.   
  387. Inserting codes into macros
  388.  
  389. You can use WordPerfect to insert a code into a macro.
  390.  
  391. To insert a code into a macro
  392.  
  393. 1    On the Windows taskbar, click Start  WordPerfect Office 11  WordPerfect 11.
  394.  
  395. 2    Click Tools  Macro  Macro toolbar.
  396.  
  397. 3    Click Codes.
  398.  
  399. 4    Click one of the following tabs:
  400.  
  401.   Search-allows you to select search find codes
  402.   
  403.   Merge-allows you to select merge find codes
  404.   
  405.   Date-allows you to select date find codes
  406.   
  407.   Other-allows you to select chapter, page, section page, total page, and volume number find codes
  408.   
  409. 5    Choose a code from the Find codes list.
  410.  
  411. 6    Click Insert.
  412.  
  413. 7    Click Close.
  414.  
  415. Note
  416.  
  417.   When you insert a code into a macro, you must use straight double quotation marks around the code so that WordPerfect recognizes the code in the macro.
  418.   
  419. Compiling macros using the macro compiler
  420.  
  421. The programs that compile macros are called compilers. A macro compiler is used to compile or "translate" macros so that WordPerfect Office applications can play them. The macro compiler creates an object, which it saves in a hidden area of the source file (the macro compiler does not create a separate object file). When you edit the source file, the object is destroyed. The object is recreated each time the source file is compiled. Macros in WordPerfect are compiled when you record, play, save, save and compile them, or when you close the macro from the Macro toolbar. You must compile a macro before you can play it.
  422.  
  423. If you receive an error message while the macro is compiling, you must correct all the errors before the macro will play. For information about fixing compile errors, see "Fixing compile errors."
  424.  
  425. To compile a macro
  426.  
  427.   Click the Save & compile button on the Macro toolbar.
  428.   
  429. Note
  430.  
  431.   If a macro you compile has error messages, WordPerfect still saves it even if you do not fix the compile errors. For information about fixing compile errors, see "Fixing compile errors."
  432.   
  433. Fixing compile errors
  434.  
  435. Macros have three types of errors: syntax errors, run-time errors, and logic errors. You can set PerfectScript to generate a list when you compile a macro. You can also use the PerfectScript debugger to find errors. WordPerfect lets you to test for errors from inside the PerfectScript utility. WordPerfect allows you several options for debugging macros. You can debug macros step-by-step so that the macro executes the current commands and stops at the next command. You can also debug macros with a breakpoint so that the macro executes all the commands in the macro until it reaches the breakpoint. Macro breakpoints are set by default to be the beginning of the macro, the end of the macro, and at any errors. WordPerfect also lets you debug a macro by briefly displaying or "animating" each command before it is executed.
  436.  
  437. Animation allows you to step through macros line by line, automatically bringing up the debugging dialog box at each step so you can check the variables and other calls. You can specify how long the debugger will pause before moving to the next step.
  438.  
  439. You can also view the meaning of commands from the PerfectScript debugger.
  440.  
  441. Identifying syntax errors
  442.  
  443. Syntax errors appear when you are compiling a macro. The PerfectScript compiler flags unrecognizable commands, such as missing parentheses or semi-colons and incorrectly spelled command names.
  444.  
  445. The compiler identifies syntax errors and suggests solutions. The error message displays information about the error and its location. The compiler makes a best guess and may not always be accurate.
  446.  
  447. Common syntax errors include
  448.  
  449.   missing semicolons between parameters
  450.   
  451.   missing parentheses
  452.   
  453.   missing double quotation marks
  454.   
  455.   missing command in a conditional or loop statement
  456.   
  457.   misspelled macro command names
  458.   
  459.   undefined calling statements
  460.   
  461.   using commas between parameters instead of semicolons
  462.   
  463. Identifying run-time errors
  464.  
  465. Run-time is the same as execution time. Run-time errors occur while the macro is playing. Referencing a variable that has not been assigned a value causes a run-time error. Run-time error messages identify errors that occur while the macro plays and show where errors occur.
  466.  
  467. Identifying logic errors
  468.  
  469. When a macro does not produce the expected result, you may have a logic error. When a macro has a logic error, it plays without producing any error messages because WordPerfect accepts all of the macro commands.
  470.  
  471. To set PerfectScript to generate a listing file when you compile a macro
  472.  
  473. 1    On the Windows taskbar, click Start  Programs  WordPerfect Office 11  Utilities  PerfectScript.
  474.  
  475. 2    Click Tools  Settings.
  476.  
  477. 3    Click the Compile tab.
  478.  
  479. 4    Enable the Generate listing file check box.
  480.  
  481. Note
  482.  
  483.   When you generate a listing file, PerfectScript saves it with a .wcl filename extension, and it is saved to the same location as the macro you are compiling.
  484.   
  485. To use the PerfectScript debugger to find errors
  486.  
  487. 1    Click Tools  Macro  Edit.
  488.  
  489. 2    Choose the macro you want to debug.
  490.  
  491. 3    Click Edit.
  492.  
  493. 4    Click where you want to begin debugging the macro.
  494.  
  495. 5    Type Step (On!).
  496.  
  497. If you want to display a debug window, type Display (On!).
  498.  
  499. 6    Click Save & compile.
  500.  
  501. 7    Type a file path and filename in the Listing filename box.
  502.  
  503. To debug a macro from PerfectScript
  504.  
  505. 1    Click File  Debug  Play.
  506.  
  507. 2    Choose the macro you want to debug.
  508.  
  509. 3    Type a file path and filename in the Listing filename box.
  510.  
  511. 4    Click OK.
  512.  
  513. 5    Click Debug  Step into.
  514.  
  515. To set a macro breakpoint
  516.  
  517. 1    Select the line of the macro in which you want to insert a breakpoint.
  518.  
  519. 2    Click Debug  Breakpoint  Add.
  520.  
  521. The Breakpoint symbol displays beside the line in which you added the breakpoint.
  522.  
  523. To debug a macro with a breakpoint
  524.  
  525. 1    Select the line of the macro in which you want to insert a breakpoint.
  526.  
  527. 2    Click Debug  Breakpoint  Add.
  528.  
  529. The Breakpoint symbol displays beside the line in which you added the breakpoint.
  530.  
  531. 3    Click Debug  Continue.
  532.  
  533. To animate a macro
  534.  
  535. 1    Click Edit  Settings.
  536.  
  537. 2    Click the Debug tab.
  538.  
  539. 3    In the Animate settings area, enable one of the following options:
  540.  
  541.   RunTo does 'step into'-executes the next single statement
  542.   
  543.   RunTo does 'step over'-executes the call of the label or routine without stopping until it has completed
  544.   
  545. 4    Type a value in the Delay (seconds) box.
  546.  
  547. This value specifies the number of seconds the macro should display after executing each step.
  548.  
  549. 5    Click OK.
  550.  
  551. 6    Click Debug  Animate.
  552.  
  553. Tip
  554.  
  555.   When correcting compilation errors, start at the beginning, correcting errors that are obvious and leaving the others until later, as some of these errors may have been caused by an earlier error.
  556.   
  557. To view the meaning of commands from the PerfectScript debugger
  558.  
  559.   Point to a command line.
  560.   
  561. When you pause on a line of code, the command or variable name and definition is displayed.
  562.  
  563. Editing and deleting macros in PerfectScript
  564.  
  565. You can edit a macro by adding new and modifying existing commands. If you have written a macro for Corel Presentations, you can only edit the macro from within WordPerfect or by using the PerfectScript utility. You can also delete macros.
  566.  
  567. To edit a macro
  568.  
  569. 1    Click Tools  Macro  Edit.
  570.  
  571. 2    Choose the drive and folder where the macro is stored.
  572.  
  573. 3    Click a filename.
  574.  
  575. 4    Click Edit.
  576.  
  577. 5    Edit the macro commands.
  578.  
  579. 6    Click Save & compile.
  580.  
  581. 7    Click Options  Close macro on the macro toolbar.
  582.  
  583. To delete a macro
  584.  
  585. 1    Click Tools  Macro  Edit.
  586.  
  587. 2    Choose a macro.
  588.  
  589. 3    Press DELETE.
  590.  
  591. Adding search capabilities to macros
  592.  
  593. WordPerfect allows you to add search capabilities to a macro. You can apply all of the search functionality included in WordPerfect when you are searching in a macro.
  594.  
  595. To add search capabilities to a macro
  596.  
  597. 1    Click Tools  Macro  Edit.
  598.  
  599. 2    Click in the macro where you want to add the search capability.
  600.  
  601. 3    Click Tools  Macro  Record.
  602.  
  603. 4    Click Edit  Find and replace.
  604.  
  605. 5    Type text in the Find box.
  606.  
  607. If you want to search for codes, click Match  Codes, and choose any codes from the Find codes list box.
  608.  
  609. 6    Type text in the Replace box.
  610.  
  611.  
  612.  
  613.  
  614.