SAY!.COM and SAY!.EXE by Roedy Green 2010-01-27 Purpose ******* SAY! lets you echo both text and control characters to pipes or files to construct small files on the fly in bat files. SAY! is very similar to SAY in the Ziff Communications PC Powertools. SAY! creates arbitrary strings of characters for use in redirecting to other programs, files or devices. It is like DOS ECHO, except that you can easily embed control characters and high bit characters. SAY! has a pickier syntax that SAY. In SAY, if you forget the " marks, SAY treats the text as a comment, whereas SAY! treats it as an error. Examples ******** SAY! "Y" 13 | DEL *.* - automatically answers the "Are you sure?" prompt with Y SAY! "Brown" 13 "Yellow" 9 | MyColour.Exe - you may have any number of "enclosed strings" or decimal numbers for the ASCII codes of the keystrokes (not scan codes). - to get the " itself, use code 34. SAY! /H - this or any other syntax error will give you a little help. SAY! "Mary had a little lamb" 13 10 "Its fleece .." 173 13 10 > RHYME.DAT - create a file perhaps containing strange characters Say! 27 "&l5257.1058J" 26 > LPT1: - put HP printer into Postscript mode with Pacific Page Say! 27 "&l1057.32259J" > LPT1: - put HP printer into native PCL non-Postscript mode Say! "This is a line tacked on the end of a file" 13 10 26 >> MyFile.Dat - using >> appends to the end of an existing file. - be careful if the file already has a 26. When you are done you will have a 26 (EOF) embedded. Use CLEANSER to get rid of these pests. SAY! 7 7 7 "The sky is falling" - you don't HAVE to redirect the output of SAY!. If you don't it just displays on the screen, much the same as Echo. What is SAY! for? ***************** Use SAY! wherever you would normall use ECHO and you want to be very precise about exactly how many spaces go on the front and end of the string. With SAY! you can construct files with exactly the line endings, eof chars etc. you specify. SAY! never adds ANYTHING in you did not ask for. Use SAY! when your strings contain awkward characters like ESC (27), or invisible spaces (255), or characters that might confuse your printer or editor FormFeed (12). If you were to say: Echo Please press then the vertical bar | DOS would get very confused, since it reserves < > and | for use in controlling pipes. Instead you could say: SAY! "Please press " 60 "Enter" 62 " then the vertical bar " 124 SAY! does NOT understand expressions like ^G for control G. You must use the numeric equivalents, e.g. 7. When NOT to use SAY! ******************** SAY! simply emits a string of characters. If, for example, you pipe it into a program to fake input keystrokes, once the program has swallowed all those characters, it will just HANG -- waiting for the pipe to produce some more. If you want to use SAY! to jump start a program -- i.e. just give a program some initial keystrokes then hand over control back to the keyboard, you will need a different sort of program called a keystuffer. If you try to use SAY! in this way, it will just freeze the machine. The Magic Numbers ***************** Each of the numbers 0 to 255 will get you a character. BASIC programmers refer to these as the CHR$ numbers. You can use "A" or 65. Both will get you a capital A. Common interesting numbers are: 3 - heart 4 - diamond 5 - club 6 - spade 7 - Beep 9 - Tab 10 - Line Feed 12 - form feed 13 - Enter (in files, lines end with 13 10) 26 - ^Z -- end of file mark 27 - ESC 34 - " 60 - < 62 - > 124 - | 174 - << 175 - >> 255 - alternate space You can buy a wall chart showing all the characters and their numbers from Falk Data Systems, 5322 Rockwood Court, El Paso Texas, 79932 (915) 584-7670. There are charts in most of the IBM Tech reference manuals as well. Difference Between Say!.com and Say!.exe There are two versions included, both with source: ASSEMBLER version say!.com that works in DOS/W3.1/W95/W98/Me/NT/W2K/XP/W2K3/Vista/W7-32 and a 32-bit C version say!.exe that works in W95/W98/Me/NT/W2K/XP/W2K3/Vista/W7-32/W7-64 Use the say!.com DOS version except for Windows 7 64-bit. say!.com is smaller faster, and it does the right thing with: say! "13" " ghosts" > file.txt the com version will put "13 ghosts" into the file. the exe version will but " ghosts" into the file with a leading Cr character. -30-