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

16 Mar

macOS Sierra: Export PDFs from Pages using AppleScript

It appears that macOS Sierra introduces a bug in Pages which means that you get a sandbox/permissions related error when trying to export a PDF using AppleScript.

Hopefully, Apple will fix it soon. However, until then, here’s a workaround (see sample below in a handler suitable for Automator).

The idea is to take advantage of the fact that the Pages file is a package (in effect, a folder) and temporarily save the PDF there, having done that, we move it to its correct location using the Finder. Scruffy, but it works.

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

While we have your attention… why not check out our macOS apps?

Barcode Basics – macOS barcode generator (including Automator support)
Ai Actions – Automator action pack for Adobe Illustrator
Pages Automator Actions – Automator action pack for Pages

16 Feb

Making shell scripts more user friendly

We were recently asked whether it was possible to copy all the files that contain some variable text from Folder A into Folder B as part of an Automator workflow on Mac OS X.

Our solution demonstrated a nice way of using Automator as a way to gather information from a user and pass it to a shell script. It’s handy because many users feel intimidated by the Terminal, but are happy to run an Automator action. Here’s what we did…

First, let’s assume that we have two folders on our desktop. One is called “Source” and the other called “Dest”. If we wanted to copy all files whose name contains “Xxx” from Source to Dest then we could fire up the Terminal and do:

find ~/Desktop/Source -type f -name "*Xxx*" -exec cp "{}" ~/Desktop/Dest \;

The “*Xxx*” bit is where we tell the find command that we’re interested in files whose name “Xxx” with any text before or after it. You might want to read up on other options the find command has if you’re not familiar with it – it can be really useful.

However, we don’t want “Xxx”, we want the user to be able to decide what text to search for. So, let’s set up an Automator workflow and add an action to get some that text from the user…

Ask for text

Hopefully that’s straight forward. Next, we add a “Run Shell Script” action:

Run shell script

If you feel like copying and pasting, then the code is:

for f in "$@"
do
find ~/Desktop/Source -type f -name "*$f*" -exec cp "{}" ~/Desktop/Dest \;
done

That’s probably a little less straight forward! So let’s look at it a bit more closely. First, note that “pass input” is set to “as arguments”. This means that the output of the previous action is passed to our shell script as a special variable called $@.

The variable $@ could theoretically be a list, so we use a for loop to go through each item. Odds are that it’ll only ever be one item, but at least this way it’ll still work if one day it is a list. Our for loop goes through the $@ list an item at a time and executes the code between “do” and “done” once for each item in that list (the item is in a variable called $f). The code being executed should be familiar as the find command from earlier, but with $f as the search string instead of “Xxx”

So, if you run the workflow now you should be prompted to enter some text. Your source folder should be scanned for files whose name contains the text you entered, and any matching files copied to the destination folder.

You can run the workflow as it is, or save it as an Application if you prefer. Hopefully users will find this a more user friendly way of passing parameters to a shell script and exceuting it than using the Terminal.

05 Jul

Automated image processing on Mac OS X

cogs

If you’ve ever had to convert a few hundred images from tiff to png, create thumbnails of them you’ll know how time consuming and boring it can be. It can also be surprisingly error prone as your mind drifts off halfway through to think about what you’re up to at the weekend. Computers were supposed to relieve us of this kind of drudgery, right?

Luckily, every Mac has a powerful system lurking under the hood called ‘sips’ (Scriptable Image Processing System). You can use it to do all sorts of interesting things to raster images (eg. jpeg, tiffs, png etc) without ever having to fire up Photoshop. In this article I’m going to show you some simple uses of sips, and how to roll them up into a handy Automator workflow.

A quick into to sips
First, lets fire up the Terminal. It’s just an app that lets us work on the command line and you’ll find it in /Applications/Utilities. Type the following at the prompt:

sips -s format png

…next, drag any image file other than a png file into the Terminal. You should now have something in your Terminal that looks like this:

sips -s format png /path/to/your/file.jpg

That tells sips that we want to change the format of the image we dropped to a png. All we need to do now is to tell it where to put the resulting file. We can do this by adding –out followed by the location of the file we want to be created, so add that into your Terminal like this:

sips -s format png /path/to/your/file.jpg --out /path/to/your/file.png

Note that for the output file path, I just copied and pasted the input file path and changed the extension to “png”. Alternatively, I could have used something like “~/Desktop/file.png” to save the file to my desktop, or I could have used any other path that suits my purpose. Now we have a full sips command, so hit return to execute the command and a file should be created at the location you specified with the –out parameter.

The sips command we just created is a fairly typical one. Note that the word ‘sips’ is followed by some parameters (in our case, “-s format png”), then the path to the source file, then we used –out to tell sips where to put the resulting file. One thing to remember is that having your input file path the same as the output file path is generally a Bad Thing.

There are many other things you can do with sips, including resizing images, changing resolution, applying ICC profiles and so on. The manual (aka man page) is available by typing “man sips” in the Terminal or, if you prefer, click here to view it online.

Using SIPS from Automator
There’s nothing wrong with using SIPS as shown above, but the Terminal isn’t particularly user friendly. It’d be better if we could just select a load of files in the Finder and process them, right? That’s what we’ll look at now. First, launch Automator (you’ll find it in your Applications folder). Create a new workflow, being sure to select “Service” as shown below.

screen 1

Next, set the “Service receives selected” popup menu to “image files” and select “Finder.app”. This means that our workflow will be available when we select images in the Finder.

screen 2
Next, type “shell script” into the search field and drag the “Run Shell Script” action into the area under the popups we just set. Change the “Pass input” drop down to “as arguments”. You workflow should now look like this:

Next, replace the default text “cat” with the following:

for theFilePath in "$@"; do

done

In case you’re not familiar with shell scripting, this is a simple loop. When we execute the Run Shell Script action, it will be passed a list of files called “$@”. What we’ve written is a script to loop through this list. The loop starts at “do” and ends at “done”. Every time the loop repeats, the variable “theFilePath” will be the next file name in the list. Your workflow should now look like this:

screen 4
At the moment, our script doesn’t do anything because there is nothing between “do” and “done”. We need to add some sips magic! In between “do” and “done” add the following:

sips -s format png "$theFilePath" --out "${theFilePath%%.*}.png"

Note that I’m using the theFilePath variable as the input. The confusing stuff as the output just knocks the file extension off the theFilePath variable and adds “.png”. Your workflow should now look like this:

screen 5
Next, save your workflow and give it a name. I chose “Convert Images”.

Okay! Now for the fun bit. Find one or more images (not a PNGs!) in your Finder. Click the file whilst holding “ctrl” down and scroll down to Services, then select your workflow.

services

Your selected files will be converted magically into PNG files! NB. If nothing happens then check you selected “Pass input: as arguments” in the Run Shell Script action.

If I want to create multiple images, then it’s fine to add extra sips commands. So if I want to create a thumbnail image then I can change my shell script to:

for theFilePath in "$@"; do
sips -s format png "$theFilePath" --out "${theFilePath%%.*}.png"
sips -s format png -Z 100 "$theFilePath" --out "${theFilePath%%.*}_thumbnail.png"
done

…see the sips man page to see how the -Z option works!

Hope that gives some you ideas and saves you some time!

09 Jun

How to batch convert Adobe Illustrator files into EPS files

automator

Recently we were contacted by someone who had hundreds of Adobe Illustrator files to convert into EPS files. They wanted to use Automator so we recommended our Ai Actions – our Automator actions for Illustrator package. I’ll show you how we did it here.

1. Get a copy of Ai Actions
Adobe Illustrator doesn’t ship with any actions for Automator. Luckily, we make a set of handy actions for Illustrator that you can use in your workflows. Click here to see it on the Apple Store.

2. Launch Automator and set up a workflow
Launch Automator and create an Application document. If Ai Actions is installed correctly then you’ll have a set of Adobe Illustrator actions in your Library. Simply drag the actions into your workflow and configure them as shown below (Click the image to enlarge).

workflow

3. Save your app
Save your document somewhere handy and name it something sensible, such as “Save As EPS.app”. Next, try dragging some Illustrator documents onto it. It should work something like this: Click here to see the app in action

You can automate all sorts of tasks in Adobe Illustrator thanks to Apple’s Automator coupled with Ai Actions. Get your copy today from the Mac App Store!

Illustrator Actions for Automator, Automator Actions, Automator Illustrator Actions

12 Mar

Mac App Store back online

Hi,

A number of users pointed out that yesterday (11th March 2015) they were unable to buy our products on the Mac App Store. This was because of an issue at Apple’s end and so was completely beyond our control. Luckily, the Mac App Store is now back online so if you were one of the unlucky few yesterday, please try again today. Apologies for the inconvenience.

As a reminder, our products are:

Barcode Basics – Barcode generation

Ai Actions – Automator actions for controlling Adobe Illustrator

OnScreen Barcode Scanner – Scans barcodes from your Mac’s screen

Script Backgrounder – Make AppleScript Applets run in the background

Stopwatch Basics – A simple stopwatch app

PDF Basics – A simple PDF viewer with the ability to combine pdfs, extract pages and extract text.

05 Sep

We are 1 year old!

birthday-cake-popcorn

Ghostotter Software was first dreamt up on a long car journey from East Yorkshire to the Isle of Mull exactly a year today.

In that year, we’ve launched a successful barcode maker, Barcode Basics, a suite of Illustrator automation actions and Ai Auto Save – an automatic file saving app for Illustrator. So far so good, and we have more in the pipeline, so watch this space!

To celebrate our first birthday, we’ll be selling Ai Actions for half price for a week (ending 12th September 2014). That’s down from $11.99 to $5.99 (or approximate local equivilents). Ai Actions adds the ability to automate Adobe Illustrator using Apple’s Automator so you can create workflows and apps to carry out tasks for you without having to know any AppleScript or complex programming.

Get it while it’s cheap! https://itunes.apple.com/gb/app/ai-actions/id834871699?mt=12

10 Jul

Ai Actions price slashed!

Ai Actions, our set of Adobe Illustrator actions for Automator, has been slashed in price from £13.49 ($18.99) to £7.99 (£$11.99). Get it while it’s going cheap!

Ai Actions adds actions to allow Automator to control Adobe Illustrator. With these actions, you can create workflows to automate repetitive work without having any knowledge of AppleScript or any other kind of programming skills.

Save time on the donkey work, and spend more time doing the creative stuff!


Illustrator Actions for Automator, Automator Actions, Automator Illustrator Actions