Macro Language Reference > PIs > Text > <?autotry>
  
<?autotry>
Description
Autotry is an advanced feature of PTC ALD that requires the use of scripts and the ability to write mini programs. The <?autotry> keyword lets you specify a script that will reformat a series of lines a specified number of times. Each successive format will be different according to the commands that are defined using the <?queue> command. The script will then evaluate the scores of each attempt and finally reformat again, using the <?queue> that gave the best result.
Syntax
<?autotry num:n trytable:t keyword:m>
num
Number of <?autotry> commands to be run concurrently. Uses a value between 1 and 10.
* 
Subsequent autotry commands will be nested and will have an exponential effect on the speed of formatting.
trytable
Name of a trytable tag - note the tag must be of type Tt, any other tag type will not work.
Additional Information
line 1
try "[?th=10pt]"
try "[?tlsb=0.2w]"
try "[?tf=""arial""]"
try "[?tpl=5mm][?tpr=5mm]"
Several getvars can help you evaluate a score for a line. These getvars are only for use in a trytable as they return data which is only relevant after a line has finished formatting - a state in which you can't normally use a getvar.
The getvars are as follows:
01750
Returns the line result code
01751
Returns the line termination code
01752
Returns the line hyphenation code
01753
Bad line flags
Values displayed in the getvar give the following information:
0
Very bad hyphenation, with 0xff indicating no hyphenation. A number between 1 and 9 signifies the hyphenation level used.
flags & 1
Nothing fitted on the line - this condition will warrant a high score as it indicates that the given <?queue> resulted in no text being formatted.
flags & 2
Bad hyphenation.
flags & 4
Word spaces were overstretched.
flags & 8
Letter space was overstretched.
flags & 16
Word spaces were oversquashed.
flags & 32
Letter space was oversquashed.
21760
Formatted width of the text
21761
Word space value, stretch (>0) or squash (>0)
21762
Letter space value, stretch (>0) or squash (>0)
When PTC ALD encounters an autotry command, it will run the given trytable script. This is evaluated like a mini-script and hence can use variables, labels, jumps and conditions in the normal way.
The key to trytables are the extra keywords that facilitate the formatting and scoring of the text. Currently, the <?autotry> will only evaluate text up to the end of the paragraph.
Another command, <?tpsquash>, can be used in PTC ALD to restrict the formatting of a line and hence change the point at which lines break. As an example, <?tpsquash=5mm> means that PTC ALD uses 5mm less than normal when evaluating how much text fits on a line, although it will still justify to the full measure afterwards.
Related Links