PerfectScript Journal
 

August 1997 Macro Q&A 

DialogDefine Error 
Q. I created a dialog box in the Dialog Editor and pasted it into my macro code. But when I run the macro, I get an error saying there is a problem with the DialogDefine code. The syntax of the command looks fine. What could be causing the problem?  

A. You've probably got two dialogs defined with the same name. Take a look at the first parameter of your DialogDefine command and make a note of the name. Now click on the Dialog Editor button on the macro toolbar. There is probably a dialog with the exact same name. You'll need to either delete or rename the dialog in the Dialog Editor. Once you remove the duplicate dialog, your macro should run without returning the error.  


Character Values 
Q. I need to be able to determine if a character is an uppercase or lowercase character. How can I determine this?  

A. Each character has a unique value. For example, an A has the value of 65, B has a value of 66, and so on. The lowercase a has a value of 97, b has a value of 98 and so on. Magically, the lowercase letters have values exactly 32 higher than their uppercase counterparts.

You can use code similar to the following to test whether a character is lowercase:


vString:="a"
IF(vString >= "a" and vString <= "z") MessageBox(; ; "The character is lowercase") Else MessageBox(; ; "The character is not a lowercase character.") Endif                    

Similarly, you can use the CTON command to get the numeric value of a character and do a similar comparison:

vString:=CTON("a")
If(vString >=97 AND vString <= 122) MessageBox(; ; "The character is lowercase.") Else If(vString>=65 AND vString <= 90) MessageBox(; ; "The character is uppercase.") Endif                     

Copyright Notice: The information included in the PerfectScript Journal is protected by US Copyright. The author grants you the right to use the routines in your own macros as needed. You may not sell, distribute, or publish them in any form.
If you choose to use the information here, you do so entirely at your own risk. No representations are made regarding the fitness of this information for your   particular purpose, or for your ability or inability to use the information. You   are advised to make backups of all relevant files before implementing any suggestion  or technique.
© Copyright 1997 by J. Jeppson.