Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8075665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:04:05+00:00 2026-06-05T15:04:05+00:00

I would like to run this script (embed drive list in a site) that

  • 0

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:

  1. 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.

  2. 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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:04:06+00:00Added an answer on June 5, 2026 at 3:04 pm

    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 :

    function officeHours() {
        var nowH=new Date().getHours();
        var nowD=new Date().getDay();
        // Logger.log('day : '+nowD+'   Hours : '+nowH)
        if (nowH>17||nowH<8||nowD==6||nowD==0) { return }
    
       Browser.msgBox('time to work !');//normally your real function should begin here...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have script.sh that must be run as user2. However, this script can only
I have a shell script that I would like to run at the end
When my PHP script runs, I would like to run a link like this
I have a function i would like to run onChange. This works fine with
I would like to run a scheduled batch script that will upload a file
I would like run a PHP script that runs every second to update a
I have a project in eclipse I would like to run a perl script
I would like to run a bash script that recursively cleans up every filename
I would like to run a script in production. This script generates a record
I would like to know how to run a file like this: Search-Mailbox -Identity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.