constshape=SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];constlink=shape.getLink();if(link!=null){Logger.log(`Shape has a link of type: ${link.getLinkType()}`);}
הפונקציה מחזירה את הערך המקושר של Slide לסוגים של קישורים שאינם כתובות URL, אם הוא קיים. הפונקציה מחזירה את הערך null אם השקף לא קיים במצגת, או אם הערך של LinkType הוא LinkType.URL.
constshape=SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];constlink=shape.getLink();if(link!=null && link.getLinkType()!==SlidesApp.LinkType.URL){Logger.log(`Shape has link to slide: ${link.getLinkedSlide()}`);}
שימו לב: יכול להיות שהשקף עם המזהה שהוחזר לא קיים.
constshape=SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];constlink=shape.getLink();if(link!=null && link.getLinkType()===SlidesApp.LinkType.SLIDE_ID){Logger.log(`Shape has link to slide with ID: ${link.getSlideId()}`);}
חזרה
String
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחד או יותר מהיקפי הגישה הבאים:
שימו לב: יכול להיות שהשקף שמוצג באינדקס שהוחזר לא קיים.
constshape=SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];constlink=shape.getLink();if(link!=null && link.getLinkType()===SlidesApp.LinkType.SLIDE_INDEX){Logger.log(`Shape has link to slide with index: ${link.getSlideIndex()}`);}
חזרה
Integer
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחד או יותר מהיקפי הגישה הבאים:
שימו לב: יכול להיות שהשקף עם המיקום היחסי שהוחזר לא קיים.
constshape=SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];constlink=shape.getLink();if(link!=null && link.getLinkType()===SlidesApp.LinkType.SLIDE_POSITION){Logger.log(`Shape has link to slide with relative position: ${link.getSlidePosition()}`,);}
הפונקציה מחזירה את כתובת ה-URL לדף האינטרנט החיצוני או את הערך null אם הערך של LinkType הוא לא LinkType.URL.
constshape=SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];constlink=shape.getLink();if(link!=null && link.getLinkType()===SlidesApp.LinkType.URL){Logger.log(`Shape has link to URL: ${link.getUrl()}`);}
חזרה
String
אישור
סקריפטים שמשתמשים בשיטה הזו דורשים הרשאה עם אחד או יותר מהיקפי הגישה הבאים:
[[["התוכן קל להבנה","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-26 (שעון UTC)."],[[["\u003cp\u003eA \u003ccode\u003eLink\u003c/code\u003e object represents a hypertext link associated with a shape in Google Slides.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to determine the link type, retrieve linked slide information (if applicable), and access the URL for external web page links.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetLinkType()\u003c/code\u003e method identifies the type of link, such as URL, slide ID, or slide index.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003egetLinkedSlide()\u003c/code\u003e, \u003ccode\u003egetSlideId()\u003c/code\u003e, \u003ccode\u003egetSlideIndex()\u003c/code\u003e, and \u003ccode\u003egetSlidePosition()\u003c/code\u003e retrieve information about linked slides based on the link type.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetUrl()\u003c/code\u003e method returns the URL if the link type is \u003ccode\u003eURL\u003c/code\u003e, otherwise, it returns \u003ccode\u003enull\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["Link\n\nA hypertext link. \n\nMethods\n\n| Method | Return type | Brief description |\n|-------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getLinkType()](#getLinkType()) | [LinkType](/apps-script/reference/slides/link-type) | Returns the [LinkType](/apps-script/reference/slides/link-type). |\n| [getLinkedSlide()](#getLinkedSlide()) | [Slide](/apps-script/reference/slides/slide) | Returns the linked [Slide](/apps-script/reference/slides/slide) for non-URL links types, if it exists. |\n| [getSlideId()](#getSlideId()) | `String` | Returns the ID of the linked [Slide](/apps-script/reference/slides/slide) or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_ID](/apps-script/reference/slides/link-type#SLIDE_ID). |\n| [getSlideIndex()](#getSlideIndex()) | `Integer` | Returns the zero-based index of the linked [Slide](/apps-script/reference/slides/slide) or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_INDEX](/apps-script/reference/slides/link-type#SLIDE_INDEX). |\n| [getSlidePosition()](#getSlidePosition()) | [SlidePosition](/apps-script/reference/slides/slide-position) | Returns the [SlidePosition](/apps-script/reference/slides/slide-position) of the linked [Slide](/apps-script/reference/slides/slide) or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_POSITION](/apps-script/reference/slides/link-type#SLIDE_POSITION). |\n| [getUrl()](#getUrl()) | `String` | Returns the URL to the external web page or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.URL](/apps-script/reference/slides/link-type#URL). |\n\nDetailed documentation \n\n`get``Link``Type()` \nReturns the [LinkType](/apps-script/reference/slides/link-type).\n\n```javascript\nconst shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];\nconst link = shape.getLink();\nif (link != null) {\n Logger.log(`Shape has a link of type: ${link.getLinkType()}`);\n}\n```\n\nReturn\n\n\n[LinkType](/apps-script/reference/slides/link-type)\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n`get``Linked``Slide()` \nReturns the linked [Slide](/apps-script/reference/slides/slide) for non-URL links types, if it exists. Returns `null` if\nthe slide doesn't exist in the presentation, or if the [LinkType](/apps-script/reference/slides/link-type) is [LinkType.URL](/apps-script/reference/slides/link-type#URL).\n\n```javascript\nconst shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];\nconst link = shape.getLink();\nif (link != null && link.getLinkType() !== SlidesApp.LinkType.URL) {\n Logger.log(`Shape has link to slide: ${link.getLinkedSlide()}`);\n}\n```\n\nReturn\n\n\n[Slide](/apps-script/reference/slides/slide)\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n`get``Slide``Id()` \nReturns the ID of the linked [Slide](/apps-script/reference/slides/slide) or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not\n[LinkType.SLIDE_ID](/apps-script/reference/slides/link-type#SLIDE_ID).\n\nNote that the slide with the returned ID might not exist.\n\n```javascript\nconst shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];\nconst link = shape.getLink();\nif (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_ID) {\n Logger.log(`Shape has link to slide with ID: ${link.getSlideId()}`);\n}\n```\n\nReturn\n\n\n`String`\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n`get``Slide``Index()` \nReturns the zero-based index of the linked [Slide](/apps-script/reference/slides/slide) or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_INDEX](/apps-script/reference/slides/link-type#SLIDE_INDEX).\n\nNote that the slide at the returned index might not exist.\n\n```javascript\nconst shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];\nconst link = shape.getLink();\nif (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_INDEX) {\n Logger.log(`Shape has link to slide with index: ${link.getSlideIndex()}`);\n}\n```\n\nReturn\n\n\n`Integer`\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n`get``Slide``Position()` \nReturns the [SlidePosition](/apps-script/reference/slides/slide-position) of the linked [Slide](/apps-script/reference/slides/slide) or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.SLIDE_POSITION](/apps-script/reference/slides/link-type#SLIDE_POSITION).\n\nNote that the slide with the returned relative position might not exist.\n\n```javascript\nconst shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];\nconst link = shape.getLink();\nif (link != null && link.getLinkType() === SlidesApp.LinkType.SLIDE_POSITION) {\n Logger.log(\n `Shape has link to slide with relative position: ${\n link.getSlidePosition()}`,\n );\n}\n```\n\nReturn\n\n\n[SlidePosition](/apps-script/reference/slides/slide-position)\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`\n\n*** ** * ** ***\n\n`get``Url()` \nReturns the URL to the external web page or `null` if the [LinkType](/apps-script/reference/slides/link-type) is not [LinkType.URL](/apps-script/reference/slides/link-type#URL).\n\n```javascript\nconst shape = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];\nconst link = shape.getLink();\nif (link != null && link.getLinkType() === SlidesApp.LinkType.URL) {\n Logger.log(`Shape has link to URL: ${link.getUrl()}`);\n}\n```\n\nReturn\n\n\n`String`\n\nAuthorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/presentations.currentonly`\n- `https://www.googleapis.com/auth/presentations`"]]