getting value from result

I am relatively new to this and I am stuck

I want to get a value to use in another part of a script

I do this:
get properties of page 1 of document 1
It returns in the result window a statement like this eg
{page options: {registration marks:false, page border: {border color:red, fill color:blue}}}
Now I want to get the value RED from page border: to use else where in script
I have tried everything I can think of:

please can anyone help

It depends a lot on how things are implemented in the application you’re scripting. Sometimes it may be possible to use a through-reference to the value you want:

set borderColor to border color of page border of page options of page 1 of document 1

More likely, you’ll have to resolve an intermediate item and start a new reference from there:

set pageOptions to page options of page 1 of document 1
set borderColor to border color of page border of pageOptions

You’d have to experiment to see where the break(s) were necessary. What will almost certainly work is to resolve everything along the way:

set page1 to page 1 of document 1
set pageOptions to page options of page1
set pageBorder to page border of pageOptions
set borderColor to border color of pageBorder

To set another border color to the colour you get, you’re looking at something like this - again depending on where the reference breaks prove to be necessary:

set pageOptions2 to page options of page 1 of document 2
set border color of page border of pageOptions2 to borderColor

Thanks NG

I was so close but without your help it could have taken a while to get it.
As close does not count.

Your help in this forum, I am sure is appreciated by everyone.

Daniel Telfer