Estoy intentando acceder al carro de Javascript para automatización. Escribí una secuencia de comandos rápida que automatiza mi correo electrónico de solicitud de viaje, con algunos cuadros de diálogo.
Aquí está mi código:
Mail = Application("Mail");
Mail.includeStandardAdditions = true
Origin = Mail.displayDialog(
'Where is the trip starting from?',
{ defaultAnswer: 'Shanghai',
buttons:["Cancel", "Continue"],
defaultButton: "Continue"
})
Destination = Mail.displayDialog(
'Where is the trip to?',
{ defaultAnswer: "",
buttons:["Cancel", "Continue"],
defaultButton: "Continue"
})
StartDate = Mail.displayDialog(
'When are you leaving?',
{ title: "Onward Flight Date",
defaultAnswer: "",
buttons:["Cancel", "Continue"],
defaultButton: "Continue"
})
RtnDate = Mail.displayDialog(
'When are you returning?',
{ title: "Return Flight Date",
defaultAnswer: "",
buttons:["Cancel", "Continue"],
defaultButton: "Continue"
})
content = 'Hi \n\n'
+ 'I am currently trying to arrange travel for an upcoming trip.\n\n'
+ 'Could you please help me in sorting out the flights, hotels and airport transfers?\n\n'
+ 'Please find below the details of the trip:\n\n'
+ 'FLIGHTS\n\n'
+ 'Onward Journey:\n'+ '\n'
+ ' From \t\t\t\t- ' + Origin.text +'\n'
+ ' To \t\t\t\t\t- ' + Destination + '\n'
+ ' Date of Departure \t- ' + StartDate + '\n' + '\n'
+ 'Return Journey:\n'+ '\n'
+ ' From \t\t\t\t- ' + Destination + '\n'
+ ' To \t\t\t\t\t- ' + Origin + '\n'
+ ' Date of Departure \t- ' +RtnDate+ '\n' + '\n'
+ 'Preferred Airline \t\t\t\t- Star Alliance \n'
+ 'Meal Preference \t\t\t\t- Vegetarian\n'+ '\n'
+ 'Loyalty Program\t\t\t\t- United:\n'
+ '\n ________________________________________ \n'+ '\n'
+ 'HOTEL\n\n'
+ ' CheckIn Date \t\t- ' + StartDate + '\n'
+ ' CheckOut Date \t\t- ' + RtnDate + '\n' + '\n'
+ 'Preferred Hotels \t\t\t\t- SPG\n'
+ 'Loyalty Program \t\t\t\t- SPG:\n'
+ '\n ________________________________________ \n'+ '\n'
+ 'Thank you\n'
msg = Mail.OutgoingMessage({
subject: 'Itinerary Request - ',
content: content,
visible: true
});
Mail.outgoingMessages.push(msg);
Mail.activate();
Pero cuando ejecuto el script, los lugares donde he usado las variables parecen venir como [objeto Object]. (Se muestra abajo)
¿Alguien puede indicar dónde me estoy equivocando?