OK, so far, I've come up with this code by looking at some tutorials and stuff.
tell application "Google Chrome"
repeat with w in windows
set i to 1
repeat with t in tabs of w
if URL of t starts with permaLink then
set active tab index of w to i
set index of w to 1
set i to i + 1
open location permaLink
I've got three issues and hope you can help me with it.
It works, it searches for the permalink and save it as a variable. Publishes the post, look for a tab in current window with the permalink. If it exists, it sets to focus, if not, it creates the tab with the permalink.
First issue: The frontpage has usually "/frontpage" in the permalink eg. www.page.com/frontpage but when it loads, it redirects to www.page.com, so I tried to make an if statement saying that if the permalink contains "forside (frontpage)", remove that string from permalink variable or else it will create new tab even though it exists. No problem on other subpages, since they're not redirected.
Second issue: It only checks the active window so if the page is open in another Chrome window, it doesn't know and opens a new tab. Have tried some different things, without any luck.