www.fireflysoftware.com

Help Screen to Delphi String 


Suppose you're re-doing the help screens for numerous console utility applications written in Delphi.  You have a choice.  You can either directly modify the necessary logic in each application which might look something like the following user-unfriendly multi-line statement...  

Help = 'YesNo V1.0 -- Prompts for a yes/no response'#13#10#13#10 + 
'This 32-bit program prompts for a yes/no response from the user.'#13#10#13#10 + 
'Usage:'#13#10#13#10 + 
' YesNo <Prompt> [<Default>]'#13#10#13#10 + 
' where:'#13#10#13#10 + 
' <Prompt> is the string used to prompt the user.'#13#10 + 
' <Default> is the default response taken when <Enter> is pressed.'#13#10#13#10 + 
'Batch example:'#13#10#13#10 + 
' YesNo "Install Communications Software (Y/N, Enter=Y)?" Y'#13#10 + 
' if not errorlevel 1 goto END'#13#10#13#10 + 
' echo Installing Comm Software ...'#13#10#13#10 + 
' :END'#13#10#13#10 + 
'Find more FREE software utilities at www.fireflysoftware.com!'#13#10;

... or you can use TEXTools like a form painter by carrying out the following steps:

1) First, run the utility without parameters in the console window to get it's help screen:

2) Copy the text from the help screen into TEXTools' input text memo and make all your desired changes.  No need to worry about syntax...  Just format it!

3) Copy the following pipe into TEXTools (or load it from the pipe, "Help Screen to Delphi String.ttp" found in the "Sample Pipes" subfolder beneath TEXTool's installation folder):

; Remove any trailing spaces:

TrimLinesRight 

; Double any existing single quote marks:

ReplStr '''' ''''''

; Insert a single quote at the beginning of each line:

InsStr 1 ''''

; Append a single quote followed by a CR/LF placeholder
; ("~" is used to represent " + "):

AppendStr '''[CR]~'

; Get rid of doubled quotes created at blank lines:

ReplStr '''''[CR]~' '[CR]~'

; Join the lines together:

JoinLines

; Though syntactically correct, combine the CR/LF pairs:

ReplStr '[CR]~[CR]' '[CR][CR]' '[CR]~[CR]' '[CR][CR]' 

; Remove the "[CR]~" at the end of the last line and
; append the trailing semicolon character:

StripChars 5
AppendStr ';'

; Translate the placeholders:

ReplStr '~' ' + #0d#0a' '[CR]' '##13##10'

4) Finally, run the pipe. What it outputs is the string constant shown at the beginning, (minus "Help = ") except that now, your changes are incorporated.

 

[Home] [Contact Us] [Downloads] [Purchase/Register]

Copyright © 2005 Firefly Software