उपयोगकर्ता ने ऐक्टिव प्रज़ेंटेशन में क्या चुना है.
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 टाइप का न हो. |
ज़्यादा जानकारी वाला दस्तावेज़
get Current Page()
अगर कोई पेज चालू नहीं है, तो फ़िलहाल चालू 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
get Page Element Range()
यह फ़ंक्शन, चुने गए Page इंस्टेंस का Page कलेक्शन या null दिखाता है. ऐसा तब होता है, जब कोई Page इंस्टेंस नहीं चुना जाता.Page
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}`); }
वापसी का टिकट
Page
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या एक से ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Page Range()
यह फ़्लिमस्ट्रिप में मौजूद Page इंस्टेंस का Page कलेक्शन दिखाता है. ये इंस्टेंस चुने गए हैं या null अगर चुना गया इंस्टेंस Selection टाइप का नहीं है.
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}`, ); }
वापसी का टिकट
Page
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या एक से ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Selection Type()
Selection दिखाता है.
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
get Table Cell Range()
यह फ़ंक्शन, चुने गए Table इंस्टेंस का Table कलेक्शन दिखाता है. अगर कोई Table इंस्टेंस नहीं चुना गया है, तो यह null दिखाता है.Table
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}`); }
वापसी का टिकट
Table
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या एक से ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations
get Text Range()
यह फ़ंक्शन, चुनी गई Text या null दिखाता है. हालांकि, ऐसा तब होता है, जब चुना गया विकल्प Selection टाइप का न हो.
Text का मतलब दो स्थितियां हैं:
1. चुने गए टेक्स्ट की रेंज. उदाहरण के लिए, अगर किसी शेप में "Hello" टेक्स्ट है और "He" चुना गया है, तो दिखाई गई रेंज में Text = 0 और Text = 2 होगा.
2. कर्सर की जगह. उदाहरण के लिए, अगर किसी शेप में "Hello" टेक्स्ट है और कर्सर "H" के बाद है, ("H|ello"), तो दिखाई गई रेंज में Text = 1 और Text = 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()}`); }
वापसी का टिकट
Text
अनुमति देना
इस तरीके का इस्तेमाल करने वाली स्क्रिप्ट के लिए, इनमें से एक या एक से ज़्यादा स्कोप के साथ अनुमति लेना ज़रूरी है:
-
https://www.googleapis.com/auth/presentations.currentonly -
https://www.googleapis.com/auth/presentations