We use this tool when we are browsing the internet to locate possible partners and potential website design clients in Yorkshire. Before configuring Automator this meant going on to every website, searching for an email address or phone number and copying this into a document. As contact details differ as to where they are displayed on each website, this was an extremely lengthy and boring process.
As stated above, today’s solution will automatically scan a website for either an email address or phone number and paste this into a plain text document (appended to the bottom), whereby you can copy and paste all contact information into an excel CSV file to upload to your favourite CRM software (We use Hubspot).
We’d like to state here that it is really bad practice to use this tool to produce vast amounts of spam emails. Not only will your email address be listed as potential spam, but your clients will have no interest in dealing with you if you’re sending email after email. We only use this tool to send one initial personalised email and a single email follow up. If we receive no reply this is where we stop (we don’t class these emails as spam, as we are offering genuinely valuable website design services to people that need them!).
The initial step requires you to create a .txt file on your desktop. You can call it what ever you like, but remember the file path. You can copy this by right clicking the file then while holding the alt key press “Copy file path”.
Next we predictably need to open the Automator application on your Mac.
You’ll be presented with an initial menu where you can either choose Services or Application. We’d normally go for Services in this instance but it’s down to personal preference. If you opt for Services you’ll access this workflow by going on to a website, right clicking and navigating to “Services”. If you opt for Application, you can save this as a shortcut on your desktop and run it by double clicking.
Once you’ve decided, you’ll be shown a long list of all of the functions that you can order to create workflows. For simplicity we’ve included two screenshots of the process created below. You can find each function really easily by using the search bar in the top left corner.
To explain this in a little more detail: “Get current webpage from safari” is pretty self explanatory, it finds the open tab in Safari.. duh. “Get text from webpage” will process all of the webpage in plain text ready for the next function (which in the menu is actually called “Extra data from text”) will extract any email addresses from the text. If you’re collecting phone numbers you’ll need to change the dropdown box to… phone numbers, obviously. This is then copied to the clipboard, where the “Run Shell Script” pastes it into the chosen .txt file.
You’ll need to amend the script to relate to your .txt file that you created right at the beginning. You can copy and paste this code into this function and amend it with your chosen file’s path.
#!/bin/bash FILE_CONTENT=$(pbpaste) echo -e "$FILE_CONTENT" >> [Your file path goes here!]
The second screenshot outlines a bit of a backup process if the first part of the workflow cannot find an email address. This function searches a page for URL’s, filters out all that do not include an “@“ and then copies what ever is left to the same text file. Again, make sure you change the file path to the correct .txt file. If you’re collecting phone numbers you’ll want to change the “@“ symbol to “tel:” to ensure it finds the phone numbers that have been made into URL’s.
Remember to save your workflow, giving it a name you’ll recognise and we’re done.
The entire process
Once you’re doing creating the automated workflow, open Safari (this solution will only work with the Safari browser and no others)
We start by entering our search term into Google (e.g. IT support Batley) and then opening these search results in map view. Doing this gives you a list of possible partners/clients whereby you can open up their websites in new tabs using CMD + Click quickly.
Once you’ve opened all of the tabs on the map view page of Google, you’ll need to go on to each page and right click some available text, selecting Services > Email Scrape (or what ever you’ve named your Service. If you opted to create an app instead, you’ll need to locate your application and open it for every Safari tab open.
You should see that each time you do this, the email address will be copied on to a new line of your text document. Sometimes you’ll find that it has copied multiples of the same email, which is no problem as we’ll sort this out later.
After you’ve exhausted your list of clients, open the text document and press CMD + F to open the find option. We do this to remove all of those pesky “mailto:” tags that are part of an email URL. Type “mailto:” into the find box and tick the “Replace” box. Leave this box blank and Confirm. This will have removed all of the unnecessary information apart from the duplicate emails. Fortunately we don’t really need to worry about these as most CRM solutions will automatically remove duplicate email addresses upon importing your csv file. If yours doesn’t it is easy to find a way for Excel or another program to remove any duplicate emails, just give it a cheeky Google.
Now it’s a case of simply copying and pasting the contents of your text file into Excel, saving the workbook as a csv file and importing to your chosen CRM.
Hope this speeds up your manual outreach process and as always, if you have any questions feel free to get in touch! Remember this is only one small process that you can automate with Automator – with a bit of research and fiddling you can accomplish much more complex workflows!
Liam is a website designer and digital marketer based in Leeds, West Yorkshire. He spent a decade working within the charity sector before moving into the marketing space a number of years ago. Liam always strives to do something slightly different with every project and always designs to deliver results, not just pretty websites.