As Sitecore Climber mentioned, you could use workflows if you do not need to have a future publish date. Otherwise the Automated Publsiher module might help you, but if you really want something specifically tailored to your needs, it should not be that hard to write that yourself. You could add an agent or use other possible solutions to trigger tasks.
There is a blog post here describing on how to extend the existing publish agent with extra parameters e.g. a root item path (as you requested). The trick is actually to look at the implementation and extend where needed.
To give you an idea to build on, if you would like to publish only items from a template you would need to do something like this (untested):
Add a property to pass the template
private readonly string _template;
public string Template
{
get
{
return this._template;
}
}
You would pass the template in the config like <param desc="template">...</param>
.
Add parameter to constructor
public CustomPublishAgent(string sourceDatabase, string targetDatabase, string mode, string languages, string template)
{
...
this._template = template;
}
Write a startPublish function to be used in the run method
private void StartPublish(IEnumerable<language> languages)
{
....
var items = .. // get the items you need based on _template (and other stuff) - preferably use the master index
var options = new PublishOptions(database1, database2, PublishMode.SingleItem, languages.FirstOrDefault<language>(), DateTime.Now)
foreach (var item in items)
{
options.RootItem = item;
Publisher publisher = new Publisher(options, languages);
publisher.PublishAsync();
}
}
You should be aware that this will start a publish job for each item that is found with you search query. If you want to publish based on several conditions, that will be hard to avoid. But don't do this for too many items at once...
End by adding your custom agent in a config patch:
<scheduling>
<agent type="YourNameSpace.CustomPublishAgent, YourAssembly" method="Run" interval="12:00:00">
<param desc="source database">master</param>
<param desc="target database">web</param>
<param desc="mode (full or incremental)">smart</param>
<param desc="languages">en</param>
<param desc="template">..</param>
</agent>
</scheduling>