Hello Roger,
>From what you described, I don't think you need a script, you just want to
replace a token with a value. I assume that you want to replace 'friend'
with the variable value before the user see's it displayed in the memo.

Populate your memo with something like this:

        %date%

        dear %name% I have written to you today to talk to you about this
and 
        that for these and those reasons. I would love it if we could 
        

You can access the entire contents of the memo as a single string using the
Text property. To replace the tokens with the desired values you use the
following Delphi function (check the help):

AnsiReplaceStr(const AText, AFromText, AToText: string): string;

var
        sDate: String;
        sName: String;
begin
        sDate := 'Aug 23, 2006';
        sName := 'John Doe';

        ...
        // Load template into memo
        mmo.Lines.LoadFromFile('template.txt');
        Lines.Text := AnsiReplaceStr(Lines.Text, '%date', sDate);
        Lines.Text := AnsiReplaceStr(Lines.Text, '%name', sName);


        // Memo is now populates with variable values
        ...
end

Scott Kellish
[EMAIL PROTECTED]


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Roger MacRae
Sent: Thursday, August 24, 2006 7:48 PM
To: Delphi Programmers List1
Subject: Scripted memos?

Does anyone know of a way to allow for scripts inside of memos.

for instance:

Say I have the following memo:

dear friend I have written to you today to talk to you about this and 
that for these and those reasons. I would love it if we could 
actaully get together to talk more on the matter.


what I would like to do is be able to change the word friend to a 
variable that will change with the click of a button.

Hope that is clear. Hope someone knows a way.

Thanks,
Roger MacRae
www.winthebike.com


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to