i am trying to have one function which i run on a timer call another function that requires parameters, my code is a very slightly modified version of this tutorial i have removed the sms call and the following code works
function testFunction() {
var label = GmailApp.getUserLabelByName('GApps/Test');
var emails = label.getThreads();
var now = new Date().getTime();
for(i in emails){
CalendarApp.createEvent('You got an Email!', new Date(now+60000), new Date(now+60000));
}
}
I have set up a filter in gmail that applies the sub-label test (from the GApps) label family on any email i get from a certain email address, when i get an email from this address and it gets the label test the above code adds an entry to my google calendar, with the event name You got and Email! that both begins and ends one minute from the current time
function gmail2cal(labLoc, event) {
var label = GmailApp.getUserLabelByName(labLoc);
var emails = label.getThreads();
var now = new Date().getTime();
for(i in emails){
CalendarApp.createEvent(event, new Date(now+60000), new Date(now+60000));
}
}
Now here is the same code, with the strings substituted for variables, providing this function is called with two parameters that with the same values as the previous block of code it should function identically
function launcher(){
gmail2cal('GApps/Test','You got an Email!');
}
But when i use the run function button in the Google apps script editor, the function gmail2cal doesn't work and i don't understand why