2

I have a simple applescript that I launch at the beginning of class every day to set up my development environment and open my directory in Chrome. It works as it, but I am OCD and would like it to open the URL in the existing new tab that is created when you first launch Chrome.

tell application "Google Chrome"
    activate
    open location "http://mydir.dev"
end tell

I've tried searching through the Chrome dictionary but I can't seem to find anything to help.

1 Answer 1

4

Try:

tell application "Google Chrome"
    if not (exists window 1) then reopen
    set URL of active tab of window 1 to "http://mydir.dev"
end tell
Sign up to request clarification or add additional context in comments.

2 Comments

Worked like a charm. Thank you so much!
Does this need to then refresh the page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.