You can automate pretty much anything using the built-in scripting support in InDesign. In the InDesign GUI you can assign script labels to various elements, such as text frames, in your InDesign document. If you, for instance, would like to replace some text in a text frame you can apply something like this in Javascript (CS4 and below, see note below):
var document = app.open(File("path to your InDesign file"), false);
var textFrame = document.pageItems.item("your script label");
var story = textFrame.parentStory;
story.contents = "your new content"
To create a PDF you do something like this:
var pdfFile = new File("path to your pdf");
document.exportFile(ExportFormat.PDF_TYPE, pdfFile);
This was just a few examples of what you can do, I hope that was somewhat helpful.
If you don't know how to install and run scripts in InDesign, this blog post explains the process. You can find a good online scripting reference here.
As I understand it you would like to run your scripts as a batch process. If that is the case I recommend that you take a look at InDesign Server. It is basically the desktop version of InDesign but without the GUI and with a simple Web Service interface. It is also running as a Windows service (or the equivalent on other platforms).
NOTE: Starting with CS5, you can no longer identify a text frame by its script label, as shown above. There's some discussion about it here. The best alternative is to use itemByName(name) instead of item, with name being the name on the layers palette. This can be changed in the GUI by doing a really slow double click on the item in the layers palette. Or, this workaround sets each text frame's name to be equal to its script label. Then, all you have to do to change the text frame's contents is this:
document.textFrames.itemByName("shmullus").contents = "The Doctor";