I would like to perform my preset site creation. At this moment with my apps, if you create a preset site for a customer, a rules in DocumentLibrary run a script how check if its a folder and if his name is "documentLibrary" and if the name contains "-client" (i use this marks in name, because i dont want that script creat folder in other sites).
I hope you understand the steps. So what i would like is, when you select the preset site, a script is executed to create first "documentLibrary" in "Repository/Sites/'nameSite'" and after create folders i want and later, add permission if its possible.
The way your outlining with rules etc will work, but it will be messy because of the hardcoded names and checks etc.
Possibly an easier way is to do create a behaviour, which is what the other link was using - in its case a Behaviour that runs a script. A behaviour allows you to effectively bind some code (or a script) to what's effectively an event in Alfresco, like Site Creation. So every time a site is created do something (or don't do something if it's not using a preset you care about). This way you don't have to worry about rules creating your folders in places you don't want.
To avoid having to hard code a list of presets that you want to run this logic for, I'd suggest that your behaviour run through something like the following logic:
On create site do: <ol> <li>Get the name of the preset the site was created with</li> <li>Look in the Site Templates folder in the Data Dictionary for a folder with a name that matches the preset</li> <li>If none found, finish - we're not interested in this site</li> <li>If we do find a folder in Site Templates, create the document library folder if needed and then copy the Site Templates folder into the new site</li> <li>Add any permissions you're interested in to the folders you created</li> <li>Finish</li> </ol>
This basically allows you to use the preset name to do a lookup for the folder template you want to use. If you don't create a template for a preset, then its ignored and you don't do anything. So you can only only take action for the presets you want to, but still retain flexibility for handling new presets (with new templates maybe) if you want to.
I seem to remember Jeff Potts created a small add on that did something along these lines (maybe slightly differently). It might meet your needs without you having to do the customisation yourself: https://github.com/jpotts/share-site-space-templates