उपयोगकर्ता ने ऐक्टिव प्रज़ेंटेशन में क्या चुना है.
const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage(); const selectionType = selection.getSelectionType();
तरीके
| तरीका | रिटर्न टाइप | संक्षिप्त विवरण |
|---|---|---|
get | Page|null | अगर कोई पेज चालू नहीं है, तो फ़िलहाल चालू Page या null दिखाता है. |
get | Page | यह फ़ंक्शन, चुने गए Page इंस्टेंस का Page कलेक्शन या null दिखाता है. ऐसा तब होता है, जब कोई Page इंस्टेंस नहीं चुना जाता.Page |
get | Page | यह फ़्लिमस्ट्रिप में मौजूद Page इंस्टेंस का Page कलेक्शन दिखाता है. ये इंस्टेंस चुने गए हैं या null अगर चुना गया इंस्टेंस Selection टाइप का नहीं है. |
get | Selection | Selection दिखाता है. |
get | Table | यह फ़ंक्शन, चुने गए Table इंस्टेंस का Table कलेक्शन दिखाता है. अगर कोई Table इंस्टेंस नहीं चुना गया है, तो यह null दिखाता है.Table |
get | Text | यह फ़ंक्शन, चुनी गई Text या null दिखाता है. हालांकि, ऐसा तब होता है, जब चुना गया विकल्प Selection टाइप का न हो. |
ज़्यादा जानकारी वाला दस्तावेज़
getCurrentPage()
अगर कोई पेज चालू नहीं है, तो फ़िलहाल चालू Page या null दिखाता है.
const selection = SlidesApp.getActivePresentation().getSelection(); const currentPage = selection.getCurrentPage(); if (currentPage != null) { Logger.log(`Selected current active page ID: ${currentPage.getObjectId()}`); }
वापसी का टिकट
Page|null
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
getPageElementRange()
यह फ़ंक्शन, चुने गए PageElementRange इंस्टेंस का PageElementRange कलेक्शन या null दिखाता है. ऐसा तब होता है, जब कोई PageElement इंस्टेंस नहीं चुना जाता.PageElement
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}`); }
वापसी का टिकट
PageElementRange|null
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
getPageRange()
यह फ़ंक्शन, फ़िल्मस्ट्रिप में मौजूद PageRange Page इंस्टेंस का कलेक्शन दिखाता है. ये इंस्टेंस, चुने गए होते हैं या null अगर चुना गया इंस्टेंस SelectionType.PAGE टाइप का नहीं है, तो यह फ़ंक्शन null दिखाता है.
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}`, ); }
वापसी का टिकट
PageRange|null
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
getSelectionType()
SelectionType दिखाता है.
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()}`); }
वापसी का टिकट
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
getTableCellRange()
यह फ़ंक्शन, चुने गए TableCellRange इंस्टेंस का TableCellRange कलेक्शन दिखाता है. अगर कोई TableCell इंस्टेंस नहीं चुना गया है, तो यह null दिखाता है.TableCell
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}`); }
वापसी का टिकट
TableCellRange|null
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
getTextRange()
यह फ़ंक्शन, चुनी गई TextRange या null दिखाता है. हालांकि, ऐसा तब होता है, जब चुना गया विकल्प SelectionType.TEXT टाइप का न हो.
TextRange दो स्थितियों को दिखाता है:
1. चुने गए टेक्स्ट की रेंज. उदाहरण के लिए, अगर किसी शेप में "Hello" टेक्स्ट है और "He" चुना गया है, तो दिखाई गई रेंज में TextRange.getStartIndex() = 0 और TextRange.getEndIndex() = 2 होगा.
2. कर्सर की पोज़िशन. उदाहरण के लिए, अगर किसी शेप में "Hello" टेक्स्ट है और कर्सर "H" के बाद है, तो ("H|ello"), दिखाई गई रेंज में TextRange.getStartIndex() = 1 और TextRange.getEndIndex() = 1 होगा.
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()}`); }
वापसी का टिकट
TextRange|null
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या उससे ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations