Google Slaytlar sunularında ilerleme çubuklarını gösterme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Kodlama seviyesi: Orta Süre: 15 dakika Proje türü: Düzenleyici eklentisi
Hedefler
Çözümün ne işe yaradığını anlayın.
Apps Script hizmetlerinin çözümde ne yaptığını anlayın.
Komut dosyasını ayarlayın.
Komut dosyasını çalıştırın.
Bu çözüm hakkında
Sununuzdaki slaytların alt kısmına ilerleme çubuğu eklemek için bu çözümü kullanın.
İşleyiş şekli
Komut dosyası, sunumdaki slayt sayısını hesaplar ve her slaytın alt kısmına bir dikdörtgen şekli ekler. Komut dosyası, slaytlardaki ilerlemeyi göstermek için her dikdörtgen şeklin genişliğini artırır.
Apps Komut Dosyası hizmetleri
Bu çözüm aşağıdaki hizmeti kullanır:
Slaytlar hizmeti: Bir sununun slaytlarını alır ve her birine bir dikdörtgen şekli ekler.
Ön koşullar
Bu örneği kullanmak için aşağıdaki ön koşullara ihtiyacınız vardır:
Google Hesabı (Google Workspace hesapları için yönetici onayı gerekebilir).
İnternete erişimi olan bir web tarayıcısı.
Komut dosyasını ayarlama
İlerleme çubuğu Slaytlar sunusunun kopyasını oluşturmak için aşağıdaki düğmeyi tıklayın. Bu çözümün Apps Komut Dosyası projesi sunucuya eklenmiştir.
Kopya oluştur
İstendiğinde komut dosyasını yetkilendirin.
OAuth izin ekranında Bu uygulama doğrulanmadı uyarısı gösteriliyorsa Gelişmiş>{Proje Adı}'na git (güvenli değil)'i seçerek devam edin.
Tekrar Uzantılar>İlerleme çubuğu>İlerleme çubuğunu göster'i tıklayın.
İlerleme çubuğunu kaldırmak için Uzantılar>İlerleme çubuğu>İlerleme çubuğunu gizle'yi tıklayın.
Kodu inceleme
Bu çözümün Apps Komut Dosyası kodunu incelemek için aşağıdaki Kaynak kodunu görüntüle'yi tıklayın:
/** * @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('Showprogressbar','createBars').addItem('Hideprogressbar','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();}}}}
Katkıda bulunanlar
Bu örnek, Google Geliştirici Uzmanları'nın yardımıyla Google tarafından yönetilir.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2024-12-22 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"]]