Add bibliography in Word document using apple script

src[iter] = “<b:Source><b:Tag>” + “Value” + iter.ToString() + “</b:Tag><b:SourceType>Book</b:SourceType>”
+ “<b:Guid>” + guid + “</b:Guid><b:LCID>0</b:LCID><b:Author>”
+ “<b:Author><b:NameList><b:Person><b:Last>” + lastname + “</b:Last>”
+ “<b:First>” + firstname + “</b:First></b:Person></b:NameList></b:Author>”
+ "</b:Author><b:Title> " + title
+ “</b:Title><b:Year>” + year + “</b:Year><b:City>” + city + “</b:City>”
+ “<b:Publisher>” + publisher + “</b:Publisher></b:Source>”;

doc.Bibliography.Sources.Add(src[iter])

In windows, there is an option to add bibliography using the property of word document. Is there anything similar in Mac script supported?

Not really sure what you’re trying to do here. Your code looks like it’s trying to add a source.

That said, assuming I understand this at all, you can get the document properties for a word document (e.g. File > Properties…), which I believe correspond to your fields, like so…

tell application "Microsoft Word"	
	
	document properties of document 1
	--> {document property "Title" of document 1 of application "Microsoft Word", document property "Subject" of document 1 of application "Microsoft Word", document property "Author" of document 1 of application "Microsoft Word", document property "Keywords" of document 1 of application "Microsoft Word", …}
	-- For me, this returns a list of 30 properties		
	
	set dpt to document property "Title" of document 1
	properties of dpt
	--> {class:document property, name:"Title", value:"dpTitle", document property type:string, link to content:false, link source:missing value}
	
	value of document property "Title" of document 1
	--> "dpTitle"
	
end tell

The value is what I entered manually into the ‘Title’ field.

If there is vba functionality then you should be able to utilise that as well.

In windows we have a property of document like Bibliography, as in following text doc.Bibliography.Sources.Add(src[iter]), is there anything similar supported in word in MAC.

I don’t think that applescript supports that. But if you have a vba script that solves the problem then you should be able to run that.

Thanks @Mockman kman

Hi @Mockman I would like to know if there is an option to scroll into view a target paragraph of the word document using apple script.
I want to achieve windows version of

document.ScrollIntoView(document.Paragraphs[2].Range)

There doesn’t appear to be any matching functionality for that. You could mimic it by doing something like selecting the paragraph and then UI scripting an arrow key press.