Thread View: adobe.scripting.indesign
9 messages
9 total messages
Started by Sheldon_Zacharias
Thu, 12 Feb 2009 13:49
CS4 fails to Relink images
Author: Sheldon_Zacharias
Date: Thu, 12 Feb 2009 13:49
Date: Thu, 12 Feb 2009 13:49
1 lines
742 bytes
742 bytes
I have a VB script that ran fine with CS2 and CS3, but when I run it with CS4 it fails when I call the Relink method on a Link object. Has anyone experienced any issues with relinking in CS4.
Re: CS4 fails to Relink images
Author: Sheldon_Zacharias
Date: Tue, 17 Feb 2009 21:52
Date: Tue, 17 Feb 2009 21:52
5 lines
779 bytes
779 bytes
Has anyone been able to relink images using InDesign CS4 or InDesign CS4 Server? I can not get my old CS3 scripts to run. Any input would be appreciated! Thanks
Re: CS4 fails to Relink images
Author: Olav_Kvern
Date: Tue, 17 Feb 2009 21:55
Date: Tue, 17 Feb 2009 21:55
18 lines
868 bytes
868 bytes
Hi Sheldon,
I've had no problem relinking with InDesign CS4. Typically, I use something like this:
function myReplaceLink(myLink, myFilePath){
myLink.relink(File(myFilePath));
myLink.update();
}
Where "myLink" is a link and "myFilePath" is a string.
Thanks,
Ole
Re: CS4 fails to Relink images
Author: Sheldon_Zacharias
Date: Tue, 17 Feb 2009 22:17
Date: Tue, 17 Feb 2009 22:17
5 lines
894 bytes
894 bytes
I have been doing the same thing for years, without a problem, using InDesign or InDesign Server. I am just starting to test InDesign Server CS4 and I am finding that it fails everytime I attempt to call the relink method. Do you have any experience with InDesign Server CS4?
Re: CS4 fails to Relink images
Author: Olav_Kvern
Date: Tue, 17 Feb 2009 22:23
Date: Tue, 17 Feb 2009 22:23
9 lines
787 bytes
787 bytes
Hi Sheldon, re: "Do you have any experience with InDesign Server CS4?" Sure. Can you provide a little bit more code? Are you iterating? Does it work for you in the desktop version of CS4? Thanks, Ole
Re: CS4 fails to Relink images
Author: Sheldon_Zacharias
Date: Tue, 17 Feb 2009 22:52
Date: Tue, 17 Feb 2009 22:52
19 lines
1629 bytes
1629 bytes
I'm using VB.Net, and as I indicated earlier this code works 100% using InDesign Server CS3. Here is a simplified version of the code I am using to relink a image. For X As Integer = 1 To InDesignServerPublication.Document.Links.Count Dim Link As InDesignServer.Link = InDesignServerPublication.Document.Links.Item(X) 'I pulled the code that determines the new file name for simplicity Dim strFile as String = "SomeImage" If Not Link.Status = InDesignServer.idLinkStatus.idNormal Then If strFile <> Link.FilePath.ToString Then Link.Relink(strFile) Link.Update() End If End If Next When the code gets to the Link.Relink(strFile) line it errors out with the following error: �HRESULT E_FAIL has been returned from a com component.� I have not had a chance to try this code with CS4 Desktop, I had to unistall it to get the Server Version installed. I was told by Adobe support that the two can not co-exist on the same machine.
Re: CS4 fails to Relink images
Author: Olav_Kvern
Date: Tue, 17 Feb 2009 23:16
Date: Tue, 17 Feb 2009 23:16
29 lines
1842 bytes
1842 bytes
Hi Sheldon,
re: " I was told by Adobe support that the two can not co-exist on the same machine."
That's incorrect. I wonder where in the world they got that idea.
There's always a danger, when iterating through links, that you'll end up pointing at an object reference that is no longer valid. When you relink a link, the original link object is destroyed and a new link object is created. The links collection, therefore, shuffles. Does your problem go away if you iterate in reverse order?
Also, it looks to me as if the Relink method now wants a File object (as shown in the JavaScript version above), rather than just a string. Here's an example in VBSCript form.
Set myInDesign = CreateObject("InDesign.Application.CS4")
Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set myDocument = myInDesign.Documents.Item(1)
For X = myDocument.Links.Count To 1 Step -1
Set myLink = myDocument.Links.Item(X)
strFile = "C:\test.jpg"
Rem If Not myLink.Status = idLinkStatus.idNormal Then
If strFile <> myLink.FilePath Then
myLink.Relink myFileSystemObject.GetFile(strFile)
myLink.Update
End If
End If
Next
Thanks,
Ole
Re: CS4 fails to Relink images
Author: Sheldon_Zacharias
Date: Wed, 18 Feb 2009 15:34
Date: Wed, 18 Feb 2009 15:34
8 lines
903 bytes
903 bytes
Ole, Your a genius! I never thought of checking the input parameter, I just assumed that it would not have changed. I tried using a file object rather than just the file name and it works. I guess my question to Adobe would be why change the parameter type? Either way thank-you very much for the help, Sheldon
Re: CS4 fails to Relink images
Author: Olav_Kvern
Date: Thu, 19 Feb 2009 02:22
Date: Thu, 19 Feb 2009 02:22
13 lines
1158 bytes
1158 bytes
Hi Sheldon, Glad it's working! re: "I guess my question to Adobe would be why change the parameter type?" I have no idea, and certainly didn't notice it during development. In general, I develop/test using JavaScript and then port to VBScript and AppleScript, which means that I could easily have missed it (in JavaScript, it always takes a File object). In general, we're supposed to be able to refer to files as either file paths as strings or File objects. Every now and then, someone gets the idea that we need stronger typing, and messes it up.:-) Thanks, Ole
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads