HOME - - - - - Delphi Tutorials TOC - - - - - - Other material for programmers
Delicious  Bookmark this on Delicious    Recommend to StumbleUpon

File transcription, making changes along the way

Massaging a file. Uses memos, OpenDialog, and SaveDialog

This has good information, and a search button at the bottom of the page

Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc!

Click here if you want to know more about the source and format of these pages.

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a narrow window. With most browsers, pressing plus, minus or zero while the control key (ctrl) is held down will change the texts size. (Enlarge, reduce, restore to default, respectively.) (This is more fully explained, and there's another tip, at my Power Browsing page.)


You will, I hope, find that this page has information for you if you want to write a Delphi program to massage the contents of a file.

The tutorial is more concise than most of those in this collection.

There is some "bonus information" in the sourcecode for you, if you read through it.

The full Delphi source is available online for download. A compiled version of the application is included in the zip file. There's even a small file of data ('ToBeMassaged.txt') you can use to test the application.

Linux? Mac? There is a Lazarus source code zip for you, too, containing the Lazarus equivalents of what the Delphi programmers get (see previous paragraph). (See bottom of page for note about Delphi- to- Lazarus conversion.)

Users of the application will see...

Image of running application

As presented, the application does not do anything very useful... but it is a shell you can adapt for whatever file massaging tasks you need an application for.

Notice that the "Do It" button is grayed out. It is enabled as soon as users specify the source file and destination file they want to use. When both have been specified, the user can the "Do it" button, which will cause...

Modern computers can manipulate stunningly large memos, and this "crude" approach makes the programming easy.

The Delphi OpenDialog and SaveDialog are used... but I must confess that few of the ins and outs of using those are addressed. Consider this tutorial a fleeting introduction to those two useful components.

No check is included of whether the destination file is already present on the disk. If it is, it will be overwritten.

This is one of a number of tutorials I have written with functionally similar applications. By which I mean that what they do for the user is similar. I have taken at least two very different approaches to accomplishing the task. What is "under the hood" is different in the different tutorials.

This tutorial was written 24 July 11 using Delphi 4, and if (when you adapt it) it meets your file massaging needs, is probably the best of the different attempts to show you a way to do that to date, by quite a margin. Apart from anything else, this is a very concise "tutorial".

Be sure to read through the source code. There is help for you there, to make up for the lack of it here!

The application does nothing to the source file other than reading it. The difference between the source file and the destination file is as follows... but before I tell you what "massaging" is done, remember that the point of this application is to give you a skeleton for your own needs. When you read the source code, note how the "massaging" part has been isolated in the code, to make tinkering with it easy.

In what I am about to say, everything is case sensitive.

Every 'n' in the source file is changed to an 'X'.
Every 'a' in the source file is missing from the destination file.

I hope the source code is helpful to you!


The Lazarus version

Lazarus: a free, open source, Delphi- like compiler. And the really great thing is that the same source code is supposed to compile for Windows, Linux, or Mac!

I wasted dollars and hours trying to use Kylix, which seems to be dead. I read about Lazarus for many years... but, "so many projects, so little time".

Finally, on 26 July 2011, I tried Lazarus.

Fantastic!

Now, I have to admit that I am writing this on 2 August, 2011... but so far Lazarus has been wonderful. It actually has (so far) failed to disappoint me.

I've started a page of Lazarus tutorials for you.

But the best news of all so far? I took one of my existing Delphi programs, the one that the page you are reading now is about, and it took me- a Lazarus novice- only about 20 minutes to have a Lazarus version of the program running!

I merely went into Lazarus, and then....

And it Just Worked!

"It" being an application with memos, file opening and saving dialogs... not entirely trivial! I didn't have to "tweak" the code, just copy what was in the Delphi application into the Lazarus shell.

Floreat Lazarus.





            powered by FreeFind
  Site search Web search
Site Map    What's New    Search This search merely looks for the words you enter. It won't answer "Where can I download InpOut32?"


Click here if you're feeling kind! (Promotes my site via "Top100Borland")

If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.www.1and1.com icon

Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Link to Tutorials main page
How to contact the editor of this page, Tom Boyd


Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org


If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....