I have a script that generates some HTML files for a photo album. The primary navigation is a set of links underneath the picture, which go to the adjacent (prev/next) files.
At the moment, I’m using this snippet to wrap around the ends of the list (so the first and last files will link to each other). It functions correctly, but I’ve been wondering if there’s a better way to do this.
if (counter - 1) is not 0 then
get counter - 1
else
get count fileList
end if
set prev to getWebName(item result of fileList)
if (counter + 1) < ((count fileList) + 1) then
get counter + 1
else
get 1
end if
set next to getWebName(item result of fileList)
Model: Mac mini
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)