I just set up a nice little automation on my Mac that I just had to share with everyone, it’s quite small, but it’s a big help to me when writing my project report for university.
I’m writing it in iA Writer at the minute, and I’m certainly making full use of the content blocks for things like images, and referencing separate bits of text. But I wanted a way to take a screenshot, and then have it available to me to embed into the document. It meant I had to google a few things about AppleScript, but that seemed pretty simple.
To keep my project folder nice and tidy, I created a new folder inside it called “Resources”. At the minute it’s just for images, but who knows!
Then I created a new rule in Hazel, to detect any file in my Inbox folder[1] that has the tag “KeepTrack”[2], which then moves it into the appropriate Resources folder that I just created. It then runs a small bit of AppleScript to copy the correct text to my clipboard, that I can then paste into iA Writer.
set the clipboard to "/Resources/" & item 1 of inputAttributes
The inputAttributes is the variable Hazel provides, and I have only set one item to pass through, the full name of the file that was matched, so “Image.png” could be one.
Then I’ll get something like /Resources/Image.png
in my clipboard, that iA Writer will accept as a content block and show the image!
Hazel Rule
So it’s not a grand automation workflow, but it’s something that I worked out due to the fantastic capabilities of Hazel!
I’m starting to really love the app, and it’s allowing me to automate my work on my Mac even more.
If you want to get Hazel yourself, you can find it on the Noodlesoft Store.