To return the page object into a variable named page for the last page in your publication, use the following syntax:
var lastPage = GetLastPage()
The returned page object can be used with OpusScript functions related to the page. For example, to print the last page in the publication, use the following syntax:
var lastPage = GetLastPage()
PrintPage(lastPage,true)