31 Jul

Custom screenshots app on macOS

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:

theDate=$(date "+%Y-%m-%d_%H-%M-%S"); theSaveFolder="XXX"; screencapture -i -o "$theSaveFolder/$theDate.png"

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:


24 Jul

Easy method of ad blocking on Mac OS X

no ads

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!

    06 Jun

    Build your own PDF exporting droplet for Pages

    In this tutorial, I’m going to show you how to use our Pages Automator Actions to create a PDF exporting droplet for Apple’s Pages word processing app. If you want to follow along, you’ll need a copy of Pages, Automator (in the apps folder of all fairly recent Macs) and a copy of Pages Automator Actions.

    If you’ve not used Pages Automator Actions before, you’ll need to open it from your Applications folder so it can add its actions to Automator. Once you’ve done that, you can close it and you’ll never need to open it again.

    Create a new app

    Open Automator (you’ll find it in your Applications folder), create a new document and select “Application” in the menu that appears.

    Add the actions

    Select “Pages” from the left hand section of the window and drag the actions in as shown in the screen shot below. Note that “All documents” is selected in all of them – don’t forget that!

    The first action will make our app open any of the documents dropped on it in Pages. The second will export all open documents as PDF files. The PDFs will be in the same location as the Pages files used to create them – with a .pdf file extension, of course!

    Save your app

    Save the app somewhere you’ll be able to find it, e.g. your desktop. Make sure the File Format is set to “Application”. Once you’ve saved your app, you will be able to drop one or more PDFs on it and they’ll be automatically turned into PDFs!

    Note: There was a bug in some earlier versions of Pages which might have given a permissions related error when doing this. If you have errors, make sure you’re running the latest version of Pages.

    And there’s more…

    Automator actions for Pages has actions for exporting PDFs, Word, RTF and more handy actions to help you create cool apps, workflows and services.

    If you haven’t done so already, get your copy of Automator actions for Pages today and start automating Pages the easy way, for only $12.50*

    Click here for more info!

    05 Jun

    Using Automator to convert Pages to PDF

    Recently we were asked how to use Automator to convert Apple Pages documents into PDFs. In the spirit of sharing the knowledge, here’s how we did it.

    It’d be great to make an app which we could drop our Pages files on and have them made into PDFs. The obvious way to make such an app is with Automator. Unfortunately, Pages doesn’t ship with Automator actions (although there are some funky third party options)

    Luckily, Pages is AppleScriptable so we can make our own action. Let’s look at how to do that.

    First, launch Automator (you’ll find it in your Mac’s Applications folder). Select “Application”.

    Screen Shot 2016-05-12 at 13.19.38

    Next, drag a “Run AppleScript” workflow into your workflow so you have something that looks like this:

    Screen Shot 2016-05-12 at 13.20.06

    Replace all the purple text in the action with the following AppleScript:

    on run {input, parameters}

    repeat with theFile in input
    tell application "Finder"
    set theFilesFolder to (folder of theFile) as text
    end tell

    tell application "Pages"
    set theDoc to open theFile

    set theDocName to name of theDoc
    set theName to (characters 1 thru -7 of theDocName) as text
    export theDoc as PDF to file ((theFilesFolder & theName & ".pdf") as text)

    close theDoc

    end tell
    end repeat
    return input
    end run

    Save the workflow and you should now have an app that you can drop Pages documents on.

    Note that it’s up to you to make sure that the documents you drop actually are Pages documents – the script doesn’t check and may error if you drop the wrong type of documents.

    Update for macOS Sierra

    There appears to be a permissions related bug for Pages in macOS Sierra… or perhaps it’s an “undocumented feature” 😉 Either way, the above code will give you an error in Pages for Sierra. Try the following alternative:

    on run {input, parameters}

    repeat with theFile in input
    tell application "Finder"
    set theFilesFolder to (folder of theFile) as text
    end tell

    tell application "Pages"
    set theDoc to open theFile

    set theDocName to name of theDoc
    set theName to (characters 1 thru -7 of theDocName) as text
    set thePDFPath to ((theFile as text) & theName & ".pdf") as text
    export theDoc to thePDFPath as PDF
    close theDoc

    end tell

    tell application "Finder"
    move file thePDFPath to folder theFilesFolder with replacing
    end tell

    end repeat

    end run Read More

    05 Jun

    New! Automator actions for Pages

    We’re pleased to announce a new tool to help you automate Apple’s Pages app using Automator workflows. Pages Automator Actions allows you to create workflows, apps, droplets and services to make those repetitive, time consuming tasks go like a breeze.

    Whether it’s batch exporting documents to ePubs or PDFs, or finding and replacing text in the body text of a collection of documents, the handy actions can save you time and effort.

    Of course, since Pages Automator Actions works with Automator, no knowledge of AppleScript or any other type of coding is necessary. If you can drag and drop then that’s all you need to know.

    Included actions are:

    • Open document(s)
    • Close document(s)
    • Export as ePub
    • Export as PDF (with optional password protection)
    • Export as formatted text (rtf)
    • Export as unformatted text (txt)
    • Export as MS Word (doc)
    • Find and replace text (body text of word processing documents only)
    • Make new document
    • Save document(s)

    Why not get your copy today and start automating Pages the easy way, for only $12.50*

    * or near local currency equivalent

    25 May

    Illustrator Automator Actions: Demo Available

    Illustrator Automator Actions

    Good news! We’ve made a trial version of Ai Actions available for download so you can give it a test drive before buying. Ai Actions gives you a set of handy Illustrator Automator Actions which you can use to create your own workflows and even apps to automate your work. And the best thing is that you don’t need to write a line of code! If you can drag and drop, you can create a workflow.

    NB. The demo version contains 4 sample actions. The full version contains 18 actions.

    Click here to download demo

    Less donkey work, more creativity!

    Lets imagine you have a hundred Illustrator artworks and you need to open each, delete any empty text frames, convert all the text to outlines and save as a JPEG and a PDF. Normally you’d have to do that by hand. Using Ai Actions and Automator you can create a workflow to do this automatically saving you heaps of time. And more importantly, letting you concentrate on the creative stuff instead of the boring donkey-work.

    A simple Automator workflow using Ai Actions to automate Adobe Illustrator

    A simple Automator workflow using Ai Actions to automate Adobe Illustrator

    Why use Automator?

    The advantage of Automator is that you can use functionality from many other apps in your workflow. So, for example, if you wanted to email the PDFs created by your workflow then you can harness the power of Mail.app to do that for you.

    The trial version has only four Automator actions whereas the full version contains 18. There are some tips for getting to grips with Automator here:

    Getting to grips with Automator
    Creating a simple workflow with Ai Actions

    Where can I get the full version?

    The full version of Ai Actions is available from the Mac App Store. Get automating today!

    Illustrator Actions for Automator, Automator Actions, Automator Illustrator Actions

    23 May

    Learning Automator

    Automator is a really easy way of building workflows, apps, services and hot folders and requires little or no programming knowledge. Once you’ve mastered it, you can automate all sorts of things on your Mac to save you time and remove the drudge work.

    Automator is built into every reasonably recent Mac running Mac OS X. However, few people know its there or use it… any they’re missing out! If you’d like to know more then there are some really good tutorials here:

    http://www.macosxautomation.com/automator/learn.html

    One of the big frustrations for those of us in the design industry is that there are no Automator actions provided with Adobe Illustrator. However, that’s where our app Ai Actions comes in. It provides many actions for Illustrator allowing you to make Automator workflows to automate common artwork tasks.

    Check out Ai Actions at the Apple App Store:

    Illustrator Actions for Automator, Automator Actions, Automator Illustrator Actions

    04 Apr

    Automating barcodes on macOS using a service

    Many years ago now, I was the office barcode expert – in as much as I was the only person with a copy of any barcode creation software. Colleagues would email me frequently with lists of barcodes they wanted me to create for them. Sometimes the numbers would be in a Word file, sometimes an email, sometimes a text file – you name it.

    If only there was a way I could just highlight the text and make barcodes. Well, in those days, there wasn’t but luckily now we have Barcode Basics. In this tutorial I’m going to show you how use Barcode Basics to create a Service in Automator to create barcodes from selected text.

    NB. You can click any of the screen shots to enlarge.

    1. Launch Automator
    Make sure you’ve launched Barcode Basics at least once – that’s what installs the action we’re about to use. Next, launch Automator. You’ll find it in your Applications folder.

    2. Create a new service
    Click the “Service” option to make a new service.

    Services appear under the File menu of many apps in macOS, including Finder and allow you to add functionality from other applications.

    In our example, we’ll be adding functionality from Barcode Basics to any app capable of understanding text. So, make sure you set the settings up as follows.

    2. Configure your barcode settings
    Drag the “Make Barcode” action from the Actions library (the list on the left hand side of your Automator window) into your workflow and configure as necessary.

    3. Make a new email
    Next, drag a “New Mail Message” action (from “Mail” in your actions library) into your workflow. You can configure as much or as little in the “New Mail Message” action as you like. I’ve configured the subject and body.

    4. Save the service
    Next, press cmd-S to save your service and give it an appropriate name

    5. Give it a test!
    If you open any kind of text file (e.g. a Word file, a TextEdit file) you should now be able to see your action under its File>Services menu. Simply select the barcode numbers (which must be one per line), then run your action by selecting it in the Services menu. You should get an email with the generated barcodes as attachments.

    I hope this demonstrated just how easy it is to create a service to generate barcodes and add them to an email. Automation with Barcode Basics and Apple’s Automator software really couldn’t be easier. And, of course, you can use Barcode Basics as a stand alone barcode generator too if you prefer.

    I sure wish I had this back in my days as office barcode expert! If you haven’t given Barcode Basics a try yet, check it out at the Mac App Store.


    Link to Mac App Store to purchase Barcode Basics - Mac barcode software

    03 Apr

    Creating a simple Automator workflow to make barcodes

    In this tutorial, we’re going to create a very simple Automator workflow to create barcodes from user input. In future tutorials we’ll look at more advanced methods, but for now, lets keep things simple. You’re going to need a relatively recent version of macOS and an installed copy of Barcode Basics (that you’ve launched at least once!) if you want to follow along with this.

    NB. You can click on any of these screen shots to enlarge them.

    1. Launch Automator
    Automator comes free with macOS and can be found in your Mac’s Applications folder. Launch Automator and create a new workflow.

    2. Get some user input
    Drag an “Ask for Text” action into your workflow. If you have trouble finding it, type “ask” into the search field to narrow down the options. Note that’s what I’ve done in the pic below.

    3. Drag in a “Make Barcode” action
    Drag in a “Make Barcode” user action. Again, if you have trouble finding it, type “Make Barcode” into the search field. If you can’t find it, it may be because you haven’t launched Barcode Basics – the actions get installed when it’s first run (if this is the case, quit Automator, launch Barcode Basics then start again). Your workflow should now look something like this.

    You can configure the barcode settings as required. Note that the settings (e.g. BWR) apply to all barcodes made with this workflow.

    4. Move the resulting files
    Initially your files will be created in your Documents folder, in a sub folder called “Barcode Basics”. You should move them out of there to their required location to avoid that folder slowly growing in size. The “Move Finder Items” action is a good choice for this.

    5. Run the workflow!
    Press the “Run” button in your Automator workflow to generate barcodes! Enter a new one on each line to generate multiple barcodes.

    This is an extremely basic example of creating an Automator workflow using Barcode Basic’s Automator action. In coming tutorials, we’ll look at creating a an Automator app, service and some more complicated workflows.

    Naturally, you can still use Barcode Basics as a stand alone app. However, I hope this demonstrates how easy it is to automate barcode production. If I’ve sparked your interest then head over to the Mac App Store to pick up your copy!


    Link to Mac App Store to purchase Barcode Basics - Mac barcode software