Sto cercando di ottenere il carrozzone di Javascript for Automation. Ho scritto uno script veloce che automatizza la mia email di richiesta di viaggio, con alcune finestre di dialogo.
Ecco il mio codice:
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();
Ma quando eseguo lo script, i luoghi in cui ho usato le variabili sembrano venire come [oggetto Object]. (Vedi sotto)
Qualcuno può per favore indicare dove sbaglio?