You would have to set up a document-level variable for every template, and test for its value whenever you attempt to spawn the Template. If the value of the variable is the initial value, you may spawn, and then immediately change the variable value.
If you allow for deleting the spawned pages, you could reset the value of that variable.
Example:
In a document-level script define and initialize the variable (important: outside of a function):
var t1spawned = false ;
Code snippet for spawning:
if (t1spawned) {
// Template has already been used
app.alert("can not spawn Template T1") ;
} else {
// Template has not yet been used
this.getTemplate("T1").spawn(…) ;
t1spawned = true ;
}
where you have to adjust the name of the Template, as well as the arguments of spawn()
Hope this can help.
Max Wyss.