So am trying to make a scoreboard thing for fun and I used this script which can make this function possible and this is where I get stuck the values are not updating when clicked on during presentatioin mode. What can I do to fix this problem?
I tried using this script:
function onOpen() {
var presentation = SlidesApp.getActivePresentation();
var slides = presentation.getSlides();
slides.forEach(function(slide) {
var shapes = slide.getShapes();
shapes.forEach(function(shape) {
if (shape.getText().asString().match(/^\d+$/)) {
var action = SlidesApp.newAction()
.setFunction('increaseNumber')
.setParameters({ shapeId: shape.getObjectId() })
.build();
shape.onShapeClicked().setAction(action);
}
});
});
}
function increaseNumber(e) {
var presentation = SlidesApp.getActivePresentation();
var slide = presentation.getSlides()[0]; // Change the index as needed
var shapeId = e.source.getObjectId();
var shape = slide.getShapeById(shapeId);
var text = shape.getText().asString();
var number = parseInt(text);
if (!isNaN(number)) {
number += 1;
shape.getText().setText(String(number));
}
}
Tags
When I applied this and nothing happened when I clicked on the textbox so what did I do wrong?