Kullanıcının etkin sunudaki seçimi.
const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage(); const selectionType = selection.getSelectionType();
Yöntemler
| Yöntem | Dönüş türü | Kısa açıklama |
|---|---|---|
get | Page|null | Etkin bir sayfa yoksa şu anda etkin olan Page veya null değerini döndürür. |
get | Page | Seçilen Page örneklerinin Page koleksiyonunu veya Page örnek seçilmemişse null değerini döndürür. |
get | Page | Seçilen film şeridindeki Page bir Page örnekleri koleksiyonunu veya seçim Selection türünde değilse null değerini döndürür. |
get | Selection | Selection değerini döndürür. |
get | Table | Seçilen Table örneklerin Table koleksiyonunu veya null seçilen Table örnek yoksa döndürür. |
get | Text | Seçilen Text değerini veya seçim Selection türünde değilse null değerini döndürür. |
Ayrıntılı belgeler
get Current Page()
Etkin bir sayfa yoksa şu anda etkin olan Page veya null değerini döndürür.
const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage(); if (currentPage != null) { Logger.log(`Selected current active page ID: ${currentPage.getObjectId()}`); }
Return
Page|null
Yetkilendirme
Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Element Range()
Seçilen Page örneklerinin Page koleksiyonunu veya Page örnek seçilmemişse null değerini döndürür.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.PAGE_ELEMENT) { const currentPage = selection.getCurrentPage(); const pageElements = selection.getPageElementRange().getPageElements(); Logger.log(`Number of page elements selected: ${pageElements.length}`); }
Return
Page
Yetkilendirme
Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Range()
Seçilen film şeridindeki Page bir Page örnekleri koleksiyonunu veya seçim Selection türünde değilse null değerini döndürür.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.PAGE) { const pageRange = selection.getPageRange(); Logger.log( `Number of pages in the flimstrip selected: ${ pageRange.getPages().length}`, ); }
Return
Page
Yetkilendirme
Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Selection Type()
Selection değerini döndürür.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.CURRENT_PAGE) { const currentPage = selection.getCurrentPage(); Logger.log(`Selected current active page ID: ${currentPage.getObjectId()}`); }
Return
Yetkilendirme
Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Table Cell Range()
Seçilen Table örneklerin Table koleksiyonunu veya null seçilen Table örnek yoksa döndürür.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.TABLE_CELL) { const currentPage = selection.getCurrentPage(); const tableCells = selection.getTableCellRange().getTableCells(); const table = tableCells[0].getParentTable(); Logger.log(`Number of table cells selected: ${tableCells.length}`); }
Return
Table
Yetkilendirme
Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Text Range()
Seçilen Text değerini veya seçim Selection türünde değilse null değerini döndürür.
Text, iki senaryoyu temsil eder:
1. Seçilen metin aralığı. Örneğin, bir şekilde "Merhaba" metni varsa ve "He" seçiliyse döndürülen aralıkta Text = 0 ve Text = 2 olur.
2. İmleç konumu Örneğin, bir şekilde "Merhaba" metni varsa ve imleç "M"den sonra ise ("M|erhaba"), döndürülen aralıkta Text = 1 ve Text = 1 olur.
const selection = SlidesApp.getActivePresentation().getSelection(); const selectionType = selection.getSelectionType(); if (selectionType === SlidesApp.SelectionType.TEXT) { const currentPage = selection.getCurrentPage(); const pageElement = selection.getPageElementRange().getPageElements()[0]; const textRange = selection.getTextRange(); Logger.log(`Text selected: ${textRange.asString()}`); }
Return
Text
Yetkilendirme
Bu yöntemi kullanan komut dosyaları, aşağıdaki kapsamlardan biri veya daha fazlasıyla yetkilendirme gerektirir:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations