0

There is an option in Keyboard Maestro to rename any tab on safari with the name you want

I'm trying to do the same using AppleScript but is this even possible?

I have nothing so far, I'm guessing JavaScript would be the way to do it

tell application "Safari"
    tell front window to make new tab at after first tab with properties {URL:myLink}
    -- need to rename tab here
    tell front window to make new tab at after second tab with properties {URL:myLink}
    -- need to rename tab here
    tell front window to make new tab at after third tab with properties {URL:myLink}
    -- need to rename tab here
end tell
  • nothing, trying to found a way to rename so far. (my draft is only setting the variables / finding tabs ) – Kevin Dec 9 '18 at 10:44
  • Please add what you have. – nohillside Dec 9 '18 at 10:51
  • Ok just looking at document.title now which could be the solution – Kevin Dec 9 '18 at 10:57
  • You can look up the commands Safari understands within Script Editor. – nohillside Dec 9 '18 at 11:02
  • Interesting... but why? – Mateus Ribeiro Dec 9 '18 at 14:01
3

Found the solution using JavaScript:

tell application "Safari"
    do JavaScript "document.title = 'Hello!';" in tab 1 of window 1
end tell
  • only issue is that for tab1 but as my script is using "tab at after first tab" I'm not sure how to refer to theses tabs yet but I guess I can just use tab 2 for this e.g – Kevin Dec 9 '18 at 11:00
  • @user3439894 Fat finger syndrom :-) Thanks for fixing it. – nohillside Dec 9 '18 at 12:43
  • Nice answer @Kevin. Well done for investigating and finding this out on your own. You've taught me something new with this. And, yes, to reference different tabs, you can use tab 2, tab 3 etc. – CJK Dec 9 '18 at 14:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .