A suitable simple procedure for using SWI Prolog in batch mode is the
following:
Strategy: Create Desktop icons to facilitate file execution and consultation
I. Method:
* Install SWI Prolog and tracer from downloaded files, defining your working
directory when prompted to do so.
* Create a desktop link to your Prolog output file as follows:
* Call the Notepad text editor and create a file "SWIlog.txt" in your working
directory.
* Create a link from this file, rename it "SWIlog" and drag it to the
Desktop.
* In order to view the output of the Prolog programme simply click on this
icon; when you have finished, just close the editor and next time click
again.
* Edit your Prolog programme in your working directory with the Notepad
editor.
* In your Prolog file "myfile.txt", redirect the console output of SWI Prolog
to the file "SWIlog.txt" by prefixing the main call(s) with the "tell/1"
predicate, in the following way:
:-
tell('SWIlog.txt'),
write('This line is replaced by Prolog calls.'), nl,
halt.
* Create a desktop link to your main Prolog source file, e.g. "myfile.pl", as
follows:
* In your working directory create a link to "myfile.pl" and drag it to the
Desktop.
* To start execution of this file simply click it; the SWI installation ensures
that files of type ".pl" are handled automatically by SWI Prolog.
* View the output in "SWIlog.txt" by clicking on the "SWIlog" desktop icon.
I. For normal working, you will then need two windows and two icons on your
desktop:
* One window for editing your current file, e.g. "myfile.pl", i.e. Prolog
input.
* One window for viewing the Prolog output, e.g. in "SWIlog.txt" (or whatever
you choose to call it)
* One icon for your input file "myfile.pl" which you click in order to start
Prolog execution automatically.
* One icon for your output file "SWIlog.txt" which you click in order to view
the current output (before you click, close the previous output file).