Can’t find any examples of this and the script dictionary is typically cryptic.
I wamt to use ID CS3’s built in text variable for file name and modification date. I am creating a page and adding a text box, but I can not figure out the code to insert those variable tags in the text box. I could probably do it with GUI scripting but looking at the scripting dictionary it looks like it should be directly scriptable.
Has anyone done this?
Model: G5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
I have looked at these tags, briefly, and found it better just to add a text frame at the bottom of the page and then just have applescript tell that frame to set contents to date and filename. It only takes a matter of mere seconds.
I need to create the document and then have that modification date update whenever the file is worked on, so the AppleScript solution won’t work for the mod date. I can use that for the file name though.
Anyone else have any luck adding that mod date variable text??
Yeah, that’s not really practical for our department.
The only “solution” I have is to create a blank document with that tagged box and open that template to start instead of starting with a new document. It would work but it’s annoying that a feature that is obviously scriptable is impossible to figure out as far as syntax.
Any other InDesign CS3 scripters out there who want to give this a shot?
Matt-Boy,
Take a look at page 107 of the “Adobe InDesign CS3 Scripting Guide: AppleScript.” It gives an example of an events listener script that populates a document slug with user name, creation date, etc. A script could be written to handle the info you need and attached to the standard Save command in the InDesign UI. That way, users are automatically running the script every time they save a document without any training issues, or simply forgetting to do it.
I never read that before. It doesn’t look like I can use it as it involves saving that reference script in addition to the main script, but it was pretty interesting.
Thanks for the info.
I am making this work by creating a template that has a text box in position with the mod date tag already in it. The script picks up the template to start instead of starting with a new document. It’ll work for now but I will keep trying to get the variable text tagging to work. I can see using this in other scripts as well if I can get it working.
Model: G5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
Nah, there’s no bug - it’s just persnickety.
I tested this, and it works:
tell document 1 of application "Adobe InDesign CS3" to make new text variable instance with properties ¬
{associated text variable:"Modification Date"} at the first text frame --or wherever
Yes! It works. Here is my final code for what it’s worth.
Thanks again. That’s awesome.
tell application "Adobe InDesign CS3"
activate
tell active document
set horizontal measurement units of view preferences to inches
set vertical measurement units of view preferences to inches
set TimeDateTag to make text frame with properties {fill color:"None", stroke color:"Black", stroke weight:1, geometric bounds:{8.4, 2.25, 9.0, 5.25}, contents:("")}
make new text variable instance with properties {associated text variable:"Modification Date"} at TimeDateTag
set properties of (every text of first paragraph) of TimeDateTag to {applied font:("Helvetica" & tab & "Oblique")}
set properties of text frame preferences of TimeDateTag to {inset spacing:0.0625}
end tell
end tell