tps://sites.google.com/site/algarbtecno/system/app/pages/admin/scripts?pli=1
Admintec v1
Nou format de Scripts: Dues parts Codi GS i IndexHTML
Codi GS
//pagina interessant https://developers.google.com/apps-script/guides/html/communication
//restriccions https://developers.google.com/apps-script/guides/html/restrictions
function doGet() {
return HtmlService.createHtmlOutputFromFile('index')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
function getEmail() {
return Session.getActiveUser().getEmail();
}
function getUnreadEmails() {
// 'got' instead of 'get' will throw an error.
return GmailApp.gotInboxUnreadCount();
}
function processForm(formObject) {
var formBlob = formObject.myFile;
var driveFile = DriveApp.createFile(formBlob);
return driveFile.getUrl();
}
Index HTML
<div>
<html>
<script>
function updateButton(email, button) {
button.value = 'Clicked by ' + email;
}
function FuncioErrada(missatge){
alert(missatge);
}
google.script.run.withFailureHandler(FuncioErrada)
.getUnreadEmails();
function updateUrl(url) {
var div = document.getElementById('output');
div.innerHTML = '<a href="' + url + '">Got it!</a>';
}
</script>
<body>
<input type="button" value="Not Clicked"
onclick="google.script.run
.withSuccessHandler(updateButton)
.withUserObject(this)
.getEmail()" />
<input type="button" value="Not Clicked"
onclick="google.script.run
.withSuccessHandler(updateButton)
.withUserObject(this)
.getEmail()" />
<form id="myForm">
<input name="myFile" type="file" />
<input type="button" value="Submit"
onclick="google.script.run
.withSuccessHandler(updateUrl)
.processForm(this.parentNode)" />
</form>
<div id="output">Incognita</div>
<span id="result">No result yet...</span>
</body>
</html>
</div>
https://docs.google.com/open?id=0BydI2J4r0Z-2U3lyX0pPNmxTQ0Ehttps://docs.google.com/open?id=0BydI2J4r0Z-2U3lyX0pPNmxTQ0E
WhatsApp: https://drive.google.com/file/d/0B2a0JKHBLsAMUGZWSXZGSGVZNU0/edit?usp=sharing
C7: https://drive.google.com/file/d/0B2a0JKHBLsAMbnVaVVJkYnpoZk0/edit?usp=sharing
C10: https://drive.google.com/file/d/0B2a0JKHBLsAMSU1JcnU2NkF6bE0/edit?usp=sharing