I corrected the script and I think I found how to find if the link is missing by using the "myLink.status."
So my main concern is the date modified.
1 person found this helpful
(Warning: Rambling Mode)
I would not use your construction --
TimeDifference = abs(DateDiff("h", Now,
'If file is older than six hours then present error
because it check if the difference is larger than 6 hours, not if the image is 6 hours or more older than the current time. OTOH ... hm. Can your image be 6 hours (or more) newer than InDesign, the moment that you check? I'll need to think about this -- what if the image is newer? Then you'd surely want to update immediately? Methinks that if the new file is less than 6 hours younger than the ID file it won't get updated.
Oh, and all of the above information (with exception of the rambling thoughts) was found with straightforward index keyword searches.
Can I interest you in a Friendlier Help (both to work with, and on the eyes)? Check out http://www.jongware.com/idjshelp.html.
I found the file by using "app.documents.item(0).links.item(0).filePath" but I haven't been able figure how to find the modified info.
Seems like I may have found the answer of the modified date by using:
var file2 = new File(myLink.filePath)
alert("file2.name: " + file2.name)
alert("file2.name: " + file2.modified)
For the date I use:
var currentTime = new Date() to get the time for Now and then subtract the file's date. If the difference is more then six hours I wan't to update the file. We link to text files created daily for lists of Dow stocks so must verify we're using today's stock info. I should change the time to one hour instead of six but it's worked for the past eight years.
I'm now updating from InDesign CS to CS4 and from FreeHand?? to native Illustrator files for our graphs. I haven't figured out how to update the Illustrator graph's data using a script... well that's a different forum....