'How to run script from script AppsScripts? [duplicate]

I have script that uses whole limit time for scripts(6 minutes). So I decided just to make my job in parts. So I have script "Generate words". I need to run this scripts,and after "generate words" I need to do it again. Also I need to run it with arguments, so for example: "generate words(0,2)".

I cant just call this function again because of this time limit from AppsScripts.

So,I need to run script with arguments, from script, but to run it in other session, so time limit wont be exceeded.



Solution 1:[1]

To pass arguments to a function, you need to use a function that pase those arguments, i.e., let say that you want to execute a function called something but it requires two parameters, a, and b, first create a function (in the below example it's named main, that will pass such paramenters, the call this new function from the Editor toolbar :

function main(){
  const a = 'A';
  const b = 'B';
  something(a,b)
}

function something(a,b){
   console.log(`${a} - ${b}`)
}

If the arguments to be passed are calculated by other functions, you might save them using the Properties Service or another stuff like a spreadsheet.

Related

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1