Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a new tab in Background in Chrome using AppleScript

How to open a new tab in Background using AppleScript in chrome. Open a tab seems so easy, but I just can't find what can be called to open the tab in background, which means the active tab remains the same.

like image 631
kakacii Avatar asked Dec 16 '22 14:12

kakacii


1 Answers

You can save the active tab index in a variable and set it back after you created your tab:

tell application "Google Chrome"
    set activeIndex to get active tab index of window 1
    tell window 1
        set newTab to make new tab with properties {URL:"http://www.google.com/"}
    end tell
    set active tab index of window 1 to activeIndex
end tell
like image 106
dertkw Avatar answered Apr 25 '23 14:04

dertkw