A student self-checking, self-grading assignment provides students with immediate feedback to encourage additional effort and accuracy. When the Google Slides Presentation is copied (through Google Classroom or Drive), the Apps Script attached to the presentation is copied along with it. This is a three part project. This final part includes necessary functions and others that are helpful to complete the student self-checking assignment as well as a demonstration of how to easily create and format an assignment.
function setAlt() {
var presentation = SlidesApp.getActivePresentation();
var currentSlide = presentation.getSelection().getCurrentPage();
currentSlide.getShapes().forEach(function setTitles(shape) {
shape.setTitle("response");
});
}
function fillVowels() {
var presentation = SlidesApp.getActivePresentation();
presentation.getSlides().forEach(function clearAll(slide) {
slide.getPageElements().forEach(function clearAll(element) {
if (element.getPageElementType() == SlidesApp.PageElementType.SHAPE && element.asShape().getTitle() == "response" && element.asShape().getText().asString().trim() == "") {
element.asShape().getText().setText("a;e;i;o;u");
}
});
});
}
function clearResponses() {
var presentation = SlidesApp.getActivePresentation();
presentation.getSlides().forEach(function clearAll(slide) {
count = 0;
slide.getPageElements().forEach(function clearAll(element) {
if (element.getPageElementType() == SlidesApp.PageElementType.SHAPE && element.asShape().getTitle() == "response") {
element.asShape().getText().setText("");
}
});
});
}
function main() {
fillVowels();
buildKey();
clearResponses();
}
function onOpen() {
SlidesApp.getUi().createMenu("Other").addItem("Check Answers", "checkResponses").addToUi();
}