7
votes

I'm using CLIPS (http://clipsrules.sourceforge.net/) for a university project, but I cannot run program directly from files, in this case I don't want to use the prompt to insert FACTS and RULES.

right now I'm doing this.

  1. I open CLIPS ... CLIPS> appear on prompt
  2. Load the file (load "FILE_PATH")
  3. All FACTS, Rules and defFacts were inserted
  4. Type (run) to let the program run and applies rules
1

1 Answers

13
votes

Place the commands you want executed in a file. For example, the contents of run.bat is the following:

(load file1.clp)
(load file2.clp)
(reset)
(run)

If you're using a command line version, you can execute the contents of the batch file using one of the following two commands:

clips -f run.bat
clips -f2 run.bat

Using the -f option will echo the commands to the command prompt. Using the -f2 option will execute the commands without echoing the commands to the command prompt.

Alternately, you can also embed CLIPS within a C program as described within the Advanced Programming Guide, http://clipsrules.sourceforge.net/OnlineDocs.html.