Posts Tagged ‘Applescript’

In my roles as a writer and as a person, I read a lot. Some books I purchase, but many I access through my local library. How great is that?*

So I just spent a non-zero amount of time writing a little AppleScript to automagically run a search in any of the four area library systems that share e-book resources. 

Was it necessary? No. I could click through my library portal and into each separate library system for every book I want to check, one stodgy button at a time. Ho hum.

Does this script save time and my wrists and open up new worlds of possibilities?


Was it fun to make?

Also yes:)

* * *

I know, it’s a store, not a library. But she’s having so much fun! Photo by Ying Ge on Unsplash

* I love books, and I’m lucky enough to live in a society that supports public libraries. In fact, I made a modest donation to my local library the other day, and hope it helps bring just a little more literacy and knowledge and enjoyment to my city.

Read Full Post »

I code sometimes. I also write. Occasionally the two come together.

As I’ve mentioned, coding helps me find new ways to think about my work. Here’s a new Applescript I whipped up to highlight instances of “to be” in my drafts, as well as certain filler words that don’t add much to the text. Open your document in MS Word, then run the following code. The selected words will be replaced with bold versions of themselves.

Alter the list as necessary, or use this as an example of how to do a list-based loop in Applescript (hint: the “repeat” line is key;). Enjoy!

set my_word_list to {"am", "are", "be", "been", "being", "felt", "had", "has", "have", "heard", "is", "looked", "was", "wasn't", "were", "weren't"}
repeat with each_word in my_word_list
	set FindWordsToReplace to each_word as text
	tell application "Microsoft Word"
		set GetTxt to find object of selection
		tell GetTxt
			clear formatting
			set its content to FindWordsToReplace
			tell its replacement
				clear formatting
				set its content to FindWordsToReplace
				tell its font object
					set bold to true
				end tell
			end tell
			execute find wrap find find continue replace replace all with match forward and match whole word without match case
		end tell
	end tell
end repeat

Read Full Post »

Some days I stand here at my desk trying to generate a creative thought (or even two!) and it doesn’t happen. If I can’t do the thing I set out to do I still try to do something, so on those days I look for alternatives to get my mind working. My latest filler project is a little Applescript (sorry Windows, I just don’t swing that way) that pops up a window with practice ideas for writing projects. Not what to write, but what to practice while writing.

Here’s the code with a sampling of my current list of practice topics. If this is your sort of thing, substitute your own practice topics as necessary:

set x to some item of {"*action*", "*all five senses*", "*catchy beginnings with a hint of the speculative*", "*characterization*", "*cliffhangers*", "*conflict*", "*distinctive dialog*", "*emotion*", "*grounding*", "*imagery*", "*immediacy*", "*openers*", "*scenes*", "*settings*", "*showing instead of telling*", "*smart science*", "*visual detail*", "*writing without 'was'*"}
set textToType to "Practice " & x & " in your story today."
set answer to the button returned of (display dialog textToType as string buttons {"Excellent idea, thanks!"} default button 1 with icon note)

So it’s code today, perhaps cake tomorrow. Chocolate. Triple tier. With Bailey’s icing:)

/unless that’s a lie

Read Full Post »