Hi Kurt:
No, sorry, I can't tell you. I am a VBA coder, not AppleScript. One of the
other guys will be along in a minute.
I could show you how to do it in VBA, but not in AppleScript. There should
be a "Variables" collection in the AppleScript dictionary. A document
variable is simply a persistent property you can write into a document file.
It is not exposed from the user interface, only from code.
A Custom Document Property would be just as good, but coders tend to steer
clear of them because Custom Document Properties are visible to the user,
who can change or delete them and upset your code
Here are the examples from VBA Help in Word 2004:
The following example saves a document variable in the same location as the
macro that is running (document or template) using the ThisDocument
property.
ThisDocument.Variables.Add Name:="Age", Value:=12
The following example uses the Value property with a Variable object to
return the value of a document variable.
num = ThisDocument.Variables("Age").Value
For your purposes, you need "ActiveDocument" in place of "ThisDocument",
because you want to write the variable into the document being saved, not
into the common template.
You need to test for the presence of the variable before you attempt to
write to it, or you'll blow up. In VBA you have to iterate the Variables
collection looking for the name, using a For...Each...Next loop. In
AppleScript, I believe you can do it with a Try...Catch clause.
Hope this helps
Hi John
Thanks for your answer.
I do not know how to edit the mentioned script to a Document Variable on save.
Maybe You can give me some hints?
Cheers>
--
The email below is my business email -- Please do not email me about forum
matters unless I ask you to; or unless you intend to pay!
John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:
[email protected]