GetRefObj Method (Article)

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Mar/2016, at 17:07

Description

Return a reference object corresponding to the picture, multi-media or URL referenced by the specified text.

Available in Ted and Fred.

Syntax

dim objobj = object.GetRefObj (nIdx)

object

Required. Object name. Returned by Ted.GetActiveArticle.

nIdx

Index of the text, ranging from 0 = first text in the article to NTxts-1 = last text in the article. If nIdx is outside this range a run-time error is raised. To get the idx of the current element, use GetCurTxtIdx.

Remarks

If the text does not reference anything, GetObj does not return a valid object - so it is generally a good idea to first test the presence of the referenced object using the HasObj function.

Example

This script returns the referenced object (if it exists), and displays a message; otherwise, it displays the warning that the text has no object.

If Ted.HasActiveArticle Then

 Dim objArticle = Ted.GetActiveArticle

 dim iCurTxt as Integer = objArticle.GetCurTxtIdx

 If objArticle.HasRefObj(iCurTxt) Then

               Dim objobj = objArticle.GetRefObj(iCurTxt)

         msgbox ("Text " & iCurTxt & " has object.")

 Else

         msgbox ("Text " & iCurTxt & " has no object.")

 End If

End If

Context

Article object

See also

HasRefObj, InsObj, InsObjDlg, CanInsObj