<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Il 03/11/2018 23:16, James ha scritto:<br>
</p>
<blockquote type="cite"
cite="mid:041901d473c2$edefea80$c9cfbf80$@productionautomation.net">It’s
not a snippet, that’s the entire thing. It’s pretty simple, just
a sequential set of events to fix a file. It would be a great
help if you could get me an example of how to make this work.<o:p></o:p></blockquote>
The simplest thing you can do is just to transform your application
into a GUI application.<br>
Try to do the following:<br>
<br>
Start your Lazarus, then select Project->New Project ->
Application<br>
<br>
You get that way an empty form and a skeleton unit.<br>
<br>
You'll find that in the var section there's de declaration of Form1,
you may add there your var's.<br>
<br>
If you want your user to pick up a file name from the file dialog,
do the following:<br>
Click on the Dialogs Tab, on the icon "TOpen Dialog", and then click
anywhere on the Form.<br>
<br>
Now you have an OpenDialog icon on your form, which will not be
visible run time. It's there just to let you set its properties in
the Object Inspector. You may set there a default extension, an
Initial Dir, a default file name, or whatever you think can be
useful to the user. Or you may leave the fields empty so that the
system defaults are taken. You may also set the OpenDialog File name
from the invocation command line: in the initialization section (or
in the OnCreate event of the form) you may add OpenDialog1.FileName
:= ParamStr(1).<br>
<br>
Now from the "Standard" Tab click on the TButton Icon and click on
the form. You get a Button on the form. Change in the Object
Inspector the Caption to what you want, sort of "Select Input File".<br>
In the object Inspector select the Events tab and then the OnClick
event. Click on the three periods to the right, and you'll get in
the source editor the skeleton of a new procedure
(TForm1.Button1Click).<br>
<br>
That's where all of your code goes. Typically:<br>
<br>
If OpenDialog1.Execute then begin <br>
TapFileName := OpenDialog1.FileName;<br>
......<br>
etc.<br>
<br>
You may add a Tedit (always fron the "Standard" tab) object to show
your messages: your writeln becomes Edit1.Text := 'Whatever'.<br>
<br>
Where you need to ask the user for a new filename, you may just call
a second time OpenDialog1.execute, to get it.<br>
<br>
If you want to be kind to your user, you may add a "Close" button,
to close the application when the user is done. <br>
Just pick from the "Aditional" tab a TBitBtn, put it in your form,
then in the Object Inspector select the "Kind" as "bkClose".<br>
<br>
There's no more than that. You may now save your project, giving the
program and the unit some name you like. Then play a bit with it,
and adjust following your needs.<br>
<br>
Hope that it helps.<br>
<br>
Giuliano<br>
<pre class="moz-signature" cols="72">--
Do not do to others as you would have them do to you.They might have different tastes.</pre>
</body>
</html>