11 months ago 🥁 for day 234, 2021 with 311 words.

Waka Waka Ding Dong

Exercise: Housework / Dancing
Piano Song of the day: Waka Waka (145/167 @ 80%)

So more domestic chores today. I did the kitchen cabinets, which leaves the table and the cabinets in the three bathrooms (well two and a half bathrooms).

Also washed the bedding, but skipped on the ironing.

I watered the garden and got out the leaf-blower to blow the "summer-fall" leaves into the garden beds where they will provide nourishment for the plants.

If we wind back to day 277, I talked about the time I learnt AppleScript, the language that doesn't want to die. Well today, for the first time in a very very long time I wrote some AppleScript.

I friend was using the random word feature of the www.vocabulary.com website to learn new ones. He would click on the sound bite and select the Text and hit "text to speech". Then record the whole thing and play it back while he was at work - he helps the robots assemble cars at the Tesla factory.

But could this be automated? The answer is, yes of course it can be automated.

A combination of AppleScript and JavaScript and we have some code that loads a random word, plays the voice clip, selects the text, and gets the Mac text to speech to say it out loud, and repeat, ad-infinitum. He can leave it running overnight recording and listen to it at work the next day.

tell application "Safari"
    repeat while true
    set URL of current tab of window 1
        to "https://www.vocabulary.com/dictionary/randomword"
    delay 1
    do JavaScript "document.getElementsByClassName('audio')[0].click();"
        in current tab of window 1
    delay 2
    set theText to
        do JavaScript "document.getElementsByClassName('short')[0].innerText;"
        in current tab of window 1
    say theText using "Alex" speaking rate 180
    delay 1
    end repeat
end tell

And it is as simple as that.

User Photo

By Yorick Phoenix 🥁

Chief WriteTogether Bug Finder & character stringer. Generally, to create computer code, but sometimes actual words and paragraphs. Listens to lots of music, takes lots of photos, & invests in stocks for the long haul.

Get Yorick Phoenix's newsletter

Almost there! Check your inbox and click the link to confirm.

Subscribe to Yorick Phoenix's latest writing to get it right in your inbox.