How to go to the next page in Skim?

I’ve found this script that will show page # 100 of a PDF opened in Skim:


set pageIndex to 100 as integer

tell application "Skim"
	tell front document
		--set nextPage to (current page + 1) as number
		set current page to (page pageIndex)
	end tell
end tell

I’m trying to create two scripts: one to navigate to the next page, and one to navigate to the previous page.

How can I do this?

You could do that like this:

(*
tell application "Skim"
	tell document 1
		
		tell current page
			set currentPage to (its index) as integer -- get the current page index
		end tell
		
		go to page (currentPage + 1) -- go to next page from current page
	end tell
end tell
*)

(**
* SKIM: nextPage() handler
*)
on nextPage()
	tell application "Skim" to tell document 1
		tell current page
			set currentPage to (its index) as integer -- get the current page index
		end tell
		go to page (currentPage + 1) -- go to next page from current page
	end tell
end nextPage

(**
* SKIM: previousPage() handler
*)
on previousPage()
	tell application "Skim" to tell document 1
		tell current page
			set currentPage to (its index) as integer -- get the current page index
		end tell
		go to page (currentPage - 1) -- go to previous page from current page
	end tell
end previousPage

nextPage()

delay 3

previousPage()

Many thanks. This is great.