Skip to main content
Inspiring
July 5, 2010
Question

[AS, CS4] Update Link Isn't Working Any More

  • July 5, 2010
  • 1 reply
  • 910 views

Hello,

I have updated an (rather big) AppleScript from CS3 to CS4 encountering only minor problems. But there is one thing, for that I need some help.

There is a part within, which changes dimensions of an image and/or updates the link, if the user wants to (userUpdateLink and userChangeDimensions are both bools, fed by GUI-result). theDocName is a string, theImgLinkID is a string containing a number (both fed from a sqlight database).

Here's the code:

on updateInDesign(theGraphic, theDocName, theImgLinkID, userUpdateLink, userChangeDimensions)

     tell application "Adobe InDesign CS4"

          tell document theDocName

               if userUpdateLink then

                    set theLink to link id (theImgLinkID as number)

                    set theNewLink to update theLink

                    set theImgLinkID to id of theNewLink

               end if

               if userChangeDimensions then

                    tell parent of link id (theImgLinkID as number)

                         if (horizontal scale < 0) then

                              set horizontal scale to -100.0

                         else

                              set horizontal scale to 100.0

                         end if

                         if (vertical scale < 0) then

                              set vertical scale to -100.0

                         else

                              set vertical scale to 100.0

                         end if

                    end tell

               end if

          end tell

     end tell

     return theImgLinkID

end updateInDesign

I permanently get an error on the line:

                    set theNewLink to update theLink

It throws out:

»

update link id 49430 of image id 49456 of rectangle id 49431 of page id 15272 of spread id 15261 of document "xyz.indd"

"„Adobe InDesign CS4“ hat einen Fehler erhalten: Ungültiges Objekt für diese Anforderung."

«
(Which in english is something like: »Adobe InDesign CS4 got an error: Invalid object for this request.«)
Any suggestions?
Thanks in advance,
Tobias.

This topic has been closed for replies.

1 reply

Inspiring
July 5, 2010

What happens if you add:

log (exists link id (theImgLinkID as number))

Inspiring
July 6, 2010

Hi Shane,

I added ...

on updateInDesign(theGraphic, theDocName, theImgLinkID, userUpdateLink, userChangeDimensions)

     tell application "Adobe InDesign CS4"

          tell document theDocName

               log (exists link id (theImgLinkID as number))

               if userUpdateLink then

                    set theLink to link id (theImgLinkID as number)

                    set theNewLink to update theLink

                    set theImgLinkID to id of theNewLink

               end if

and got the following in the event protocoll:

tell application "Adobe InDesign CS4"

     exists link id 58160 of document "xyz.indd"

          true

     (*true*)

     get link id 58160 of document "xyz.indd"

          link id 58160 of image id 58785 of rectangle id 47318 of page id 42451 of spread id 39642 of document "xyz.indd"

     update link id 58160 of image id 58785 of rectangle id 47318 of page id 42451 of spread id 39642 of document "xyz.indd"

          "„Adobe InDesign CS4“ hat einen Fehler erhalten: Ungültiges Objekt für diese Anforderung."

The link exists (I tested this before with a »select link id 58160 of document "xyz.indd"« script), but the error remains the same.

Tobias

Inspiring
July 6, 2010

What's the reason for the update -- the file has moved, or been changed?