Framescript: Retrieving text from a broken xref
Hello fellows,
I'd like to write a script that will find broken external xrefs and attempt to restore them. In my case, the xrefs get broken because the xref markers appearing in the source files are often updated by a system that generates these source files. I'd like to restore the xrefs by retrieving the xref string and attempting to find this string in the source files. But here is a problem: when an xref is broken, it no longer allows to retrieve XRefSrcText properly. The xref string no longer appears in XRefSrcText. I used the following code to test that:
Set vCurrentDoc = ActiveDoc;
Set vXRef = vCurrentDoc.FirstXRefInDoc;
Loop While(vXRef)
If vXRef.XRefIsUnresolved
Write Console vXRef.XRefSrcText;
EndIf
Set vXRef = vXRef.NextXRefInDoc;
EndLoop
So, the XRefSrcText of an unresolved xref appears as follows:
25117: TableTitleTable Entry: ;2511718;2511719
While the XRefSrcText of a live xref appears as follows:
41369: TableTitle: Table 329: Item Numbering
What I would need to extract from here is the string "Item Numbering" and then find it in the xref source file to create a new link.
My question is how can one retrieve the text string from a broken xref? One way I could think of is converting the xrefs to text, copying the relevant part into a variable using regex. Any other ideas?
Thank you!
