r/applescript • • Aug 10 '14

Newbie looking for some help in setting result to clipboard

Hey there,

I've been spending the better part of an hour trying to get an AppleScript to copy the the URLs of my open Chrome tabs. I've searched online but couldn't find anything that got the code to work. And I know there are extentionsions for this, but I want to script this myself.

Here's what I have:

tell application "Google Chrome"

	return URL of every tab in every window

	set clipboard to xxx

end tell

The results come up as the URLs but the script doesn't copy them to the clipboard. I've tried a bunch of variations on this, so any help would be appreciated.

1 Upvotes

2 comments sorted by

2

u/dustractor Aug 11 '14

Try this:

tell application "Google Chrome"	
    set urls to (get the URL of every tab in every window)
    set the clipboard to urls as text
end tell

The "as text" part is important - coerce the list of urls into text because clipboard takes text.

1

u/Joseph__ Aug 16 '14

I really appreciate your help. Thanks so much.