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

  1. To customize macro toolbar buttons,
  2.  
  3. 1    Select Tools, Settings, then click the Toolbar tab.
  4.  
  5. 2    Choose the macros that you want associated with each button.
  6.  
  7. Tips
  8.  
  9. * The PerfectScript toolbar displays three buttons that can be configured to play any macro that you choose. 
  10. * A Windows shell menu item of "Debug" has been added for macros. It is displayed on the context menu for a desktop icon for a macro.
  11. * The toolbar in PerfectScript and the Macro Debugger is shown as a flat toolbar, similar to other applications within the WordPefect Office.
  12. To record macros in JavaScript,
  13.  
  14. 1    Select Tools, Settings, then click the Record tab.
  15.  
  16. 2    Select "JavaScript" as the script language.
  17.  
  18. Removing source from macros
  19.  
  20. When removing source from macros in PerfectScript, the macros are changed so that they cannot be accidentally edited in WordPerfect. In addition, you can now remove source from macros compiled from previous versions of PerfectScript.
  21.  
  22. When you remove source from a macro, the Options dialog displays the option to remove the source or protect the macro from being accidentally edited in WordPerfect. The Options dialog also stores and displays the current state of the macro (i.e. if source code has been removed from the macro or if the macro is marked as protected). 
  23.  
  24. The protected macro file type is accepted for all commands. Once a macro is marked as protected, if may be compiled and played, but not opened in WordPerfect. Any attempt to open a protected macro in WordPerfect will generate an unknown file type error. The operation of removing source code from a macro cannot be reversed, and this item may appear disabled in the Options dialog. However, marking a macro as protected can be reversed, and this option is always enabled in the Options dialog.
  25.  
  26.  
  27.  
  28. Selecting files with the Open/Save dialog
  29.  
  30. When you use the Open/Save dialog to select a file, the position and size of the dialog are recorded so that when you return to it, it maintains is size and position during the current session of PerfectScript.
  31.  
  32. Shift and help clicking in the Command Inserter
  33.  
  34. Shift clicking (holding down the shift key and clicking) and help clicking (selecting the "?" button in the caption bar and clicking) are now easier to use in the Commands list box. In previous versions of PerfectScript, the command specific help was invoked for the item already selected and the item clicked on was not selected first. As a result, in order to get the command specific help for a command in the Commands list box, you had to first select the desired command and then shift click or help click. 
  35.  
  36. This pre-selection is now combined into the Shift clicking and help clicking in order to eliminate any extra steps and confusion that accompanied the previous method of invoking the command specific help.
  37.  
  38. Tips
  39.  
  40.   Selecting SHIFT|CTRL|ALT when clicking a command in command listbox displays the return enumerations (if any) for that command.
  41.   
  42.   When command names, parameters names, or enumerations are too wide for the listbox, a horizontal scrollbar displays for easier navigation of the list items.
  43.   
  44.   Click the Return Values button in the Command Inserter to return value enumerations for those commands that have enumerations as return values.
  45.   
  46.   The name of the appliatio attached to the Command Inserter is displayed in the caption bar of the Command Inserter.
  47.   
  48.   The command list for the application attached to the Command Inserter is initially displayed when the Command Inserter is opened.
  49.   
  50. Using default values with Parameters of commands
  51.  
  52. For most optional enumeration parameters of commands, a default value is passed when the parameter is left off and in some cases, leaving off the optional enumeration parameter performs a different function. The default enumeration values, if any, for these parameters is now displayed in bold text in the Enumerations list box. 
  53.  
  54. There are some cases where the default value is a combination of enumerations. In this case, several enumerations may be defined with the same value as synonyms for each other. All enumerations defined with the same value as the default value are hilighted.
  55.  
  56. About Breakpoints
  57.  
  58. Use Breakpoints to indicate locations in the macro file where execution of the macro should be interrupted and suspended, and where the Debugger should become active to allow you to examine state of the macro. You can specify the conditions under which you want the Debugger to stop the macro as it plays and bring up the Debugger dialog box. You can make the macro stop at any line, .DLL call, or other place in a macro. The Debugger dialog will then display the labels, functions, procedures, variables being passed, and so on, so you can check them. All breakpoints allow a message to be logged to the Debugger's Event Log.
  59.  
  60. Each individual breakpoint may be disabled. When disabled, a breakpoint is ignored even if its conditions occur. Additionally, all breakpoints may be temporarily disabled. This causes no breakpoints to be recognized. This is temporary, and all breakpoints revert to their previous state when the temporary disable is ended, or when the macro ends and the Debugger terminates.
  61.  
  62. The Debugger automatically creates three breakpoints: Macro Start, Macro End, and Error. It marks the breakpoints it adds with an !, and you can remove these if you want to.
  63.  
  64. The Breakpoints dialog has a context menu that allows breakpoints to be sorted by various columns. 
  65.  
  66. These are the types of breakpoints you can use:
  67.  
  68. * DLL Call: Breaks when your macro calls a .DLL file.
  69. * Error: Breaks when an error occurs while running the macro.
  70. * Label/Routine Call: Breaks when a label or user-defined routine comes up in the macro. Everything that is not specifically contained in a routine or label is in the <main> routine.
  71. * Label/Routine Return: Breaks when a label or user-defined routine comes up in the macro, but stops before executing the return from the label call.
  72. * Line Number: Breaks when the macro reaches a line number you specify. This is the most common type of breakpoint. It suspends and brings up the Macro Debugger when execution of the macro reaches a specified line number.
  73. * Product Call: Breaks when the macro makes a call to an application or product..
  74. * Variable Access: Breaks when the macro accesses a variable.
  75. * Variable Assign: Breaks when the macro assigns a value to a variable.
  76. If you do not specify a different macro file, the breakpoint will apply to all the macro files used by the macro you are debugging. If you want to limit the breakpoint to a single macro file, specify that file along with the other breakpoint information.
  77.  
  78. Most breakpoints allow you to specify a passcount as well as other information. A passcount is the number of times that the breakpoint conditions can occur before the breakpoint actually takes effect. Each time the conditions occur, the passcount decrements, and when the count reaches zero, the breakpoint triggers and causes a break into the Debugger.
  79.  
  80. For information about controls on the dialog box, click, then click a control.
  81.  
  82.     About the Event Log
  83.  
  84.     To make a debugger log file
  85.  
  86.     To search macro source code
  87.  
  88.     To specify where you want the Debugger to stop while playing a macro
  89.  
  90. To enable and disable breakpoints,
  91.  
  92. 1    Right-click a line with a breakpoint, then click Enable/Disable All Breakpoints to toggle breakpoints on and off for the entire macro at once.
  93.  
  94. Tips
  95.  
  96. * Right-click a line with a breakpoint, then click Disable Breakpoint to force the Debugger to ignore an individual Line Number breakpoint.
  97. * Right-click a disabled breakpoint, then click Enable Breakpoint to allow the Debugger to see the breakpoint again.
  98. * To remove a breakpoint, right-click the line with the breakpoint you want to delete, then click Remove Breakpoint.
  99. To specify where to stop the Debugger while playing a macro,
  100.  
  101. 1    Click File  Debug  Play.
  102.  
  103. 2    Specify the macro you want to play with the Debugger.
  104.  
  105. 3    When the Debugger dialog box opens, click Debug  Breakpoints  Edit.
  106.  
  107. 4    Select the type of breakpoint you want to use, then click Add.
  108.  
  109. 5    Specify the options you want to use for the type of breakpoint you added, then click Update.
  110.  
  111. Tips
  112.  
  113. ¿    Each type of breakpoint has different options. Press Shift+F1, then click a control for specific information.
  114.  
  115. ¿    You can add a Line Number breakpoint easily by double-clicking the line in the macro source list where you want the macro to pause.
  116.  
  117. About Compiling Macros
  118.  
  119. A macro compiler is used to format macros so that applications can play them. This is called compiling. Macros in WordPerfect Office applications are compiled when you play or record them.
  120.  
  121. If you receive an error message while the macro is compiling, you can choose Cancel Compilation to close the dialog box, or you can choose Continue Compilation to check for other errors that may be in the macro. In either case, the macro will not play. You must correct all errors, then recompile the macro to play it.
  122.  
  123. The Cancel button on the Compile Progress dialog is the default button on the dialog. This allows the user to cancel the compilation of a mcro by hitting the Enter key, without having to use the mouse or tab key to shift focus to the Cancel button.
  124.  
  125. To set compile settings, click Tools|Settings and select the Compile tab. The "Warn when using unsupported features" option defaults to True.
  126.  
  127. Note
  128.  
  129. The following conditions will return a compile error:
  130.  
  131. * No "return" statement is found in the body of a user-defined function. A "return (0)" statement is generated by the Compiler.
  132. * A "return" statement with no return value is found in the body of a user-defined function. A value of 0 is returned.
  133. * The macro appears to be empty when compiled. This occurs because an empty macro could be a previously compiled macro which has had its source removed. Compiling such a macro will destroy the existing compiled macro object.
  134. * An obsolete or unsupported feature is found in a macro during compilation. These warnings can be safely ignored and produce a successful macro - they serve as reminders only. Warnings are displayed when an old EN English synonym us used in the Application statement (US, UK, CE, OZ), or when an obsolete/unsupported command, enumeration, or parameter is used. There is a setting on the Compiler page that allows the user to enable/disable these warnings. This setting is initially enabled.
  135.  
  136.  
  137. For information about controls on the dialog box, click, then click a control.
  138.  
  139.     To convert a macro to WordPerfect format
  140.  
  141.     To compile macros
  142.  
  143.     Related topics
  144.  
  145. To compile macros,
  146.  
  147. 1    Click File  Compile.
  148.  
  149. 2    Select the macro you want to compile.
  150.  
  151. Tips
  152.  
  153. ¿    While compiling a macro, you can click File  Stop Compile if you need to halt the compile process.
  154.  
  155. ¿    If you are compiling an older macro or one in a different format, you will need to convert it into a more current format.
  156.  
  157. ¿    If your macro references labels and routines not defined inside it, you will get a warning when the compiler reaches that point. As long as the labels and routines are defined in another macro that the current macro calls, there will not be a problem running the macro later.
  158.  
  159. ¿    You can also compile macros by selecting a macro file name in the Explorer, then clicking Compile from the QuickMenu.
  160.  
  161. About Convert Macro to WordPerfect Format
  162.  
  163. Use Convert Macro to WordPerfect Format to convert a macro to a format your Corel suite applications can use. You can replace the macro or save it under a different filename or in a different directory.
  164.  
  165. For information about controls on the dialog box, click, then click a control.
  166.  
  167.     To convert a macro to WordPerfect format
  168.  
  169. To convert a macro to WordPerfect format,
  170.  
  171. 1    Click File  Play.
  172.  
  173. 2    Select the macro you want to convert.
  174.  
  175. 3    Specify a path and filename for the converted macro.
  176.  
  177. About PerfectScript
  178.  
  179. PerfectScript is an application that you can use to record, play, compile, convert, and edit macros and to build or edit dialog boxes for macros. A macro is a series of commands and menu selections in a file that can be replayed using a few keystrokes or a mouse click.
  180.  
  181. Use macros to record commands that perform tasks automatically. For example, you can create a macro that retrieves a file, gives it a new name, and saves it in another format.
  182.  
  183. Use About PerfectScript for information about your version number, the release date, program paths, and memory usage. 
  184.  
  185. PerfectScript checks system registry settings as part of its startup. If incorrect entries are found, a warning is displayed and, if the user has write access to the system registry, PerfectScript notifies the user before correcting the system registry entries.
  186.  
  187. For information about controls on any dialog box, click, then click a control.
  188.  
  189. To exit PerfectScript,
  190.  
  191. 1    Click File  Exit.
  192.  
  193. About PerfectScript Commands
  194.  
  195. Use PerfectScript Commands to select, edit, and insert macro commands into a macro. PerfectScript Commands gives you access to application-specific commands (such as commands that function only in Corel Presentations) and commands that are common to all WordPerfect suite applications. The PerfectScript Command Inserter allows you to easily insert product commands into a macro you are building.
  196.  
  197. Many macro commands use parameters, which are variables used with a command to indicate a specific value or option.
  198.  
  199. Product commands perform functions that let you use suite applications features in your macros. Many product commands require you to specify parameters and value set members; these give applications information about options to choose in dialog boxes and specify whether certain features (such as the Ruler) should be displayed or hidden. You can use the Command Inserter to specify the commands quickly.
  200.  
  201. Programming commands allow you to control how application features act and interact. For example, you can use programming commands to request information from the user or specify that part of a macro run several times. The Command Inserter displays the proper syntax of the programming command you select.
  202.  
  203. When you use the Command Inserter, you can spend less time typing and worrying about spelling errors. You simply choose the commands and parameters you want from the list boxes and insert them into your macro.
  204.  
  205. For more information on individual macros, select the macro you want from the Commands list box, then right-click the command.
  206.  
  207.     To edit macros
  208.  
  209.     To insert macro commands
  210.  
  211.     Tips for Macro Commands and Syntax
  212.  
  213. To insert macro commands,
  214.  
  215. 1    Click File  Edit.
  216.  
  217. 2    Select the macro you want to work on, then click Edit.
  218.  
  219. 3    Move the insertion point to the place in the macro where you want to insert the commands.
  220.  
  221. 4    Click Commands on the Macro Property Bar to open the Command Inserter.
  222.  
  223. 5    Select the type of command you want to insert, then select and double-click a command.
  224.  
  225. 6    Select a parameter, type in or select the value for the parameter, then click Update.
  226.  
  227. 7    Double-click enumerations to add both the parameter and enumerations.
  228.  
  229. 8    Click Insert to place the new command in the macro.
  230.  
  231. Tips
  232.  
  233. ¿    You can edit a parameter by selecting the parameter and changing its value in the Command Edit text box.
  234.  
  235. ¿    Before you can use the Command Inserter, use the Edit tab on the Settings dialog box to specify WordPerfect as the default macro editor.
  236.  
  237. ¿    If you are using the Command Inserter that has a Parameter Value text box, you can select the command to insert, then type in a value for the parameter. Clicking Value lets the application automatically insert a value for the parameter, and clicking Update changes the display to reflect the new value.
  238.  
  239. About Corel Web Site
  240.  
  241. If you have installed a World Wide Web browser, and have a modem or network connection to an Internet service provider, you can click Help  Corel Web Site (www.corel.com)and go to the Corel home page for WordPerfect Office. 
  242.  
  243. The home page contains links to:
  244.  
  245. ¿    Technical Information Documents from Customer Services
  246.  
  247. ¿    Hints and tips, demos, and other task-oriented resources
  248.  
  249.     Related topics
  250.  
  251. About Create New Variable
  252.  
  253. Use Create New Variable to add a new local, global, or persistent variable to the macro you are debugging.
  254.  
  255.     To create new variables
  256.  
  257.     To delete a variable while debugging a macro
  258.  
  259.     Related topics
  260.  
  261. To create new variables,
  262.  
  263. 1    Click File  Debug  Play.
  264.  
  265. 2    Select a macro you have compiled for debugging, then click Play.
  266.  
  267. 3    When the Debugger stops at the place you want to add a variable, click Variables  New.
  268.  
  269. 4    Type a name for the variable, click a variable type, then click Create.
  270.  
  271. About Debugging Macros
  272.  
  273. Use the PerfectScript Debugger to play and compile macros to find errors. The main benefit of the macro is that it helps you eliminate errors in your macros by providing access to information as a macro executes. The Debugger provides information both about the contents of variables and the flow of execution in a macro.
  274.  
  275. You can go straight through macros, step by step, or set specific breakpoints for checking variables. By setting the appropriate types of breakpoints in the appropriate places, and by examining of the information provided by the Debugger, you can usually narrow down and determine the cause of macro problems. In addition, since the Debugger lets you modify the normal flow of execution when needed, the Debugger can also allow you to make some temporary corrections to the current state of a macro to bring the actual state back in alignment with the expected state.
  276.  
  277. To begin debugging a macro, first use the Debugger to compile the macro, and any other macro file that it Uses or Runs or Chains to, to include debugging information, and to generate a compiler listing file that the Debugger can use. As the Debugger compiles a macro, it numbers each line of the macro. These numbers appear beside each line of the source code of the macro, which displays as the macro plays. The added lines of source code make the macro a bit larger, but make it possible for you to debug it more easily. In order to see the macro source code in the Debugger, you need to select the "Include debug information" check box on the Compile tab in the Settings dialog box.
  278.  
  279. Because the compiler does not format the code in your macro the same way a WordPerfect suite application does, you may want to generate a list file when you compile your macro. The list file makes a copy of each procedure and numbers each line, so you can tell which part of the macro corresponds to each line number. It also lists error messages and warnings that came up during the compile at the bottom of the file. Using the list file makes it easy to find and correct errors that the Debugger catches.
  280.  
  281. You can debug a macro directly with PerfectScript. You can also select options in the Settings dialog box that allow you to automatically compile macros for debugging from any application in the Suite.
  282.  
  283. Restarting Macros
  284.  
  285. The Macro Debugger has the ability to restart a macro while it is running. This capability is assigned to the SHIFT-F5 accelerator key. When a macro is restarted, all variables created by the macro, except Persistent variables, are deleted and the Debugger will begin at the top of the macro. All other state information is reset to the initial conditions so that when the macro is restarted, it is as if the macro has not yet been run. A macro can be restarted once it has finished running.
  286.  
  287. Displaying Variables
  288.  
  289. At each breakpoint, the Macro Debugger displays the contents of the current variables in the variable list, including the values of array variables, where the contents of all the elements are displays in an abbreviated list. But when an array has a large number of elements, the display of all elements is time consuming and of little practical value, so only the value of the first 25 elements are displayed. However, he values of all array elements are still visible by expanding the array. 
  290.  
  291. Expanding an Array in the Variable List
  292.  
  293. Expanding the contents of an array in the Macro Debugger can consume a great deal of time and memory. To speed up the process, only the first 100 elements of an array are initially displayed. When the array is expanded, a warning prompt is displayed, asking if all elements should be expanded, or just the first 100 elements. An additional 101st element is also displayed, representing the remaining elements in the array, without their values. The remaining elements can be displayed by clicking the [...] icon next to the 101st element, or by collapsing the array and expanding it again, which prompts the same warning, allowing the user to select the option that expands all elements. 
  294.  
  295. Debugger Config File
  296.  
  297. When the debugger config file is loaded, the version number check is for <= the current version (the version number of the macro system differs slightly from the version number of the PerfectScript shared code). When a macro is debugged, a common config file, STARTUP.DBG, and its commands, are loaded before the config file for the macro.
  298.  
  299. The following items are recorded and restored in the Debugger config file when a macro is debugged:
  300.  
  301. * Macro listing filename is saved with macro filenames in the MRU list
  302. * Which info windows are open
  303. * Which variable pools are displayed
  304. Refreshing the Variable List
  305.  
  306. Whenever the Macro Debugger stops at a breakpoint, the contents of all variables are refreshed and displayed. When a macro contains a large number of variables, this process can be quite lengthy, so the Debugger can be configured to display on the first few variables, which speeds up the time it takes to refresh the list. The Debugger will initially display the first 100 variables, but at any time, the contents of all variables can be displayed by selecting the menu item "Show All Variables".
  307.  
  308.  
  309.  
  310. For more information about controls on the dialog box, click, then click a control.
  311.  
  312.     About the Debugger Interface
  313.  
  314.     About Moving Through Macros While Debugging
  315.  
  316.     To choose debugging options for macros
  317.  
  318.     To debug macros
  319.  
  320.     To edit macros
  321.  
  322.     To generate a listing file for debugging macros
  323.  
  324.     To search macro source code
  325.  
  326.     To select debugging options
  327.  
  328.     Tips for Debugging Macros
  329.  
  330.     Related Topics
  331.  
  332. To choose debugging options for macros,
  333.  
  334. 1    Click File  Debug  Play.
  335.  
  336. 2    Select the macro you want to debug.
  337.  
  338. 3    Click Debug  Breakpoints  Edit, set the breakpoints you want in the macro, then click Close.
  339.  
  340. 4    Click View  Variables, then select the types of variables you want to display.
  341.  
  342. 5    Click Variables  New to create new variables.
  343.  
  344. 6    Select a variable, then click Variables  Delete to remove it.
  345.  
  346. 7    Click Debug  Continue to play the macro through, or click a Step option.
  347.  
  348. To create and edit variables in your macro,
  349.  
  350. 1    Click File  Debug  Play.
  351.  
  352. 2    Specify the macro you want to debug.
  353.  
  354. 3    Select the types of variables you want to display.
  355.  
  356. 4    Select a variable, or double-click an array, then select a variable within it.
  357.  
  358. 5    Edit the contents of the variable, then click Update.
  359.  
  360. 6    Click Variables  New, type a name for the new variable, then click a variable type to add a variable to the macro.
  361.  
  362. 7    Click Variables  Delete to remove a variable.
  363.  
  364. Tips
  365.  
  366. ¿    The Variables list displays all of the variables defined at the current step in the macro. As you click the entries in the label, function, or procedure list, the variables in the list change, displaying the local variables defined in each step.
  367.  
  368. ¿    Updating the value of a variable that is an alias for another variable changes the original value, and all other aliases will reflect the new value.
  369.  
  370. To debug macros,
  371.  
  372. 1    Click File  Debug  Play.
  373.  
  374. 2    Specify the macro you want to debug.
  375.  
  376. 3    Select the types of variables you want to display.
  377.  
  378. 4    Click Debug  Continue to play the macro through, or click a Step option.
  379.  
  380. 5    Correct the errors using the macro editor you selected and the Contents text box for variable values.
  381.  
  382. Tips
  383.  
  384. ¿    Press Shift+F1, then click a control for specific information.
  385.  
  386. To generate a listing file for debugging macros,
  387.  
  388. 1    Click Tools  Settings, then click the Compile tab.
  389.  
  390. 2    Select Generate listing file, then click OK.
  391.  
  392. 3    Click File  Debug  Compile.
  393.  
  394. 4    Select the macro you want to compile, then click Open.
  395.  
  396. Tips
  397.  
  398. ¿    The list file has the same name as the original macro, with a .WCL extension. Use any ASCII text editor to display the list file, so you can see which lines in your macro correspond to which line numbers.
  399.  
  400. To search macro source code,
  401.  
  402. 1    Click Edit  Find Line Number, then specify the line number you want to find.
  403.  
  404. 2    Click Edit  Find Text, then specify the text you want to find.
  405.  
  406. 3    Click Find Next Breakpoint or Find Previous Breakpoint to locate the breakpoints in the macro.
  407.  
  408. Tips
  409.  
  410.   You can search for text, line numbers, and breakpoints in the macro source code.
  411.   
  412.   Once you have specified the search text, you can click Find Next or Find Previous to find other occurrences.
  413.   
  414. To select debugging options,
  415.  
  416. 1    Click Tools  Settings, then click the Debug tab.
  417.  
  418. 2    Select the options you want to use for invoking the Debugger.
  419.  
  420. 3    Select the options you want to use for recording debugging information during compiling.
  421.  
  422. 4    Set your animation options.
  423.  
  424. Tips
  425.  
  426. ¿    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. Clicking inside the Debugger halts the animation, as do any breakpoints you have specified. Click Debug { bmc stprticn.bmp } Animate to resume automatic play.
  427.  
  428. About the Debugger Interface
  429.  
  430. The Debugger is designed to help you find and correct errors and other problems in your macros. The Debugger dialog consists of four main areas: The last three are lists separated by split bars you can use to adjust the size of the individual lists in relation to the others. Each of the three lists supports a context-sensitive (right mouse) menu containing items relevant to that list. The items available on these menus are also available from the toolbar and the main menu bar of the Debugger dialog.
  431.  
  432. Tips
  433.  
  434. * The splitbars between the Source List, Call History and Variable List windows may receive focus ans when it has focus, its position can be changed using the arrow keys on the keyboard. The arrow keys will move the splitbar by 1 pixel. Holding the SHIFT key with the arrow keys will move the splitbar by 5 pixels. Holding down the CONTROL key will move the splitbar by 10 pixels.
  435. The Debugger State Message Line
  436.  
  437. The Debugger state message line indicates whether the Debugger (or the macro) is active, and the reason the Debugger is active (such as a breakpoint on a statement start, error condition, and so on). While the Debugger interface is active, execution of the macro is suspended. This means that you cannot interact with prompts, message boxes, or dialogs that are being displayed by the macro. When the macro is playing, the state message line reads "Macro is running." You can use some debugger features while the macro runs (for example, setting breakpoints). All commands that would access information about the macro state, however, are disabled while the macro is running and the Debugger is inactive.
  438.  
  439. The Toolbar
  440.  
  441. You can display or hide the toolbar in the Macro Debugger. Displaying the toolbar is helpful, giving you instant access to a wide range of features. You can also customize the toolbar by double-clicking a blank space on the toolbar to display the Customize Toolbar dialog box. From this dialog, you can remove, add, or reorder the toolbar buttons. The same toolbar configuration is used when debugging all macros.
  442.  
  443. Since there is a limit on the number of variables that are initially displayed in the Macro Debugger, click 
  444.  
  445. The Macro Source List
  446.  
  447. The macro source listing displays the source of the macro being debugged (taken from the compiler listing file). It displays a red arrow to the left of the line the macro will execute next. The left margin also contains an indicator showing which statements have breakpoints, and whether those breakpoints are enabled or disabled.
  448.  
  449. The macro source list also displays a floating tip about the variable, label, token, or command you place your mouse pointer over, showing details about the item. If the item is a variable that has not yet been defined, or a label defined in a "use" file that has not yet been loaded, then the Debugger may be unable to identify it and will display "??".
  450.  
  451. You can place a breakpoint on any macro source line containing macro statements by double clicking the source line. Once defined, a breakpoint may be enabled or disabled from the source listing as well. You can also display the source of another macro file (such as a use file) in the macro source area by clicking File  Open. The last 9 accessed macro files are listed on the File menu.
  452.  
  453. The Call History List
  454.  
  455. The call history list area lists the user-defined functions/procedures and labels that have been called, in reverse order. The current location is listed at the top. The name of the function/procedure or label displays along with the line number where execution within that function/procedure or label was interrupted, and the file that the function/procedure or label is contained in.
  456.  
  457. When you select entries in the call history list, the macro source for that macro is displayed in the source listing area, and the associated line is highlighted and indicated by a green triangle in the left margin (unless the top entry is selected, in which case the red arrow is displayed). The variables accessible to the macro at that point are then listed in the variables area below.
  458.  
  459. The Macro Variable List
  460.  
  461. The variables area displays the list of variables accessible to the macro at the indicated location (shown in the Call History List). Also displayed are the variable's pool type (Local, Global or Persistent), the type of value the variable contains, and the current value of the variable. You can restrict the list of variables to any combination of the Local, Global, or Persistent pool variable types. Even though multiple variables with the same name in different pools may appear in the list, only the most locally scoped variable with that name is accessible to the macro as it executes (e.g. If there is both a Local and a Global variable named B, only the Local B may be accessed by the macro. Once a variable has been declared with the DECLARE, LOCAL, GLOBAL, or PERSIST statements in a macro, the variable will show up in this list even though its contents may be undefined.
  462.  
  463. Array variables are displayed in this list with their declared dimensions and a contents type of Array. You can expand array variables to display the individual array elements in the list, or collapse them to hide the individual elements. This lets you examine the individual elements of the array as normal variables. If a variable is an address (alias) parameter to a user-defined function/procedure, its contents type is displayed as Alias, and it may be expanded and contracted like an array to show the actual variable that it is mapped to. If an alias variable is mapped to a Global or Persistent variable, then the variable pool type is displayed appropriately. If it is a Local variable, then the pool type is displayed as "Local to Caller," to distinguish it from a variable that is local to the current function/procedure.
  464.  
  465. The list of variables may be sorted by any of the columns by clicking the column heading. You can toggle the sort order from ascending to descending by clicking the same heading a second time. If the variable list is sorted by variable name or by pool, then expanded array elements are kept with their corresponding array. Sorting by the other columns may cause elements of an array to become separated from each other, depending on the contents of the array element. The current sort column and sort order are indicated by a ">" or "<" symbol before the column heading name.
  466.  
  467. You can create new variables in any variable pool, and you can also create an array variable by specifying the dimensions of the array after its name. Variables are created with undefined contents; you supply the value at any time. You may also reset or discard a variable by pressing the Delete key. You should consider carefully before discarding a variable, since the macro may rely on the variable being defined. Discarding an array variable (not an array element), will first reset the contents of all of its array elements.
  468.  
  469. You can change the contents of a variable (or array element) by double clicking the variable or clicking the contents column for that variable. Update the contents of the variable by clicking outside the edit field, or pressing the Return key. The changes are canceled by pressing the Esc key. You cannot change the contents of an alias variable, but you can change the variable mapped to the alias. If you change the contents of an array, the new value is placed in all of its array elements. Changing the contents of an array element changes that element only, and does not affect the contents of any other array elements.
  470.  
  471. If you are interested only in certain macro variables, you can add those variables to the variable watch list. Displaying only a few variables makes it easier for you to see only the information you are most interested in. Only entire arrays or non-array variables may be watched; individual array elements cannot be watched separate from their corresponding parent array. When the variable watch list is displayed, it replaces the normal variables list.
  472.  
  473. Displaying Variables At each breakpoint, the Macro Debugger displays the contents of the current variables in the variable list, including the values of array variables, where the contents of all the elements are displays in an abbreviated list. But when an array has a large number of elements, the display of all elements is time consuming and of little practical value, so only the value of the first 25 elements are displayed. However, he values of all array elements are still visible by expanding the array. 
  474.  
  475. Expanding an Array in the Variable List Expanding the contents of an array in the Macro Debugger can consume a great deal of time and memory. To speed up the process, only the first 100 elements of an array are initially displayed. When the array is expanded, a warning prompt is displayed, asking if all elements should be expanded, or just the first 100 elements. An additional 101st element is also displayed, representing the remaining elements in the array, without their values. The remaining elements can be displayed by clicking the [...] icon next to the 101st element, or by collapsing the array and expanding it again, which prompts the same warning, allowing the user to select the option that expands all elements. 
  476.  
  477. Refreshing the Variable List Whenever the Macro Debugger stops at a breakpoint, the contents of all variables are refreshed and displayed. When a macro contains a large number of variables, this process can be quite lengthy, so the Debugger can be configured to display on the first few variables, which speeds up the time it takes to refresh the list. The Debugger will initially display the first 100 variables, but at any time, the contents of all variables can be displayed by selecting the menu item "Show All Variables".
  478.  
  479.  
  480.  
  481.     About Debugging Macros
  482.  
  483.     About Information Windows in the Debugger
  484.  
  485.     To choose debugging options for macros
  486.  
  487.     To create new variables
  488.  
  489.     To delete a variable while debugging a macro
  490.  
  491.     To debug macros
  492.  
  493.     To edit macros
  494.  
  495.     To generate a listing file for debugging macros
  496.  
  497.     To select debugging options
  498.  
  499.     To watch certain variables
  500.  
  501. To watch certain variables,
  502.  
  503. 1    Right-click the variable in the macro variable list.
  504.  
  505. 2    Click Watch.
  506.  
  507. 3    Right-click the macro variable list, then click View  Watch to display only the variables you have marked as watched in the list.
  508.  
  509. Tips
  510.  
  511.   Once a variable is added to the variable watch list, that variable name is displayed in the list until you remove it from the list, even if the actual variable ceases to exist (for example, if it is discarded in the macro). If the variable ceases to exist, the pool type of the watch variable will display "out of scope."
  512.   
  513. About Discard Variable
  514.  
  515. Use Discard Variable to remove a variable while debugging a macro. You can delete the variable from the Variables list box, or you can remove the contents of the variable but leave it in the Variables list box.
  516.  
  517.     To delete a variable while debugging a macro
  518.  
  519. To delete a variable while debugging a macro,
  520.  
  521. 1    Click File  Debug  Play.
  522.  
  523. 2    Step through the variable until the variable you want to discard appears in the Variables list box.
  524.  
  525. 3    Click the variable name.
  526.  
  527. 4    Click Variables  Delete.
  528.  
  529. 5    Click the discard option you want.
  530.  
  531. About Editing Macros
  532.  
  533. Use the Editor you specified in the Settings dialog box to edit existing macros. You can use any ASCII text editor to edit your macros, but some editors have special features. When you use Notepad, you can also create new macros by typing a new filename. When you use WordPerfect to edit your macros, you can use the PerfectScript Command Inserter from the Macro Property Bar to insert macro commands into your macros or to edit existing ones.
  534.  
  535. For information about controls on the dialog box, click, then click a control.
  536.  
  537.     To edit macros
  538.  
  539.     To generate a listing file for debugging macros
  540.  
  541. To edit macros,
  542.  
  543. 1    Click File  Edit.
  544.  
  545. 2    Specify the name of the macro you want to edit, then click Edit.
  546.  
  547. 3    If necessary, click Convert to convert the macro for editing.
  548.  
  549. 4    Make the changes you want to the macro, then exit the macro editor.
  550.  
  551. Tips
  552.  
  553. ¿    Before you can edit a macro, you need to specify a macro editor in the Settings dialog box.
  554.  
  555. ¿    You can also edit macros by selecting a macro file name in the Explorer, then clicking Edit from the QuickMenu.
  556.  
  557. About Event Log
  558.  
  559. The Event Log displays any event that occurs during debugging. These messages include standard messages ("Debugger event logging enabled") and custom messages for which you supply the comment.
  560.  
  561. All breakpoints allow a message to be logged to the Debugger event log. When the breakpoint triggers, this message is written to the Debugger event log (if the event log is enabled). A breakpoint may be set up to log a message, to cause a break in the macro, or both. In the left margin of the breakpoint list, a hand symbol is displayed. A yellow hand indicates a breakpoint that will cause a break in the macro (and may also log an event message), while a blue hand indicates a breakpoint that will log an event message and not cause a break in the macro.
  562.  
  563. To enable event logging, click Debug  Breakpoints, then click the Actions tab. You can log standard and custom messages, which will then appear in the Event Log.
  564.  
  565.     To make a debugger log file
  566.  
  567. To make a debugger log file,
  568.  
  569. 1    Click Debug  Breakpoints  Event Log.
  570.  
  571. 2    Select the types of events you want to enter into the log file, then click Close.
  572.  
  573. 3    Start the Debugger, then click View  Event Log.
  574.  
  575. 4    Select Logging enabled.
  576.  
  577. 5    Click Save, then specify a path and filename for your event log.
  578.  
  579. Tips
  580.  
  581. ¿    Your event log is a text file with a default .log extension.
  582.  
  583. About Execute Token
  584.  
  585. When the Macro Debugger is active and the macro is suspended (the macro has stopped at a breakpoint), the Debugger allows you to execute any PerfectScript command (token) in a very localized temporary environment. It displays the PerfectScript commands along with their parameters and types, and lets you select a command and specify a value for each parameter. When you execute the command, the return value is displayed, and if you specified a variable name for the return value, then the return value will also be assigned to that variable.
  586.  
  587. Be careful when using Execute Token, since some PerfectScript commands may cause the internal state of the running macro to change and may cause errors to occur later in the macro. Most of these commands have been eliminated from the command list, and cannot be selected.
  588.  
  589. Values cannot be assigned to variables that have the same name as command token names. 
  590.  
  591. 3rd Party Tokens PerfectScript supports 3rd party token handler DLL's. All tokens (not just its own) are passed to the ValidateToken entry point. If the 3rd party DLL does not accept or approve the token, it can cause PerfectScript to abort the macro. PerfectScript's own tokens are passed to the HandleToken entry point in the 3rd party DLL's. 
  592.  
  593.     To execute a macro token while debugging
  594.  
  595. To execute a macro token while debugging,
  596.  
  597. 1    Click View  Execute Token.
  598.  
  599. 2    Select the PerfectScript token you want to execute, then specify any parameter and return values you want to use.
  600.  
  601. 3    Click Execute to perform the command and display any return value.
  602.  
  603. Tips
  604.  
  605.   Be careful when using Execute Token, since some PerfectScript commands may cause the internal state of the running macro to change and may cause errors to occur later in the macro. Most of these commands have been eliminated from the command list, and cannot be selected.
  606.   
  607.   A keyboard accelerator of ALT+0 has been added for the Execute Token dialog.
  608.   
  609. About Information Windows in the Debugger
  610.  
  611. The Debugger includes several separate informational windows you can open to display various types of information about the current state of the macro. These windows are modeless dialogs and are refreshed whenever the Debugger becomes active. Most of the windows display information that is specific to the current execution point in the macro, but by selecting a different entry in the Call History list of the Debugger, you can display information specific to the selected entry.
  612.  
  613. The info windows in the Debugger have context menus containing options to navigate from that window to the other info windows the main Debugger window and to the matching macro source line, if any. In any of these windows where labels, line numbers, or filenames are displayed, double-clicking that item will locate that position in the macro and display it in the macro source list. These items are indicated by a gray arrow in the left margin. These are the information windows available:
  614.  
  615. Label Table: A list of all the labels defined at the execution point selected in the Call History list. For each label, the label name, type, line number, and file name are displayed. The label type is either local or global. Local labels are defined by the Label statement in a macro, and are visible only within the procedure/function where they are defined. Global labels are user-defined procedures and functions, and are visible anywhere in a macro file, as well as in other macro files that have a Use statement of the file containing the procedure/function. The name of the file where the label is defined is displayed, as well as the line number of the source line where the label or procedure/function is defined. Double-click any of these labels to display the macro file in the macro source list window, and highlight the source line containing the label definition.
  616.  
  617. Use File Table: A list of all Use files referenced in Use statements by the macro file selected in the Call History list. If the labels for that Use file have been loaded (this happens the first time a procedure/function is called from the Use file), then the Loaded column shows True. Double-click any Use file in this list to load that file into the macro source list window.
  618.  
  619. Product Table: A list of all the applications/products that have commands in the macro file selected in the Call History list. If an Application statement for an application is in a macro, but the macro does not actually contain any commands for that application, that application will not be displayed in this list. For each application/product listed, the version number of the PID file (product interface description file) that was used when this macro was compiled is displayed. This version number is used to determine if a compiled macro has become out of date when a new version of an application is installed, and the macro is played.
  620.  
  621. Dialog List: A list of all user-created macro dialogs that are currently defined or that exist in the prefix packet of the macro file selected in the Call History list. For each dialog, the name, state, type, callback label, position/size, and styles are displayed. There are 2 types of dialogs: Text dialogs, which are defined using DialogDefine, and DialogAdd statements in a macro; and Binary dialogs, which are created by the Macro Dialog Editor, and are stored in the prefix packet area of a macro file. The states of a dialog are:
  622.  
  623. ¿    Defined: Text dialogs only - the dialog has been defined by a DialogDefine statement, but the dialog has not been loaded or shown yet.
  624.  
  625. ¿    In Prefix: Binary dialogs only - the dialog was found in the prefix packet of the current macro file, but hasn't been loaded or shown yet.
  626.  
  627. ¿    Loaded: Text and Binary dialogs - the dialog has been loaded by a DialogLoad statement, or by a Region command.
  628.  
  629. ¿    Showing: Text and Binary dialogs - the dialog is currently showing by a DialogShow statement.
  630.  
  631. If the dialog is currently showing, and a callback label was specified, then the Callback label is displayed. Double-click this dialog to display the macro file where the callback label is defined in the macro source list window, with the source line containing the label definition highlighted. The position and size of the dialog when it was defined is shown, but this does not display the current position or size of the dialog. The styles associated with this dialog in the DialogDefine statement or in the Macro Dialog Editor are also shown. In the lower half of this window, the list of controls defined for the selected dialog are displayed. For each control, its order, name, type, position/size, associated variable, styles, and data are shown. As with the dialog position and size, the position and size of the control that is displayed is the position and size when the control was defined, not its current position and size.
  632.  
  633. Condition Handlers List: A list of all condition handlers defined for the execution point selected in the Call History list. For each condition handler, an action and data are displayed. The action column tells you whether the condition will cause the macro to abort or quit, or whether the condition will cause a label to be called or jumped to, and the appropriate label. If the handler has been disabled, the action will say Ignore, indicating that the abort, call, or jump will be ignored. If there is a label associated with a condition handler, double-click the item to display the macro file where the label is defined in the macro source list window, and to highlight the source line containing the label definition. The standard condition handlers, such as Error, Cancel, and NotFound are displayed in this list, as well as handlers for callbacks such as OnDDEAdvise and callback dialogs.
  634.  
  635. Macro Info List: A list of all the data that can be obtained from the MacroInfo command in a macro for the execution point selected in the Call History list. Some of these items can have labels, line numbers, or filenames associated with them. Double-click these items to display the macro file in the macro source list window and to highlight the source line containing the label definition or line number.
  636.  
  637. Callback Queue: A list of all items in the callback queue which indicates which callback are currently active and which are pending. It is possible for multiple callbacks to be active at the same time. The callback queue contains entries for callback dialogs and for OnDDEAdvise notifications. The label that will be called by this callback is specified. Double-click this line to display the macro file in the macro source list window and to highlight the source line containing the label definition. The status column indicates whether this callback is for notification only, or whether the callback can affect the action performed by the macro system when the callback is complete. Dialog callbacks are always for notification only. The contents of the callback data array is also displayed, and an interpretation of the specific array elements is also displayed where possible. Callback can be removed from the Callback Queue list. To remove a callback, press the DELETE key to delete the currently selected callback entry from the Queue. A warning displays the confirm the action, since deleting a callback can dramatically alter the bahavior of the macro. 
  638.  
  639. Macro Header: A window that displays the macro object header information for this macro file, including the version number of the macro system used to compile this macro file. This window is a modal dialog.
  640.  
  641. Tip
  642.  
  643. The following accelerator keys are available in the Debugger info windows:
  644.  
  645. Space    jump to the associated macro source line (if any).
  646.  
  647. DEL/Backspace    delete the current callback queue entry.
  648.  
  649. ALT 0/ALT 9    Display one of the Debugger info windows.
  650.  
  651. CTRL Home    Set focus to main Debugger window.
  652.  
  653. CTRL F6        Set focus to next Debugger window.
  654.  
  655. CTRL Down Arrow    Set focus to next Debugger window.
  656.  
  657. SHIFT|CTRL F6    Set focus to previous Debugger info window.
  658.  
  659. CTRL Up Arrow    Set focus to previous Debugger info window.
  660.  
  661.  
  662.  
  663.     To display a list of all the applications/products that have commands in the macro file
  664.  
  665.     To display a list of all condition handlers defined
  666.  
  667.     To display a list of all the data that can be obtained from the MacroInfo command
  668.  
  669.     To display a list of all the labels defined at the execution point
  670.  
  671.     To display a list of all pending items in the callback queue
  672.  
  673.     To display a list of all Use files referenced in Use statements by the macro file
  674.  
  675.     To display a list of all user-created macro dialogs
  676.  
  677.     To display the macro object header information for this macro file
  678.  
  679.     To display all variables in the Macro Debugger
  680.  
  681.     To close all of the Debugger information windows
  682.  
  683.     To locate the current line of code where a macro has been interrupted
  684.  
  685. To display all variables in the Macro Debugger,
  686.  
  687. 1    While debugging a macro, click Variables|View|All..
  688.  
  689. To close all of the Debugger information windows,
  690.  
  691. 1    While debugging a macro, click View|Close All..
  692.  
  693. To locate the current line of code where a macro has been interrupted,
  694.  
  695. 1    While debugging a macro, click Edit|Find Current Line.
  696.  
  697. Note
  698.  
  699.   The entire line of code in the source window is highlighted.
  700.   
  701. To display a list of all the labels defined at the execution point,
  702.  
  703. 1    While debugging a macro, click View  Label Table.
  704.  
  705. Tips
  706.  
  707.   Double-click any of these labels to display the macro file in the macro source list window, and highlight the source line containing the label definition.
  708.   
  709. To display a list of all Use files referenced in Use statements by the macro file,
  710.  
  711. 1    While debugging a macro, click View  Use File Table.
  712.  
  713. Tips
  714.  
  715.   Double-click any Use file in this list to load that file into the macro source list window.
  716.   
  717. To display a list of all the applications/products that have commands in the macro file,
  718.  
  719. 1    While debugging a macro, click View  Product Table.
  720.  
  721. Tips
  722.  
  723.   For each application/product listed, the version number of the PID file (product interface description file) that was used when this macro was compiled is displayed. This version number is used to determine if a compiled macro has become out of date when a new version of an application is installed and the macro is played.
  724.   
  725. To display a list of all user-created macro dialogs,
  726.  
  727. 1    While debugging a macro, click View  Dialog List.
  728.  
  729. Tips
  730.  
  731.   There are 2 types of dialogs: Text dialogs, which are defined using DialogDefine and DialogAdd statements in a macro; and Binary dialogs, which are created by the Macro Dialog Editor, and are stored in the prefix packet area of a macro file.
  732.   
  733.   Double-click this dialog to display the macro file where the callback label is defined in the macro source list window, with the source line containing the label definition highlighted.
  734.   
  735. To display a list of all condition handlers defined,
  736.  
  737. 1    While debugging a macro, click View  Condition Handlers.
  738.  
  739. Tips
  740.  
  741.   If there is a label associated with a condition handler, double-click the item to display the macro file where the label is defined in the macro source list window, and to highlight the source line containing the label definition.
  742.   
  743.   The standard condition handlers, such as Error, Cancel and NotFound are displayed in this list, as well as handlers for callbacks such as OnDDEAdvise and callback dialogs.
  744.   
  745. To display a list of all the data that can be obtained from the MacroInfo command,
  746.  
  747. 1    While debugging a macro, click View  Macro Info List.
  748.  
  749. Tips
  750.  
  751.   Double-click these items to display the macro file in the macro source list window and to highlight the source line containing the label definition or line number.
  752.   
  753. To display a list of all pending items in the callback queue,
  754.  
  755. 1    While debugging a macro, click View  Callback Queue.
  756.  
  757. Tips
  758.  
  759.   Double-click a line to display the macro file in the macro source list window and to highlight the source line containing the label definition.
  760.   
  761. To display the macro object header information for this macro file,
  762.  
  763. 1    While debugging a macro, click View  Macro Header.
  764.  
  765. Note
  766.  
  767. * The Macro Header info window displays whether or not the macro is protected and if it contains its source code.
  768. About Moving Through Macros While Debugging
  769.  
  770. When the Debugger stops on a macro statement, it stops before the indicated statement has been executed. To continue execution of the macro, a number of different options are available. 
  771.  
  772. Continue: Macro execution is continued to the next breakpoint.
  773.  
  774. Step Into: Execute the next single statement. If the next statement is a label or routine call, then execution will step into the specified label or routine, even if that label or routine is in another macro file (such as a use file).
  775.  
  776. Step Over: Execute the call of the label or routine without stopping until it has completed. This will stop the macro at the next statement in the current label or routine.
  777.  
  778. Step Out: If you have entered a label or routine, execute until the next return is encountered.
  779.  
  780. Run to Cursor: Continue execution down to the line under the mouse cursor in the macro source list.
  781.  
  782. Skip to Cursor: If you need to skip a series of statements without executing them, or if some statements need to be repeated, this sets the next statement that will be executed by the Debugger, without executing any statements between the current point and the new line. This option should be used with extreme caution, since skipping to a line that is not within the same label or routine could cause the internal macro execution state to become invalid, which will almost certainly result in execution failure.
  783.  
  784. Animate: When this mode is turned on, then the next Continue or Step command is repeated until you stop it, or until the macro ends. Between each command, the Debugger is displayed for the amount of time you specify in the Settings dialog box.
  785.  
  786. Stop: Stops the macro and the debugging. When you stop a macro this way, all defined breakpoints, watchlist variables, and opened macro files are stored in a debugger configuration file specific to the macro being debugged, and are saved in a file with a ".dbg" file name extension in the same directory as the macro. This configuration file is reloaded the next time that macro is debugged.
  787.  
  788. Break: While the macro is executing statements, the Debugger is mostly inactive, and the Debugger state message line displays the text "Macro is running." However, the Debugger is not completely disabled. You can interrupt the macro by clicking Break. This will cause the Debugger to become active, as if there were a breakpoint at the point where the macro is currently executing. The breakpoint commands are also available while the macro is running, so that you can add and remove breakpoints. Most of the other features of the Debugger are disabled while the macro is running.
  789.  
  790.     To animate a macro
  791.  
  792.     To stop debugging a macro
  793.  
  794.     To use cursor position in debugging a macro
  795.  
  796.     To use step options in debugging a macro
  797.  
  798. To animate a macro,
  799.  
  800. 1    Click Edit  Settings  Debug.
  801.  
  802. 2    Select the type of animation you want to use (Step Into or Step Over).
  803.  
  804. 3    Specify the number of seconds the macro should display after executing each step, then click OK.
  805.  
  806. 4    Click Debug  Animate to begin playing the macro.
  807.  
  808. Tips
  809.  
  810.   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. Clicking inside the Debugger halts the animation, as do any breakpoints you have specified. Click Debug  Animate to resume automatic play.
  811.   
  812.   Step Into executes the next single statement. If the next statement is a label or routine call, then execution will step into the specified label or routine, even if that label or routine is in another macro file (such as a use file).
  813.   
  814.   Step Over executes the call of the label or routine without stopping until it has completed. This will stop the macro at the next statement in the current label or routine.
  815.   
  816. To stop debugging a macro,
  817.  
  818. 1    While you are debugging a macro, click Debug  Stop Debugging to quit the macro and close the Debugger.
  819.  
  820. Tips
  821.  
  822.   When the macro is stopped and the Debugger closes, all defined breakpoints, watchlist variables, and opened macro files are stored in a debugger configuration file specific to the macro being debugged, and are saved in a file with a ".dbg" file name extension in the same directory as the macro. This configuration file is reloaded the next time you debug the macro.
  823.   
  824. To use cursor position in debugging a macro,
  825.  
  826. 1    While debugging a macro, position the cursor by clicking in the macro source list.
  827.  
  828. 2    Click Debug  Run to Cursor to continue execution down to the line under the mouse cursor in the macro source list.
  829.  
  830. 3    Click Debug  Skip to Cursor to set the next statement that will be executed by the Debugger, without executing any statements between the current point and the new line.
  831.  
  832. Tips
  833.  
  834.   You can use Skip to Cursor if you need to skip a series of statements without executing them, or if some statements need to be repeated. This option should be used with extreme caution, since skipping to a line that is not within the same label or routine could cause the internal macro execution state to become invalid, which will almost certainly result in execution failure.
  835.   
  836. To use step options while debugging a macro,
  837.  
  838. 1    While debugging a macro, click Debug  Step Into to execute the next single statement. If the next statement is a label or routine call, then execution will step into the specified label or routine, even if that label or routine is in another macro file (such as a use file).
  839.  
  840. 2    Click Debug  Step Over to execute the call of the label or routine without stopping until it has completed. This will stop the macro at the next statement in the current label or routine.
  841.  
  842. 3    Click Debug  Step Out to execute the macro until the next return is encountered, if you have entered a label or routine.
  843.  
  844. About the PerfectScript Language
  845.  
  846. The PerfectScript language is a command-based language. This means that the application records the results of keystrokes or mouse selections instead of recording the keystrokes themselves. For example, instead of recording each keystroke involved in changing the top margin of your document to 2, the application simply records the command MarginTop(2.0). These commands are called product commands.
  847.  
  848. The PerfectScript language also includes programming commands. These commands let you create macros that can respond to user input.
  849.  
  850.     Example of DialogShow and DialogDismiss
  851.  
  852.     Related topics
  853.  
  854. About Playing Macros
  855.  
  856. Use macros to carry out procedures inside Corel suite applications. You can play, pause, resume, and stop macros. When you play a macro, PerfectScript performs the operations and uses the features you specified in the macro.
  857.  
  858. For information about controls on the dialog box, click, then click a control.
  859.  
  860.     To pause and resume macros
  861.  
  862.     To play macros
  863.  
  864.     To stop macros
  865.  
  866. To play macros,
  867.  
  868. 1    Click File  Play.
  869.  
  870. 2    Select the macro you want to play, then click Play.
  871.  
  872. Tips
  873.  
  874. * You can also play macros by selecting a macro file name in the Explorer, then clicking Play from the QuickMenu.
  875. To pause and resume macros,
  876.  
  877. 1    While a macro is playing, click PerfectScript on the Start bar.
  878.  
  879. 2    Select the macro you want to pause, then click the Pause button on the toolbar.
  880.  
  881. 3    When you want the macro to continue playing, click the Pause button again.
  882.  
  883. Tips
  884.  
  885. ¿    You can also right-click a macro, then click Pause from the QuickMenu.
  886.  
  887. To stop macros,
  888.  
  889. 1    While a macro is playing, click PerfectScript on the Start bar.
  890.  
  891. 2    Select the macro you want to stop, then click the Stop button on the toolbar.
  892.  
  893. Tips
  894.  
  895. ¿    You can also right-click the macro, then click Stop from the QuickMenu.
  896.  
  897. About Recording Macros
  898.  
  899. Use Record, Pause Record, and Stop Record while creating keyboard macros. When you record, PerfectScript keeps track of the actions you perform in an application, such as typing text or saving a file.
  900.  
  901. For information about controls on the dialog box, click, then click a control.
  902.  
  903.     To record macros
  904.  
  905.     Related topics
  906.  
  907. To record macros,
  908.  
  909. 1    Click File  Record.
  910.  
  911. 2    Type a name for the macro, then click Record.
  912.  
  913. 3    Switch to a WordPerfect suite application or another macro-enabled program, then use it to record keyboard actions in the macro.
  914.  
  915. 4    When you have finished recording the macro, click File  Stop Record.
  916.  
  917. Tips
  918.  
  919. ¿    Press Ctrl+x or Ctrl+Shift+x (where x represents a character a-z or 0-9) to assign your macro to a keystroke combination.
  920.  
  921. ¿    If you need to stop recording temporarily to locate a feature or experiment with the effect of a feature before you record the command, click File  Pause Record, then click Pause Record again to continue.
  922.  
  923. ¿    The suite application you are using automatically inserts the Application command when you record a macro. This command tells PerfectScript that, unless otherwise specified, commands with that prefix should be sent to that application and not to another.
  924.  
  925. About Settings
  926.  
  927. Use Settings to select default settings for recording, editing, debugging, compiling, playing and storing macros.
  928.  
  929. For information about controls on the dialog box, click, then click a control.
  930.  
  931.     T select a macro editor
  932.  
  933.     To select default macro settings
  934.  
  935.     To choose recording options for macros
  936.  
  937.     To generate a listing file for debugging macros
  938.  
  939.     To select dubugging options
  940.  
  941.     To select general macro settings
  942.  
  943.     To select macro recording defaults
  944.  
  945.     Related topics
  946.  
  947. To choose a macro editor,
  948.  
  949. 1    Click Tools  Settings, then click the Edit tab.
  950.  
  951. 2    Specify the path and filename of the macro editor you want to use.
  952.  
  953. 3    Specify the file format of the editor you selected.
  954.  
  955. Tips
  956.  
  957. ¿    You must select a macro editor before you can edit macros from PerfectScript, and the file format must match the editor you select.
  958.  
  959. To choose default macro settings,
  960.  
  961. 1    Click Tools  Settings.
  962.  
  963. 2    To select the default macro folder, set Display icons in system tray, and reset defaults, click the General tab.
  964.  
  965. 3    To show progress during compiling and to select other compiling options, click the Compile tab. The "Warn when using unsupported features" option defaults to True.
  966.  
  967. 4    To select debugging defaults, click the Debug tab.
  968.  
  969. 5    To select a macro editor and file format, click the Edit tab.
  970.  
  971. 6    To select play options for macros, click the Play tab.
  972.  
  973. 7    To select script language, file format, numbers of parameters, prefixes, named parameters and maximum line length, click the Record tab.
  974.  
  975. 8    To set toolbar macro button options, click the Toolbar tab.
  976.  
  977. Tips
  978.  
  979.   The PerfectScript toolbar displays three buttons that can be configured to play any macros that you choose. To configure the buttons, select Tools, Settings, then click the Toolbar tab. Choose the macros that you want associated with each button.
  980.   
  981. To select macro play settings,
  982.  
  983. 1    Click Tools  Settings, then click the Play tab.
  984.  
  985. 2    Select the script language and file recording format you want to use.
  986.  
  987. 3    Select the number of parameters you want per line.
  988.  
  989. 4    Specify the maximum line length.
  990.  
  991. 5    Select Named parameters required to force all parameters to have names.
  992.  
  993. 6    Select Record product prefixes on all commands if you want to use product prefixes in macros.
  994.  
  995. Tips
  996.  
  997. ¿    The file format you select in step 2 should be compatible with the macro editor you select on the Edit tab.
  998.  
  999. To select general macro settings,
  1000.  
  1001. 1    Click Tools  Settings, then click the General tab.
  1002.  
  1003. 2    Specify a default macro folder.
  1004.  
  1005. 3    Select Use Enhanced File Dialogs if you want to view detailed dialog information.
  1006.  
  1007. 4    Select Display Icons in System Tray if you want to enable macro icons in the Windows system tray.
  1008.  
  1009. Tips
  1010.  
  1011. ¿    Click Reset All to Defaults to return all settings to their original state.
  1012.  
  1013. To select macro recording settings,
  1014.  
  1015. 1    Click Tools  Settings, then click the Record tab.
  1016.  
  1017. 2    Select the script and file formats in which you want to save your macro.
  1018.  
  1019. 3    Click One or Multiple from the Parameters per line drop-down list to set the number of parameters for each line in your macro.
  1020.  
  1021. 4    Specify a maximum line length for your macro text.
  1022.  
  1023. 5    Select Named parameters required to use only named parameters in your macros.
  1024.  
  1025. 6    Select Record product prefixes on all commands if you want to insert product prefixes in your macros.
  1026.  
  1027. Tips
  1028.  
  1029. ¿    The file format you select in step 2 should be compatible with the macro editor you select on the Edit tab.
  1030.  
  1031. Tips for Debugging Macros
  1032.  
  1033. The actual techniques you use to debug a macro depend on the type of failure that is occurring. To begin debugging a macro, first compile the macro for debugging. It is also a good idea to use the Debugger to compile any other macro file that the original macro Uses or Runs or Chains to. Compiling a macro for debugging includes necessary information in the macro, and generates a compiler listing file the Debugger can use to display the macro's source code.
  1034.  
  1035. Debugging Macros that Stop at Error Messages
  1036.  
  1037. 1    One of the easiest problems to correct with the Debugger is when a macro terminates due to an error. To use the Debugger to discover the cause of the error, play the macro as usual. When it stops, press the Debug button on the error message box.
  1038.  
  1039.     This will bring up the Macro Debugger, and it will load the macro and the compiler listing file. The Debugger will display the problem line in the macro source list. It will also display, in the call history list, a reverse-ordered list of what labels and procedures/functions were called in order to get to that point. The contents of all the macro variables will also be displayed.
  1040.  
  1041. 2    At this point, examine the source line to determine what the macro was doing when the error occurred. Check the contents of the variables that are being used at the current line to see if they contain the proper values. Incorrect values for some of the variables' contents can cause macro errors.
  1042.  
  1043. 3    If all the variables at this point in the macro appear to have the right values, select a previous line in the call history list, and examine the source line and the contents of the variables at that point. If you find an improper variable value, examine the source code leading to the problem area. Locate a spot where the variable could have been changed, and double-click the line to set a line number breakpoint at that spot.
  1044.  
  1045. 4    Now stop the Debugger by clicking Debug  Stop Debugging. You cannot continue executing the macro, since an error has occurred and the macro cannot continue.
  1046.  
  1047. 5    Restart the macro by clicking File  Debug  Play in PerfectScript. This displays the Debugger right before the macro starts.
  1048.  
  1049. 6    Since you set a line number breakpoint, click Continue and run the macro until it encounters the line number containing the breakpoint.
  1050.  
  1051. 7    When the macro reaches the line with the breakpoint, the Debugger displays. Examine the variable contents to verify that the macro is displaying the variable values you expected. If not, you may need to specify a breakpoint at an earlier location and restart the macro. You can also skip to the earlier location by clicking a line in the macro source, then clicking Debug  Skip to Cursor.
  1052.  
  1053. 8    If everything appears to be working normally, click Step Into to execute the macro one statement at a time. At each step, examine the variables between each statement until something unexpected happens. For example, the contents of a variable may change unexpectedly, or the macro may call the wrong label. At this point, you have probably come to the line where the variable's value causes the error.
  1054.  
  1055. 9    If it appears that the error occurs because a variable has the wrong contents, set a "variable assign" breakpoint for that variable by clicking Debug  Breakpoints  Edit, then selecting Variable Assign. When the contents of that variable change, a breakpoint occurs and the Debugger displays. If the variable is changed too often, and too many breakpoints are occurring on the variable, disable the Variable Assign breakpoint and set a line-number breakpoint after most of the variable assignments are done, but before the wrong contents are assigned.
  1056.  
  1057.     If the problem in the macro appears to associated with calling a certain product token, set a Product Token Call breakpoint for that product token, and/or for a related product token that may not be setting the application in the proper state.
  1058.  
  1059.     If the problem is that the macro is calling a specific macro label or procedure/function too often, set a Label Call breakpoint for that label to see when and where it is being called.
  1060.  
  1061. Debugging Callbacks
  1062.  
  1063. Debugging dialog callbacks is one of the most challenging types of debugging. Many problems with dialog callbacks occur because the callback does not look at the callback data closely enough to determine if the exact conditions have occurred before performing the macro's action; so the action is performed at the wrong time or too many times.
  1064.  
  1065. A dialog callback label is called often, and most of the callbacks are usually not associated with the event of interest. As soon as a callback dialog is shown, at least 2 or 3 callback events occur. These events are associated with the dialog being created, the controls being initialized, and with the dialog receiving the initial input focus.
  1066.  
  1067. One of the difficulties associated with debugging callbacks is that when the Debugger becomes active at a breakpoint, it gains focus. This means that the window that had focus while the macro ran lost focus, and therefore the callback dialog in the macro lost the focus as well. When a callback dialog loses or gains focus, it generates a callback event. 
  1068.  
  1069. If you set a breakpoint in a dialog callback label, a lose-focus callback event could occur on the callback dialog when the Debugger displays. Then, when you continue macro execution in the Debugger, a gain focus callback event could occur. This could cause the breakpoint to stop the Debugger (because the callback label is called for the lose/gain focus of the dialog), which would in turn cause more lose/gain callback events, which could cause another breakpoint, which could cause more lose/gain focus callback events, and so on. 
  1070.  
  1071. The macro interpreter and debugger attempt to minimize this cyclic occurrence by determining whether the dialog is losing or gaining focus because of the Macro Debugger. If so, the focus callback events are not generated. Unfortunately, this cannot always be reliably determined.
  1072.  
  1073. The best way to prevent error loops is to write the dialog callback label so that it carefully examines the callback data array to determine the type of the callback event, and have it respond only to the callback event types it is interested in. (Callbacks usually respond to events associated with manipulating a control, which are WM_COMMAND events with element [5] = 273). Then set a breakpoint on a line of code that does not respond to losing or gaining focus. In this way, the breakpoint does not occur when the dialog loses or gains focus, circumventing the error cycle. 
  1074.  
  1075. If a callback event occurs for a callback label different from any callback label that is currently executing, then the callback even will cause the current callback code to be suspended, an dthe new callback code will be called. By restricting this to different callback labels than any currently active callback label, this ensures that a callback will complete before another callback for that same callback label is allowed to occur.
  1076.  
  1077. Tips for Linking Dialogs to Macros
  1078.  
  1079. Use the DialogShow and DialogDismiss commands to use a dialog created in the PerfectScript Dialog Editor within a macro. These commands can be found in the PerfectScript Command Inserter under the type PerfectScript.
  1080.  
  1081. The DialogShow command uses three parameters: the dialog name, the parent window for the dialog, and a label that identifies a callback function. The first and second parameters are required, the third is optional. The DialogDismiss command requires two parameters: the name of the dialog and the name of the control used to dismiss the dialog. See the Example cited in the Related topicslist for syntax and further information.
  1082.  
  1083. Variables associated with controls work the same way as with the DialogDefine method. If a variable exists, its value is set into the controls when the dialog displays, and the value in the controls is set into the variables when the dialog is dismissed.
  1084.  
  1085. Before a you can use a region command to manipulate a dialog, that dialog must be loaded into memory. DialogShow loads the dialog into memory and displays it. (The DialogLoad command loads the dialog into memory but does not display it.) Because a dialog must be loaded before you can use it, be sure to use a DialogShow (or DialogLoad) command before you use any Region commands.
  1086.  
  1087. Tips for Locating Applications
  1088.  
  1089. When you play a macro, PerfectScript checks the Registry for the path to the application's .EXE. If the location is not in the Registry, PerfectScript asks you to specify the location of the application's .EXE.
  1090.  
  1091. 1    Select the macro you want to play, then click Play.
  1092.  
  1093. 2    Specify the location of the .EXE file for the application.
  1094.  
  1095. For information about controls on the dialog box, click, then click a control.
  1096.  
  1097. Tips for Macro Commands and Syntax
  1098.  
  1099. If you create macros by recording keystrokes and mouse clicks, the commands are automatically inserted in the correct format.
  1100.  
  1101. For macros you type from the keyboard to work properly, macro commands and their elements must be arranged in the correct order. This arrangement is called syntax. To be syntactically correct, each macro command must be spelled correctly and must include all of the required parameters and the necessary separators in the correct order.
  1102.  
  1103. Macro commands consist of three parts: a command name, parameters, and separators.
  1104.  
  1105. Command Name
  1106.  
  1107. The command name indicates which feature the command activates. Sometimes the name is all that is necessary to perform a complete action. For example, FileOpenDlg() is a complete macro command because WordPerfect does not need any additional information; the command name itself opens the File Open dialog box.
  1108.  
  1109. Example: FileOpenDlg()
  1110.  
  1111. Parameters
  1112.  
  1113. If the token or command needs more information than is provided by the command name alone, parameters are required. The command name represents the feature. Parameters represent aspects of the feature you can change, or selections you can make. For example, the Backup command requires one parameter that indicates whether you want Automatic Document Backup turned on or off. Parameters are always enclosed in parentheses.
  1114.  
  1115. Example: Backup(On!)
  1116.  
  1117. Separators
  1118.  
  1119. Some macro commands require several parameters. Parameters generally need to be placed in the correct order (except when you specify parameter names) and must be separated properly. Semicolons (;) are used to separate individual parameters, and an entire string of parameters must be enclosed in parentheses. Groups of repeating parameters are also enclosed in braces ({}).
  1120.  
  1121. For more information, see Expressions and Variables in the online macros manual. In addition, see the Macro Commands Index in the online macros manual for the required syntax and a description of each parameter for all PerfectScript macro commands.
  1122.  
  1123. Typing Macro Commands Yourself
  1124.  
  1125. Since you do not need to use a macro editor to create or edit WordPerfect macros, you can insert macro commands by typing them in a blank document. When you save a macro, remember to give it a .WCM extension. You can also type commands into a macro that is saved in a file or in a template.
  1126.  
  1127. If you want to improve the readability of a macro, you can format it so that it includes tabs, spaces, and even font or text appearance changes. Formatting the macro will not affect how it works. For example, WordPerfect records the following macro in this format:
  1128.  
  1129. PosDocBottom()
  1130.  
  1131. Type("Sincerely")
  1132.  
  1133. HardReturn()
  1134.  
  1135. HardReturn()
  1136.  
  1137. HardReturn()
  1138.  
  1139. HardReturn()
  1140.  
  1141. Type("Ms. Sharon Openshaw")
  1142.  
  1143. HardReturn()
  1144.  
  1145. Type("Vice President, Marketing")
  1146.  
  1147. However, if you type in the commands yourself or edit the existing macro, you can leave spaces between components as follows:
  1148.  
  1149. PosDocBottom()
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155. Type ("Sincerely")
  1156.  
  1157.  
  1158.  
  1159. HardReturn()
  1160.  
  1161. HardReturn()
  1162.  
  1163. HardReturn()
  1164.  
  1165. HardReturn()
  1166.  
  1167.  
  1168.  
  1169. Type ("Ms. Sharon Openshaw")
  1170.  
  1171.  
  1172.  
  1173. HardReturn()
  1174.  
  1175.  
  1176.  
  1177. Type ("Vice President, Marketing")
  1178.  
  1179. Troubleshooting Macro Problems
  1180.  
  1181. The compiler is a useful tool for troubleshooting syntax problems in your macros. If the compiler locates an error, the compiler displays a dialog box containing general information about the problem. The macro compiler, however, can only make a best guess as to what the macro is actually designed to accomplish. As a result, the information the compiler gives sometimes suggests, rather than specifically identifies, the problem.
  1182.  
  1183. Some Corel suite applications also have an online macros manual available on the CD. The online manual contains information about macro commands and their syntax, with additional instructions and examples for using macros.
  1184.  
  1185.     To choose debugging options for macros
  1186.  
  1187.     To debug macros
  1188.  
  1189.     Tips for Macro Comands and Syntax
  1190.  
  1191.  
  1192.  
  1193.  
  1194.