TIFF scanning and compression

Over the last year or so, I have been slowly scanning my father’s large collection of photographs. He was a bit of a stickler for collecting his negatives in an orderly fashion so I am able to work my way through numbered folders of negatives, each of which generally contains the content of a single roll of film.

The scanning process uses my Epson Perfection V370 Photo flatbed scanner. I found various online references citing a recommended resolution of 4000 dpi for archival scanning of 35mm negatives, so I have been scanning them to 4800 dpi TIFF files. However, the software used for this has been problematic at times.

I first began with the Epson Scan software provided with the scanner. This software makes a reasonable job of detecting each frame on a strip of up to six negatives and saving them out to separate files. However, it has two weaknesses. First, it sometimes fails to properly detect frames (especially underexposed ones) and makes a big job out of manually correcting these as you need to go through an entire scanning process for each frame that requires correcting. Secondly, it’s fiddly in operation. I constantly had to turn off “auto” settings that threatened to “process” the files for me. I want the files straight from the scanner. I have other software to process the photos for further use as required.

After hitting major frame-detection issues with some half-frame films, I set about trying to use Hamrick Software’s VueScan, which I already owned. This software gives a lot of control over both the scanner and the output. It’s multi-frame handling, however, is obscure and complex and, I find, impossible to use.

I began to despair that neither piece of software was going to make the job as easy as I wanted. I have over 200 films to scan so every inefficiency is magnified substantially. After a bit of a hiatus, I decided I should get back into the task and decided that I would settle for scanning each entire strip in VueScan. This means I can use the single crop mode which is quick and simple. Plus using only a single scan pass for an entire strip actually saves considerable time over Epson Scan’s multi-frame approach.

I was originally going to leave the strips intact and only separate out individual frames when I actually wanted to process one, but I found previewing the 220 MB image files to be a little cumbersome and some software, including Apple’s Preview app, just couldn’t cope with the size. It struck me that Affinity Photo‘s Export Persona might offer a quick solution. It did.

Loading up a full strip into Photo takes a few seconds, then I switch to Export Persona and set the default output format to 16-bit B&W TIFF — the same format I am starting with from the scan. Once that’s done, I simply drag out the rectangles to mark each frame, and as each is created I add the film and frame number as a name, e.g. 110_24. Once all the frames are defined and named, a single click on the export button writes out the individual TIFF files. It’s an efficient process. Far more efficient than the same frame-setting in either Epson Scan or VueScan.

Once I have my individual frames, the strip scans are deleted and the frames end up in Adobe Lightroom, and across several backups, local and cloud. It was while beginning to upload to a new cloud backup that I noticed all of the earlier films, scanned with Epson Scan, were substantially larger than those created recently with the new process. I’m talking about 55 MB instead of 35 MB. That’s quite a difference in one file and enormous when considering the 3000+ frames already scanned!

A bit of detective work revealed the early files had no compression applied while the newer ones did. This is not something I ever thought to set, and I’m not sure I could. Certainly, Affinity Photo doesn’t seem to offer control of this. With the huge gains to be had in both local and cloud storage, I set about finding how to compress the older files. No apps I have seem to offer this capability but I remembered I had installed ImageMagick some time ago and began looking for ways this might help me.

While looking for how to invoke ImageMagick, I recalled I had installed it using MacPorts. In my search for the command to run (which the online documentation inexplicably has wrong) I stumbled across a bunch of commands with names beginning “tiff”!

A vague recollection tells me that when I installed MacPorts I went through all of the available ports looking for stuff I thought might be interesting or useful, and the tiff port was one of those.

Looking through the commands, I found tiffinfo was able to give me some more insight into the compression used in the smaller files. The tiffcp command had the required chops to read one tiff file and output another with specific attributes — including compression.

Some research and experimentation later yielded the following command to best compress an existing, uncompressed TIFF file.

tiffcp -c zip:2 original.tif new.tif

This turned my 55 MB TIFF files into 35 MB TIFF files and they were still happily viewable with QuickLook and Affinity Photo. Success! So the next step was how to reasonably apply this compression to 3000 or so files.

Some further experimenting yielded the following multi-command line that I ran in each of the 100 folders that needed attention.

for f in *.tif; do echo -n "."; tiffcp -c zip:2 "$f" "$f"f; rm "$f"; mv "$f"f "$f"; done; echo ""

Some of that is tidying and dressing up. The “$f” source file and “$f”f target file meant 110_24.tif would be converted to 110_24.tiff which then enabled me to remove the original and rename it back to a .tif extension to maintain the filename (for Lightroom). The echo simply provided feedback that it was indeed cycling through all of the files in the directory.

I forgot to check the space before I embarked on this exercise across all of the folders, but I’ve saved at least 38 GB of space.

Here’s one of the more interesting photos to have come out of the exercise so far.

 

Cleaning up macOS Launchpad

It is a much maligned feature of macOS but there are times when LaunchPad is useful. Such as when I want to scan my apps for recent additions that warrant a review. Sure, I can just open the Applications folder, but LaunchPad is a much easier presentation.

But, it does have its issues: for one, the inability to delete non-Mac App Store apps. This is a quick post on a method I found that allows you to do just that.

When searching for a solution, there were numerous older posts online that talked about issuing database deletes but many noted this didn’t work in more recent releases of the OS and indeed I found this to be true of Sierra.

Then I found this post at OS X Daily which offered what appeared at first to be a simple rearrangement of icons rather than removal of specific ones. However it turns out it does exactly what I needed. If you delete an app from your Mac and then follow this tip, the icon will be removed from LaunchPad.

So, here’s the sequence of steps required.

  1. Delete the app. If you have AppZapper or AppDelete, use one of those. If you have Hazel, simply drag the app to the trash and let Hazel clean up the extras*.
  2. Empty the trash. The one time I didn’t do this, weird things happened.
  3. Execute the below command in Terminal. If your browser wraps the line, just copy it as one and paste it into Terminal and it will be fine.
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

That’s it. You may notice when you next open LaunchPad that some of the icons are absent momentarily but they will appear before you have time to worry.

A side effect is that the first page will have the default layout of Apple apps and subsequent pages will have all the extra apps previously present (less those deleted) in alphabetical order.

The one time I didn’t empty the trash, most of the icons were drawn as dotted rectangles, hence my step 2.

*Hazel has a feature called App Sweep. I’m not sure if this is turned on by default. You can find the setting in the Trash tab of the Hazel preference pane.

Design iOS icons in Affinity Designer

UPDATE: The export slices in the original file were a little bit off on dimensions and I wasn’t sure how to fix this at the time. I’ve now adjusted the Artboards and export slices to perfect those sizes, and this may solve the softness issue I described in the original post as well. The updated file can be found here.


I’m a recent convert to Affinity Photo, so when a special offer came up for Affinity Designer, I leapt at the chance. I’ve not done much more than mucking around to learn Designer, but while doing so I figured it’d be a great tool for designing the type of strong, bold icon I need for my (planned) iOS apps.

That got me thinking about the standard icon grid of golden ratios and the all-important squircle corners. Having used a Photoshop template in the past, I had a pretty good idea of what I wanted. I ended up basing it off an SVG design from German software company Kodira.

The icon template open in Affinity Designer

The template makes use of a new feature in Affinity Designer 1.5 – Symbols – along with artboards. The large (1024 pixel square) design on the left is based on a symbol which is then duplicated to the other artboards which are sized to provide the required icon variants.

Layers palette with master artboard expanded.

To modify with your own design, expand the master artboard and edit only the contents of the symbol, as marked with the solid orange border on the left. In order for the automatic scaling to work, you must remember to check the Scale with object checkboxes where ever-present, such as on strokes and effects. Also, keep an eye on where your objects go – if they don’t get an orange border, they’re not going to be replicated to the other sizes.

A number of guide layers are provided to help you edit and visualise your design.

Check the GUIDES layer to display the golden ratio guides on top of your design. You can also use these for snapping as required. This is not part of the symbol so will not affect the other icons sizes, however, remember to turn them off before exporting if you want your large icon to be clean.

Check the MASK layer to round off the corners with a white background to help visualise the final result. Once again, this will only affect the large icon, but there is another way to round the icons on all sizes. See below.

If the white corners are too much, there is a hairline outline of the corners in the Outline layer which may prove useful while designing.

The top level of the symbol (titled EDIT THE CONTENTS OF THIS) has an optional mask (titled Unselect for Xcode icons) which will round the corners on all of the icons. This may be useful for generating pleasing “finished” icons for promotional material, however, ensure you turn this off when exporting your icons for Xcode.

When you’re done designing, head on over to the Export Persona, where each artboard has already been set up for exporting in the relevant resolutions as required by Xcode or iTunes. The sizes and scale variations are current as at iOS 10.

I’m providing this free of charge because I think it might be useful for others, however, no warranty, express or implied, yadda yadda. You can contact me on my contact page if you have any feedback, but I don’t promise I’ll respond.

NOTE: I have noticed that the scaling Affinity Designer performs can lead to some soft edges and this includes the outside edges of the gradient background in the example – you may wish to check the output and consider whether you want to take a more direct approach to the scaling depending on your design.

DOWNLOAD THE FILE HERE

 

Lightroom to Photos in one easy step

I was recently taking part in a discussion about the relative merits of different software packages in a photography forum when one of the other Mac users said he managed his images in Aperture (for now) and then manually moved selected photos to the new Photos app for sharing.

Given Aperture is on death row, I have long since moved to Lightroom and I wondered whether I could automate the moving of selected images from Lightroom to Photos. It only took me 10 minutes and one extra piece of software.

The extra piece of software is Hazel, from Noodlesoft. Hazel watches folders and then matches files within, according to rules which can be simple or complex, and then takes action on them. The actions include a large range of traditional file managing options, but also some more powerful ones including, it turns out, importing images to Photos.

Armed with this ability and some knowledge of Lightroom presets, it’s a fairly simple task to set up the process. 

When importing to Photos you can either just import it into All Photos or you can specify an album. For my purposes I thought it made sense to create a single album explicitly for this process, called Lightroom. I can later move the images to other albums within Photos as I desire. If you’re going to do this, you’ll first need to create that target album in Photos.

Next, in Finder, create a new folder for the sole use of this process. I created one called Add to Photos in my Pictures folder. This will be where we tell Lightroom to place the exported images.

Now add the folder to Hazel, and then add a rule like this.

You could arguably also select videos for adding but I have elected to only move images. You could also leave out this matching as the folder is intended for this purpose only, but I like to have some sort of protection against adding goodness knows what I may accidentally put in that folder.

Note the first action is Import into Photos and the parameter is the album I created. This is selected from the drop-down list which is why you have to create the Photos album ahead of this step.

I’ve added a second action to trash the image file from the folder – I don’t want them building up in the folder as well as Lightroom and Photos.

You can test this much now by simply using Finder to drag an image into your folder and it should find its way into Photos. Note when Hazel performs this action the Photos app will launch. In my experience it did not become the active app, but remained in the background. You’ll probably want to close it down after you’ve sent some photos through this process.

OK, so now let’s do the Lightroom side of the equation. This is pretty simple to get working but you might want to spend some time tweaking to your tastes.

In Lightroom select a sample image and choose from the menus File > Export… to bring up the Export window. You may wish to choose an existing preset to set your options for how the image will be processed to save some work, but we’re going to create a new preset.

The one vital requirement for your export is that it place the resulting file in our special folder. Be sure the Export To: setting at the top says Hard Drive, then in the Export Location section, choose Specific Location and click the Choose… button to navigate to your folder.

That’s the only hard and fast requirement for this to work, but there are a couple of other items I recommend setting.

Under File Settings I recommend you choose JPEG and set a reasonably high quality. It’s likely these photos are going to be viewed on retina screen iOS devices, so you’ll want them to look crisp. JPEG files are also efficient on size, so you won’t be chewing up too much iCloud or hard drive space.

Under Image sizing I like to downsize my images. I’ve recently settled on my images being around 2000 pixels on the longest side when I publish them on Flickr, but that leads to rather large images when I crop square, so now I’ve taken to specifying megapixels. 2.7 megapixels comes out to 2008 pixels wide for a standard 3:2 ratio image. In any case, if you’ve got honking great 16 megapixel images coming out of your camera, you probably don’t need all of that in iCloud, so choose a sensible sizing option that works for you.

Have a look through the other options and set any as you see fit. I do a little manipulation of meta data and use a 3rd party plugin to add my watermark. Lightroom has a built in watermark function but I find it not quite flexible enough for my needs.

When you’re happy, click the Add button below the preset list to add your current settings as a new preset. I called mine Send to Photos app. Finally, hit the Export button and all going well your image should end up in Photos.

For future exports you don’t even need to see the Export window – simply select your photos and choose from the menus File > Export with Preset > Send to Photos app and whoosh! Off they go.

If you’d like different presets to send to different albums in Photos, then you can simply replicate this entire setup. A separate folder to be watched, a separate Hazel rule (targeting the relevant folder and album) and a separate Lightroom preset targeting the relevant folder.

Happy sharing!

Unpacking the suitcase

Further to my post on installing fonts on iOS devices, I came across a slight problem when attempting to include the ever popular Century Gothic font in my font payload. When I located the font it was in a Font Suitcase file which the Apple Configurator didn’t want to know about. I spent some time trying to work out a way around this and eventually hit on a simple method using only an OS X command and a simple piece of free software.

I first discovered that Font Suitcases generally contain regular TrueType fonts (.ttf files) and it is ‘just a matter of extracting those.’ Except every method I came across didn’t work for me. If you search this out for yourself, you’ll likely come across a utility called Fondu which would seem to be the perfect answer – but I could not get it to compile on my Mavericks system. Perhaps if I had more developer-fu I might have succeeded, but I stumbled across a simple, two-step process which works.

Unpacking a Font Suitcase

Open Terminal

First up we need to launch a Terminal window to do the first part of the extraction.

At the command line type cd followed by a space.

Finding your Fonts in Finder

As per the process for installing your fonts to iOS, locate the font you require. The Kind will be Font Suitcase and the filename will have no extension. Make sure the Finder window is showing only the directory containing your fonts (i.e. don’t just expand disclosure triangles if you navigate here manually). The icon at the top of the window is a proxy icon for the folder and we’re going to use that to our advantage.

Drag the proxy

Drag the proxy icon from the Finder window to the Terminal window. In my experience with a trackpad, this drag did not always work first time for me. It seems a deliberate pause is needed after clicking (or tapping) to start the drag. It will at least be obvious when the drag has begun. It doesn’t matter where in the Terminal window you drop it.

Path set

Having dropped the proxy icon, the full path to the folder has been entered on the command line for us. Press Enter to execute the change directory command.

Fonts folder

You will notice the prompt change to reflect we are now in the Fonts folder.

Building the next command

Now we need to enter a reasonably complex command and we’re going to let Terminal help us.

Type cat “ and the beginning of the font name. We need just enough of the name to be unique. In my case, there is also Century Schoolbook so I have to get as far as the G of Gothic to be unique.

Then press the Tab key.

Autocomplete

If what you’ve typed is unique, Terminal will complete the name for you and add a closing ” followed by a space as well. Using this feature not only may save some time but we know for fact the filename is exactly right.

Edit the command

This bit you just have to do manually but the important part as far as accuracy goes is taken care of.

Use the Delete key (below the Eject key) or Backspace key (whatever key deletes characters to the left!) to remove the extra space and then the ” character. Then type in

 /..namedfork/rsrc" > ~/"

and follow that with the path and filename we are extracting to. This file will be created new or replaced. In my case, I’ve targeted my Downloads folder in my user directory. The actual filename can be anything you want. Make it shorter if you want to save some typing, just remember what it came from. Finally, add a  on the end and press Enter.

The whole command should look something like this

cat "Century Gothic/..namedfork/rsrc" > ~/"Downloads/Century Gothic.dfont"

First bit done

If all is well you’ll see no errors. We’re finished with the Terminal now unless you wish to extract more fonts, in which case head back to the “Building the next command” step and repeat.

Downloads folder

If you open a Finder window and go to your Downloads folder you’ll see the file you created is a Datafork TrueType font.

DfontSplitter « Peter Upfold

Now you need a utility to do the second step. Head on over to Peter Upfold’s site athttp://peter.upfold.org.uk/projects/dfontsplitter and download the Mac version of DfontSplitter. Note – it does work on Mavericks.

Unpack and run

Once downloaded, unpack the Zip file and you’ll get a folder containing DfontSplitter.app and a license file. Right click the app and select Open. You may get a pop-up asking you whether you really want to open an unsigned application. You do!

DfontSplitter

Return to your Finder window where your dfont file was and drag it to the DfontSplitter window.

Set an output directory

Click the Choose button and select the directory where you want the resulting TrueType (.ttf) files placed. Here I’ve once again specified my Downloads directory.

Once that’s done, click Convert.

We’re done!

DfontSplitter will switch you to the Finder (though not necessarily the right window!) and you should be able to see your TrueType fonts (I’ve selected mine below to highlight them). You can now add these to your font payload in your iOS profile.


Banner image © A. Jenks.

Fontastic iOS!

While I was mucking around last night trying, again, to figure out the much talked about “per app VPN” that iOS 7 supposedly offers, I stumbled across a rather glorious discovery. You can install any TrueType or OpenType font on your iOS devices and use those fonts in iWork across iOS and OS X. Hallelujah!

Disclaimer: I stumbled across this process and have managed to replicate it in order to make the documentation which follows. But your mileage may vary, so there are no guarantees this will work for you and I shan’t be held responsible if you do something nasty to your device.

Full details are below. Have at it!

Update: I discovered some fonts on my system were in a Font Suitcase format which the Apple Configurator refuses to deal with. I’ve added a post on how to deal with these.

Update 2: Developer Florian Schimanke has built an iOS app, AnyFont, which makes this process even easier as you can do it directly from your device via iTunes file uploads.

Installing fonts on your iOS devices

In the beginning

Apple has released new versions of iWork for iOS and OS X which now promise “full file compatibility” between these operating systems. However one long standing issue is that of fonts. Whilst the collection of fonts available on iOS has expanded considerably, it doesn’t address the problem for those of us who seek out very particular fonts on OS X. I’m a big user of display fonts for craft purposes and this has always meant the iOS version of iWork was off limits.

Until last night I stumbled across the simple way to solve this. No hacks required! Below you can see part of the available list of fonts on my iPhone before I followed this process. I’m going to add to it. Follow me…

 

 

Font Book

Apple supplied the Font Book application with OS X and we’re going to use this to locate the fonts we want to install. I’ve chosen for this exercise to install a font called Dunkirk. Notice how it has multiple styles of the font. Initially we’re just going to add the Regular style to the iPhone. I’ll come back at the end and cover how to get the others.

Locating the font file

Right click on the font style name as shown and choose Show in Finder to have Font Book reveal the file that defines the particular font style.

Font found

The Finder window opens and the chosen font file is highlighted. Note its location – usually in your user folder inside the Library/Fonts folder if it’s one you installed yourself. Don’t do anything with the file here, but perhaps leave the window open as a reference for later.

Obtaining the magic sauce

The trick to installing fonts is to obtain Apple’s Apple Configurator app which is available for free in the Mac App Store. If you search for “apple” you’ll probably see it pop up as the second choice in the list as below.

Get it!

My screen shows it’s already installed, but you know how to “buy” this free app, right? Well go ahead!

Launching the Apple Configurator

When you launch the Configurator it’ll look something like below. This tutorial was recorded using version 1.4.2. There’s actually a lot you can do with this application – it’s intent is to manage (potentially multiple) iOS devices and you’d probably find it in schools or businesses. But it suits our purposes today as it will let us install fonts on our iOS devices!

Create a profile

The basic concept of the Configurator is creating profiles which contain payloads which are then deployed to the device(s). So we need to create a profile.

Make sure you’re on the Supervise tab and then click on the + button and select Create New Profile…

Our new profile

A panel appears in which we can define our payloads for the new profile. The General tab is the only mandatory one and the only mandatory field is a display name. Here I’ve just called it Font load.

Time for fonts!

Scroll the left side of the panel until you see the Font payload type and then click on it. You’ll get the Configure button. Click that.

Select the font

Remember when we located our font file from Font Book earlier? Now we need to navigate to the same place and select that font file. Then click the Select button.

Our font is a payload now

Once you’ve selected the font, it’ll show up as a small preview in the font tab of our profile pane. It’s now a payload for our profile. As this is all we’re adding to this profile, click on the Save button to save it.

Profile is ready

You’ll now see your new profile in the list of profiles on the Supervise tab.

Next, plug your iOS device into your computer with its USB cable.

Device found

With my iPhone plugged in, I can see a number (1) has appeared on the icon for the Preparetab. That’s what you need to see before proceeding.

Let’s get ready to rumble

Click on the Prepare tab and then on the Install Profiles… button. Note the description below it which says “Click to install profiles on a single connected device.” That’s exactly what we want.

Finding the device

As soon as you click the button the panel below will appear. Initially it shows a USB cable but I wasn’t fast enough to capture that! Once it identifies your device it will appear as below.

Click the Next button.

Choose your profile

Next you need to select which profiles to load onto the device. Make sure you tick your profile.

Before you click Next, make sure your device is unlocked!

Then click Next.

Oops!

If you get this, it probably means you didn’t unlock your device. If that happens, click Close, unlock your device and then click the Install Profiles… button again.

Installed!

If everything was OK, you’ll see this success screen. You can click the Close button.

Now turn your attention to your device.

Now to ACTUALLY install

You should see a screen like this on your device. Note the display name you provided is the bold title next to the Settings icon and you can see when the profile was transmitted and what it contains – in this case, one font. It’s not verified because we haven’t gone through a signing procedure. If you trust yourself, tap on the Install button.

 

 

Accept the risk

Still trust yourself? Tap Install Now.

 

 

Really sure?

For your further protection, you now have to enter your phone’s unlock code/password.

 

 

Finally!

Note the heading has now changed to say Profile Installed. Now it’s really installed. Tap on the Done button.

 

 

All your profiles are belong to us!

Now you’ll see all the profiles installed on your device, including our new font configuration. Let’s head back to Pages.

 

 

In fonts we trust

You may have to quit Pages to force it to reload the font list (double tap the home button and swipe it up off the screen). As you can see below, I now have Dunkirk as a font choice.

The (i) buttons to the right of some fonts give access to different font styles. Remember how Dunkirk had several? We can go back now and add those if we want.

 

 

Changing the profile

In my testing, changing a profile’s contents and then reinstalling didn’t work, so the trick is to remove it from the device before reinstalling. You can get back to the list of profiles in the Settings app by going to General and then Profiles (scroll down a way). Removing it is pretty straightforward with a Remove button right there on the detail page.

 

 

Updating the profile

To add extra styles or extra fonts, go back to the Supervise tab and double-click on your profile name in the list. That will bring you back to the editing pane.

Adding more fonts

You can click on the small (+) button to add additional fonts. Here I’ve added the bold, italic and bold italic styles of Dunkirk by including the extra three files. Oddly, the font pane does not scroll so be careful picking your font files. You can always use the (–) button to remove them and start again.

When done, click Save to resave the profile and then install as before.

Multi-font payload

Here’s the install screen for the revised profile with four fonts. Note the Contains field tells us there are now four.

 

 

Styles galore

After killing off Pages again and relaunching I can now select bold and italic for my Dunkirk font. I’ve not tested, but I expect other style types will show up when you tap the (i) button next to the font name as I previously illustrated above.

 

 

Collaboration?

And the final test – here’s the document opened in Pages for OS X. There’s my bold, italic Dunkirk just as I’d hoped!


Banner image composited on Placeit, © A. Jenks.

Printing with AppleScript

Update: at some time since I built this script it has changed (by itself) within Hazel. I guess a Hazel update or an OS X update has prompted this. The difference is in the print line which now reads:

print theFile without «class pdlg»

Thanks to Kelly for alerting me to the fact the original wasn’t working.


If you listen to the Mac Power Users podcast, or perhaps you’ve heard Katie or David on other podcasts, then there’s a really good chance you’ve heard of Hazel. Hazel is a very powerful tool for automation and David and Katie often mention it as part of a solution to their problems.

In the latest issue of ScreenCastsOnline Magazine, Katie wrote about using Hazel to automatically upload files to Evernote. I guess I finally got overwhelmed with all the goodness of the paperless lifestyle and I went and bought Hazel. It’s a very modest USD$25 considering the power it has.

Now, despite the idea being to go paperless – eventually – a current reality is that my wife pays the bills and right now most of them arrive on paper. So one of the bills that arrives electronically usually gets printed in order for it to get paid. Yeah, I’ll work on that!

So I got to thinking – in the meantime, can I use the same techniques to automatically print a document? Turns out yes, I can. It’s pretty easy, too. When you know how! It took me a lot of Googling and experimenting to work out the correct Applescript to print a document. I’ll save you all the trouble. Here’s the code as shown in Hazel’s action panel.

I’ve put the text at the bottom of this post so you can easily copy and paste, too, but above shows the syntax highlighting that Hazel will show you when it compiles successfully.

The only thing you’ll need to change is the name of the printer where you want it to print. Make sure you get the name exactly right. If a window pops up and asks where your printer is, then you’ve got the name wrong. That “smart quote” in the name (for the possessive ‘s’) stumped me for about half an hour because I typed what I saw.

The easiest way to copy the exact printer name is to open the print queue for the printer (you can do this from the Print and Scan System Preference pane), then click on the Settings icon. The name is shown in an editable field from where you can copy it.

When the action runs, you will notice the print queue window open and then close. If it’s already open, it will still close. If you want the print queue window to always remain open, remove the quit line from the script.

Note that I have only tested this on PDF files. It may work for other file types, but you’ll have to find that out for yourself. Applescript allows for instructing specific applications to print their documents, but I will leave that as an exercise for the reader.

tell application "Your Printer Name Here"
  activate
  print theFile without print dialog
  quit
end tell

Banner image from Wallpaper Converter by andreea.