What is an easy way to tell DEVONagent to switch to the next (or previous) tab in a browser via AppleScript?
tell application "DEVONagent" to set current tab of browser 1 to next tab of browser 1
. . . but of course that doesn’t work.
I admit this is a lazy question: I could probably figure it out but I find AppleScript very befuddling most of the time.
tell application "DEVONagent"
set theTabs to tabs of browser 1
set theCnt to count of theTabs
if theCnt > 1 then
set theTab to current tab of browser 1
repeat with theIdx from 1 to theCnt
if (item theIdx of theTabs) is theTab then exit repeat
set theIdx to theIdx + 1
if theIdx > theCnt then set theIdx to 1
set current tab of browser 1 to item theIdx of theTabs
Thank you Christian! I knew it would have something to do with a loop to match the index of the current tabs to all the tab indexes… but I was too lazy to figure it out myself.