Copy link to clipboard
Copied
Hi there
Can't get the relink to work within vbscript. It should be simple, but it isn't (for me). Getting this error

I have two scripts I use:
One that saves information about my links in a text file. Doing this because I link to many different locations.
One that needs to read this text file in order to relink to correct files again.
First script:
Rem To be used for Dumping all linked file information from InDesign
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set myInDesign = CreateObject("InDesign.Application.CC.2015")
'Get Indesign file name and use that to name txt file
TextFileName = myInDesign.ActiveDocument.Name
TextFileName = "C:\" + TextFileName + ".txt"
Set ts = objFSO.CreateTextFile(TextFileName, True)
If myInDesign.Documents.Count > 0 Then
txt = "Saving all links from " & Chr(13) & Chr(10) & myInDesign.ActiveDocument.Name
If MsgBox(txt, vbOKCancel) = vbOK Then
For Each link in myInDesign.ActiveDocument.Links
LinkPath = link.FilePath
ts.WriteLine (LinkPath)
Next
ts.Close
End If
Else
MsgBox "Hallo!?"
End If
Second script:
Rem To be used for relinking files into InDesign
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set myInDesign = CreateObject("InDesign.Application.CC.2015")
TextFileName = myInDesign.ActiveDocument.Name
TextFileName = "C:\" + TextFileName + ".txt"
Set ts = objFSO.OpenTextFile(TextFileName)
For Each link in myInDesign.ActiveDocument.Links
WrongLinkPath = link.FilePath
RightLinkPath = ts.ReadLine
Relink(RightLinkPath) <-------This won't work
Next
ts.Close
Hi,
Relink to a File - not to a path (string)
Jarek
Copy link to clipboard
Copied
Hi,
Relink to a File - not to a path (string)
Jarek
Copy link to clipboard
Copied
So there isn't a way of changing the path string directly through scipting?

Copy link to clipboard
Copied
Hi,
The way I know is to create an object "File" from a new "Path" and relink()
Jarek
Copy link to clipboard
Copied
According to the InDesign Object Model it should not be necessary. This is why I find it confusing

Copy link to clipboard
Copied
Hi,
I will say you are right if you'll say I am right
Copy link to clipboard
Copied
I think that they just copied the js documentation straight to vb documentation without checking. And since does automatic type casting....
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more