InDesign measurement script

Hi All

I am using InDesign CS2, and developing a AS for it during the scripting I am getting a problem for the below line. Can anyone tell me how can I rectify it.


tell application "Adobe InDesign CS2"
	set myDoc to the front document
	tell myDoc
		set horizontal measurement units to points
		set vertical measurement units to points
	end tell
end tell

Thanks

This is the correct code:

tell application "Adobe InDesign CS2"
set myDoc to the front document
   tell view preferences of myDoc
       set horizontal measurement units to points
       set vertical measurement units to points
   end tell
end tell

So you must add ‘view preferences of’ in the tell statement

Great!!!

It works, one more thing I want to know how can I store “top margin, page left margin, bottom margin & page right margin” in variables.

Thanks

I want to store those values in


tell application "Adobe InDesign CS2"
	activate
	set myDoc to the front document
	tell view preferences of myDoc
		set horizontal measurement units to points
		set vertical measurement units to points
	end tell
	set pageInfo to (properties of page 1 of spread 1 of document 1) as list
	--	set topMargin to item 14 of pageInfo as point as real
	--	set pageLeftMargin to item 9 of pageInfo as point as real
	--	set bottomMargin to item 5 of pageInfo as point as real
	--	set rightMargin to item 13 of pageInfo as point as real
	tell page 1 of myDoc
		set pageBounds to bounds as list --box bounds reads as {A,B,C,D} 
		--				set maxWidth to (((item 4 of pageBounds) as point units) as real) - (((item 2 of pageBounds) as point units) as real) - pageLeftMargin - rightMargin
		--				set maxHeight to (((item 3 of pageBounds) as point units) as real) - (((item 1 of pageBounds) as point units) as real) - bottomMargin - topMargin
	end tell

In this script I am having problem where I have commented those lines. Please give me the feedback what I am doing wrong.

Thanks