Please enable JavaScript to view this site.


The p-Code Viewer debug tool is accessible from the Diary Generation sub-menu of the debug menu.


It is used to view the precise commands that were sent to QuarkXPress, and messages received from QuarkXPress, during the most recent diary generation.



This tool is mostly used by the our development team.


But it can also be of use to end-users in the following cases:


A token is not converted the way you expect. Viewing the p-Code allows you to determine if the token processing you expected was sent to QuarkXPress or not. If not, then you may have misunderstood the behavior of a particular token, or there may be a bug in the Q++Studio code that generates the p-Code.

QuarkXPress crashes at a particular point of the token processing step of diary generation. Using the Log QuarkXPress Activity option and the activity log it generates, you can pinpoint the page and object number that caused the crash and view what token processing QuarkXPress was attempting before it crashed.


The p-Code debugger displays the p-code of the most recent diary generation (details of the script and time appear at the top of the dialog), and is divided into 3 areas: Pages, Objects and Actions.



Lets you navigate the list of pages of the diary that the p-Code represents. The number in bold in the Pge column refers to the page number of the output file. The T.Id column refers to the template that this page uses, and refers to which page of the template is used. The value in the T.Id column refers to the templates as they are used in the script, not to the template ID as displayed in the Templates Explorer. These ID values start at 2; 0 being used for BlankPages and 1 for PlaceHolders.


Lists the IDs of all the textbox objects contained in the page selected to the left. Note that only textboxes are listed here.


This section is divided into 3 parts. The Actions part itself lists all actions that are to be applied to the object/textbox selected in the middle section. The Token Conversion lists all the tokens that have been identified and how they will be replaced. The Raw p-Code at the bottom shows the p-Code in its rawest form, for cases when you need to see the exact, uninterpreted textual commands that are sent to QuarkXPress.


Four or five additional windows display information, depending on the currently selected pCode line above.


Token Conversions


Usually there is only one action per textbox and it involves replacing tokens.



But, sometimes, if a token involves complex format change, you will see 2 actions; one that replaces the text and one that then applies formatting (font, size, color, ...) to the already once processed textbox:




In the above example, the first action replaces text in the entire textbox, placing tags (such as **MOON** and **PHASE**) to indicate where further processing is to occur. The second line then isolates the text delimited by the **MOON** tags and applies some specific formatting (changing the font to a symbol font that shows Moon phases, in the present case).




The Messages section of the p-Code Viewer presents a list of all the run-time messages that were issued during the last diary generation, as well as all the times that a Sara hit a target.


These run-time messages and saras hits will also be available for detailed viewing in the and which will also be available in the diary generation messages dialog and the saras hits dialog, respectively.


Note that, as is the case for the diary generation messages dialog, and the saras hits dialog, you can return and view the p-Code from the most recent diary generation, by selecting the debug menu from the main window.


p-Code Instructions


The p-Code Instructions section of the p-Code Viewer presents the raw for in which the p-Code was sent to QuarkXPress for the currently-selected instruction (on the left of the p-Code dialog).


The topic on simple text formatting describes the various parameters used in the p-Code Instructions section.


Its contents are the same as those of the Tokens Conversion section described above, and it is rare that viewing this section would be necessary and would bring anything more than can be seen, more conveniently, in the Tokens Conversion section.


The only case when it is useful to look at the contents of the p-Code Instructions section is when the order in which the tokens are presented to QuarkXPress is important, such as would arise when message 108509 is issued during diary generation, requiring the use of the multi-pass token replacement diary generation option.