Try something like this program. It accepts the name of a form as a
parameter - you can use it in a script to process all of your forms.
program FixMeUp;
uses ...;
var MyFileStream: TFileStream; // The form you will be
opening/rewriting
MyMemoryStream: TMemoryStream; // Generated from the FileStream
MyResultStream: TMemoryStream; // Your modified form text, ready
to write out again
...
begin
MyFile := ParamStr(1);
if not FileExists(MyFile + '.dfm') then Exit;
MyFileStream := TFileStream.Create(MyFile + '.dfm', fmOpenRead);
MyMemoryStream := TMemoryStream.Create;
ObjectResourceToText(MyFileStream, MyMemoryStream);
MyFileStream.Free;
MyResultStream := TMemoryStream.Create;
MyMemoryStream.Seek(0, soFromBeginning);
{
Now repeat MyMemoryStream.Read and MyResultStream.Write, splicing in
your changes as you go.
The "easy" way is to change line "FormStyle = blah" to "FormStyle =
fsStayOnTop" where found, or insert the line if it's not there. Same
for KeyPreview. Ideally you want to change the forms to inherit from
your own type, so you never have to do this again - that will require
changes to the .pas and probably the project as well.
}
MyMemoryStream.Free;
MyResultStream.Seek(0, soFromBeginning);
MyFileStream := TFileStream.Create(MyFile + '.dfm', fmCreate);
ObjectTextToResource(MyResultStream, MyFileStream);
MyMemoryStream.Free;
MyResultStream.Free;
MyFileStream.Free;
end;
Use with caution though - I wrote it in a hurry. I don't have time to
test it just now.
Cheers,
Carl Reynolds Ph: +64-9-4154790
CJN Technologies Ltd. Fax: +64-9-4154791
[EMAIL PROTECTED] DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
> -----Original Message-----
> From: Matthew Comb [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, June 21, 1999 4:09 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: command line compiling / macros.
>
> I have about 800 applications which I have to set the main form to be
> fsstayontop and keypreview to true. Is therea way I can automate this?
> In the past I have been able to rig batch files to compile the
> applications but don't know how to alter these properties.
>
> Currently I am having to alter the applications by hand. I also need
> to remove a background component reference.
>
> Any help would be appreciated.
>
> Cheers,
>
> Matt.
application/ms-tnef