Hi,
I would like to create a very specific page numbering on my slides.
I would like to use Apps Scipt for this
But I find few sources
I can't get the position of a slide in the presentation?
There is an AutoText Class but I can't find any example to use it
Can you help me?
Thanks
Solved! Go to Solution.
This will work
function slidePageNumber() {
let current = SlidesApp.getActivePresentation().getSelection().getCurrentPage().getObjectId();
const pages = SlidesApp.getActivePresentation().getSlides();
for(let i = 0 ; i < pages.length ; i++){
if(pages[i].getObjectId() == current){
console.log(i+1)
return ;
}
}
}
Stรฉphane
Hi
Not sure if that will fit your needs but the example of the progress bar could help maybe ?
https://developers.google.com/apps-script/add-ons/editors/slides/quickstart/progress-bar
Stรฉphane
Hi Stephane,
Yes, I have already seen this example but it does not give me the solution for the numbers of each slide.
A simple trick:
I select some text on a slide,
I would like to know the number of this slide ?
How do I do this?
Thanks
Not sure to understand but when you are on edit mode when you are on a slide on the left nav bar, the selected slides have yellow border and there is number displayed at the top left.
You want something in presentation mode ?
stรฉphane
No no, I speak about apps script.
I write this in a bounded script in order to get the selected page
var currentPage = SlidesApp.getActivePresentation().getSelection().getCurrentPage();
But, how I can retrieve the page number ?
This will work
function slidePageNumber() {
let current = SlidesApp.getActivePresentation().getSelection().getCurrentPage().getObjectId();
const pages = SlidesApp.getActivePresentation().getSlides();
for(let i = 0 ; i < pages.length ; i++){
if(pages[i].getObjectId() == current){
console.log(i+1)
return ;
}
}
}
Stรฉphane
Yes, I'm OK with that
I thought there was a native function in the Google Slides API that allows you to retrieve the position of the Slide, but NO !! Very strange !
In order to continue my research on specific page numbering, I am also looking for example scripts that use the AutoText class
What can I do with this AutoText class?
Thanks
I don't know, on my side I don't invest lot of time in apps script Google Slides project so I don't really know the functions available.
Stรฉphane
No worries Stephane !
Maybe someone else will have information?
Thanks