Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

applescript - open new tab in chrome and go to url in clipboard

Hi there,


I'm just getting started with applescript.


I want to open a new tab in chrome, and browse to the url that is in clipboard.


I have tried this:


tell application "Google Chrome"

set the clipboard tomyVar

set myTab to make new tab at end of tabs of window 1

set URL of myTab to myVar

end tell

but alas no joy, can anyone help me out please?


Thanks in advance,


Nick

Posted on Jul 30, 2014 12:57 PM

Reply
Question marked as Best reply

Posted on Jul 30, 2014 1:02 PM

If the URL’s already in the clipboard:


tell application "Google Chrome"

set myTab to make new tab at end of tabs of window 1

set URL of myTab to the clipboard

end tell


If it’s put into myVar elsewhere in the script:


tell application "Google Chrome"

set myTab to make new tab at end of tabs of window 1

set URL of myTab to myVar

end tell


If it matters, your original code got myVar and the clipboard in the wrong places:


tell application "Google Chrome"

set myVar to the clipboard

set myTab to make new tab at end of tabs of window 1

set URL of myTab to myVar

end tell


(110254)

2 replies
Question marked as Best reply

Jul 30, 2014 1:02 PM in response to happysailingdude

If the URL’s already in the clipboard:


tell application "Google Chrome"

set myTab to make new tab at end of tabs of window 1

set URL of myTab to the clipboard

end tell


If it’s put into myVar elsewhere in the script:


tell application "Google Chrome"

set myTab to make new tab at end of tabs of window 1

set URL of myTab to myVar

end tell


If it matters, your original code got myVar and the clipboard in the wrong places:


tell application "Google Chrome"

set myVar to the clipboard

set myTab to make new tab at end of tabs of window 1

set URL of myTab to myVar

end tell


(110254)

applescript - open new tab in chrome and go to url in clipboard

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.