Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

relink from different folders

New Here ,
Nov 04, 2015 Nov 04, 2015

Hi there

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

04-11-2015 11-10-55.png

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

TOPICS
Scripting
678
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Nov 04, 2015 Nov 04, 2015

Hi,

Relink to a File - not to a path (string)

Jarek

Translate
Mentor ,
Nov 04, 2015 Nov 04, 2015

Hi,

Relink to a File - not to a path (string)

Jarek

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2015 Nov 04, 2015

So there isn't a way of changing the path string directly through scipting?

05-11-2015 12-42-51.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 04, 2015 Nov 04, 2015

Hi,

The way I know is to create an object "File" from a new "Path" and relink()

Jarek

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2015 Nov 04, 2015

According to the InDesign Object Model it should not be necessary. This is why I find it confusing

ww.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Nov 04, 2015 Nov 04, 2015

Hi,

I will say you are right if you'll say I am right

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 04, 2015 Nov 04, 2015
LATEST

I think that they just copied the js documentation straight to vb documentation without checking. And since does automatic type casting....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines