0

What is the simplest way to append a list of urls with a selected URL when browsing either chrome or safari. I tried to do this with automator and it was easy to achieve by creating a service with a Write Text to File action (from an add on package). But it does not add a new line after each entry. It doesn't even write a space after an entry. So you end up with a file like

http://example./Ahttp://example.com/Bhttp://example.com/Chttp://example.com/Dhttp://example.com/Ehttp://example.com/F

My next attempt to use a Split Text action somehow resulted in 100 new files being created, each containing a single URL. (>_<)

What I'm trying to achieve is:

  • Select a URL in the browser's (chrome or safari) address bar
  • Right click the highlighted URL to get to the services menu
  • Click on the created service (we'll call it Add to List)
  • Add the selected URL to text file in the Home folder followed by a new line.

The desired output being:

http://example.com/A
http://example.com/B
http://example.com/C
http://example.com/D
http://example.com/E
http://example.com/F

Any help would be very much appreciated.

Thank you.

  • Can you add a screenshot of the Automator workflow you have so far? – nohillside Jul 25 '16 at 14:16
  • I should have kept asking the duck before submitting the question. I think I solved it with applescript but I'd be happy to post screen shots of the previous workflow and / or the current applescript solution. – I0_ol Jul 25 '16 at 15:52
  • Great! Just answer your own question with the solution you've found then, and accept it :-) – nohillside Jul 25 '16 at 16:07
0

This seems like an effective solution. A single Automator Run AppleScript action with the following script:

set text item delimiters to linefeed
set my_list to "/Users/username/Documents/URL_list.txt"
tell application "Google_Chrome" to set new_items to (get the URL of the active tab in window 1) as string
do shell script "echo  " & quoted form of new_items & " >>  " & quoted form of my_list

display dialog new_items with title "Added to the list"
  • Save as a service
  • Service receives selected URLs
  • Input is only URLs (probably doesn't matter)
  • Tested and working in both Safari and Google Chrome
    • If using Safari change the get the URL of the active tab in window 1 to get the URL of the current tab in window 1. Just to clarify: use active tab for Chrome and use current tab for Safari.
    • If you have several windows and tabs open and want to grab every URL to populate a list: tell application "Google_Chrome" to set new_items to (get the URL of the tabs in every window) as string

enter image description here

You must log in to answer this question.

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