I would like to run this script (embed drive list in a site) that I have used but only set the trigger to run it during office hours Monday - Friday.
I would like the script to run every 5 minutes but stop over night and at weekend. So I figured that I need to:
Have a script that programatically creates a trigger to run the actual function during the day and give that a trigger to run once at the beginning of each day.
Have a second script to delete the days trigger run once at the end of the day.
I am doing this as I have just learned that there is a maximum amount of CPU time you can use during a day so I do not want to waste it during times I don't need the list updated.
I can see how to create a trigger but it is not clear how to create a trigger to activate another script (function).
I think it would be quite easier to insert a small routine at the beginning of your main function that checks the time of the day and simply 'returns' when out of office hours. This way you can let your trigger set to 5 minutes all the time. This 'hour check' will be very short in terms of processing time.
here is a test function to show how it works :