Recently, a macOS user asked for a recommendation for an app which would take a screen shot and save it in a folder, with a name based on the current time in a particular format – they didn’t like the macOS default naming.
Rather than recommend an app, we showed them how to make their own using Automator. Here’s how to do it:
First, open up Terminal (found in /Applications/Utilities) and type:
pwd
…then return. It should give you a path that looks something like:
/Users/YourUserName/
If you add “Desktop” to the end of that then you have the path to your desktop. So, it should be something like:
/Users/YourUserName/Desktop/
Don’t forget the slash on the end.
Right! That was the hard bit. Next, replace the XXX in my line below with your desktop path:
Next, fire up Automator (in your Applications folder). Make a document of type “Application”. Then all you need to drag a “run shell script” action from the side bar into the main panel and replace the default text with the line above.
You should now have something that looks like this (click for a larger view):
Save your work, and you now have a shiny new app which will take screen shots and name them with a timestamp whenever you click it. Of course, you can play around with the time stamp format if you like. There’s a guide to the UNIX date command (which is what we’re using) here https://ss64.com/bash/date.html
For more cool ideas with Automator, why not check out:
Adverts are a common annoyance for most internet users. If you want to get rid of them then there are plenty of third party ad blockers around. However, if you want to get super-geeky then there’s a clever trick you can do using your Mac’s hosts file, and that’s what we’re going to look at today.
Apart from earning you many Geek Points, a hosts based approach has the advantage of not being bound to any one app (e.g. Safari) – it comes into play whenever any app accesses the internet.
About hosts files
Firstly, what is a hosts file? Put simply, a hosts file is a text file containing a look-up list of hostnames to IP addresses. For example, a web server’s IP address might be something unwieldy like “http://123.345.789.012”.
However, by editing your computers hosts file you can tell your computer that whenever you enter the address “http://myserver”, what you actually mean is “http://123.345.789.012”, and the computer will do the switcheroo for you automatically whenever you try to access that server.
So how does that help?
Adverts are usually hosted on servers other than the page you’re looking at. If we had an extensive list of known ad servers then we could use our hosts file to redirect links to those ad servers to something else. For example, that “something else” might be the ip address 127.0.0.0, which is almost certainly your Mac’s home address. Since we’re not running an ad hosting server from our Mac (hopefully!), those requests will fail and the ads would not load.
All we’re missing is a long list of known ad servers, right? Luckily, there is a list of them at someonewhocares.org which is regularly updated, and they also include many ‘dodgy’ sites including those with offensive content, known malware sources etc. So we have all the pieces of the jigsaw. Lets see how we can edit our hosts file to use this list.
Firstly, select Finder>Go To Folder, type “/etc/” in the box then click the “Go” button. (NB. without the quotes, but with the slashes!)
You should see a file called “hosts” in the folder you just opened. This is your hosts file. Make a backup copy of it and keep it somewhere safe, just in case.
Next, go to http://someonewhocares.org/hosts/ and copy the text from “# This hosts file brought to you…” down to the bottom (omitting the date that’s on the last line).
Open the hosts file in a text editor. I strongly recommend TextWrangler because word processors e.g. Word can add unseen mess into your file which can break things. If your Mac asks if you want to unlock the file, say “Yes”.
Paste your copied text into your hosts file and save it, making sure you save it as “hosts”, not “hosts.txt” or any other variant. NB. You may need your Mac’s admin password to save the file.
You’re done!
If you experience any problems, or want to undo what we just did then just replace your edited hosts file with your backup copy. If you find a site that you want to visit is blocked, simply open the hosts file, find the line with the site in it and either delete that line or add a # before the line to disable it.
If, after some time, you find you start seeing ads again then you may need to update the contents of your hosts file. Just go through the same procedure, but using the current list from someonewhocares.org – they update quite regularly.
Happy (mostly) add free internet!
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OK