Download Qedit Scripting Language User Manual
Transcript
Logging Messages Using the Dialog() function is nice because it provides immediate feedback. These advantages are also its disadvantages. The user has to be aware of these dialogs otherwise the script might be sitting there waiting for someone to click a button. The dialog box also hides the document windows, or parts of them, and it has to be moved out of the way if the user wants to visually inspect the text. An alternative to the Dialog() function is to use Writelog(). This function allows you to write messages to the log window of the Script control dialog box. The Script control dialog box does not have to be opened in order to use Writelog(). Messages are written to the log and are displayed next time you open the dialog box. Keep in mind that the log window is cleared automatically when a script starts executing. Log Window Expansion When you first start up Qedit and open the Script control dialog box, the log window is minimized. That is, the log window is reduced to a single line. If you have run a script, the log window displays the last message, if any, sent to it via Writelog(). The Log Window Expansion control button at that point appears a right-pointing arrowhead. To expand the log window, simply click on the Log Window Expansion control button. The arrowhead now points downward and the log window displays the first set of messages. If there are additional logged messages, you can use the scroll bar to move up or down the list. The log window can hold approximately 500 lines. Debugging Tips Here are a few tips that can help you be more efficient at writing and testing scripts. Undo Your Changes If the script is opened, Qedit always executes the script as it currently appears in the document window. It does not use the version saved on disc. This means that you can make changes to a script and test them right away without doing a Save. If the changes you have made do not work, you can make more changes or you can back them out one at a time using the Undo tool. If you prefer to go back to the original version, you can re-open the file or use the Revert command on the File menu. Checking Identifiers Misspelling an identifier can cause some grief when trying to debug a script. Because of a typing mistake, Qedit might decide to create a new variable but one that is of undefined type or not initialized. Use the Typeof() function to check the data type of a variable. This way, you can be sure that the variable is defined the way you expect it to be. Qedit Scripting Language User Manual Executing and Testing Scripts • 61