קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
רמת קידוד: בינונית משך: 15 דקות סוג הפרויקט: תוסף ל-Editor
מטרות
להבין מה הפתרון עושה.
הסבר על הפעולות של שירותי Apps Script בפתרון.
מגדירים את הסקריפט.
מריצים את הסקריפט.
מידע על הפתרון הזה
אפשר להשתמש בפתרון הזה כדי להוסיף סרגל התקדמות לתחתית השקפים במצגת.
איך זה עובד
הסקריפט מחשב כמה שקפים יש במצגת ומוסיף צורה של מלבן לחלק התחתון של כל שקף. הסקריפט מגדיל את הרוחב של כל צורת מלבן כדי להציג את ההתקדמות בשקפים.
שירותי Apps Script
הפתרון הזה משתמש בשירות הבא:
Slides service – מקבל את השקפים של מצגת ומוסיף לכל אחד מהם צורה של מלבן.
דרישות מוקדמות
כדי להשתמש בדוגמה הזו, צריך לעמוד בדרישות המוקדמות הבאות:
חשבון Google (יכול להיות שחשבונות Google Workspace ידרשו אישור אדמין).
דפדפן אינטרנט עם גישה לאינטרנט.
הגדרת הסקריפט
כדי ליצור עותק של מצגת סרגל ההתקדמות ב-Slides, לוחצים על הלחצן הבא:
פרויקט Apps Script של הפתרון הזה מצורף למצגת.
יצירת עותק
במצגת, לוחצים על תוספים>סרגל התקדמות>הצגת סרגל ההתקדמות.
כשמוצגת בקשה, מאשרים את הסקריפט.
אם במסך ההסכמה ל-OAuth מוצגת האזהרה האפליקציה הזו לא אומתה, ממשיכים בתהליך על ידי בחירה באפשרות מתקדם>מעבר אל {שם הפרויקט} (לא בטוח).
שוב, לוחצים על תוספים>סרגל התקדמות>הצגת סרגל התקדמות.
כדי להסיר את סרגל ההתקדמות, לוחצים על תוספים>סרגל התקדמות>הסתרת סרגל ההתקדמות.
בדיקת הקוד
כדי לבדוק את קוד Apps Script של הפתרון הזה, לוחצים על הצגת קוד המקור למטה:
/** * @OnlyCurrentDoc Adds progress bars to a presentation. */constBAR_ID='PROGRESS_BAR_ID';constBAR_HEIGHT=10;// px/** * Runs when the add-on is installed. * @param {object} e The event parameter for a simple onInstall trigger. To * determine which authorization mode (ScriptApp.AuthMode) the trigger is * running in, inspect e.authMode. (In practice, onInstall triggers always * run in AuthMode.FULL, but onOpen triggers may be AuthMode.LIMITED or * AuthMode.NONE.) */functiononInstall(e){onOpen();}/** * Trigger for opening a presentation. * @param {object} e The onOpen event. */functiononOpen(e){SlidesApp.getUi().createAddonMenu().addItem('Show progress bar','createBars').addItem('Hide progress bar','deleteBars').addToUi();}/** * Create a rectangle on every slide with different bar widths. */functioncreateBars(){deleteBars();// Delete any existing progress barsconstpresentation=SlidesApp.getActivePresentation();constslides=presentation.getSlides();for(leti=0;i < slides.length;++i){constratioComplete=(i/(slides.length-1));constx=0;consty=presentation.getPageHeight()-BAR_HEIGHT;constbarWidth=presentation.getPageWidth()*ratioComplete;if(barWidth > 0){constbar=slides[i].insertShape(SlidesApp.ShapeType.RECTANGLE,x,y,barWidth,BAR_HEIGHT);bar.getBorder().setTransparent();bar.setLinkUrl(BAR_ID);}}}/** * Deletes all progress bar rectangles. */functiondeleteBars(){constpresentation=SlidesApp.getActivePresentation();constslides=presentation.getSlides();for(leti=0;i < slides.length;++i){constelements=slides[i].getPageElements();for(constelofelements){if(el.getPageElementType()===SlidesApp.PageElementType.SHAPE&&
el.asShape().getLink()&&
el.asShape().getLink().getUrl()===BAR_ID){el.remove();}}}}
תורמים
הדוגמה הזו מתוחזקת על ידי Google בעזרת מומחי Google לפיתוח.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-25 (שעון UTC)."],[[["This Google Apps Script solution adds a progress bar to the bottom of Google Slides presentations to visually track progress through the slides."],["The script uses the Slides service to calculate the number of slides, add a rectangle shape to each slide, and dynamically adjust the rectangle's width to represent progress."],["Users can easily install the script by making a copy of the provided presentation and authorizing the script to access their Google Slides."],["The progress bar can be shown or hidden using the \"Progress bar\" menu found under \"Extensions\" in Google Slides after installation."],["Developers can review and modify the source code, which is publicly available on GitHub, for customization or further development."]]],["This solution adds a progress bar to Google Slides presentations using Apps Script. The script calculates the total slides and adds a rectangle to the bottom of each slide, increasing the rectangle's width to visually represent progress. Users copy a sample presentation, authorize the script, and then run it to create or remove the progress bars via the \"Extensions\" menu. It utilizes the Slides service to manipulate slides and shapes, adding and deleting these elements.\n"]]