A Simon filters case study

Before I moved the Dejal blog to WordPress, I had a test that was bundled with Simon called “Dejal posts” (you may still have this if you’re a long-time customer). This was a great example of using multiple filters to narrow down the output of a Web Page service. While the URL it monitored is no longer valid, it remains a useful example for you to learn more about creating your own filters.

The general idea of this test was to look at a “Recent Posts” page of the Dejal site, which listed all recent blog, forum, FAQ etc posts and their comments, and output some tidy text describing the most recent one, along with a changed state when a new post or comment is added.

Firstly, here’s the Service page; nothing remarkable here (the cookies are automatically recorded, and unimportant for this test):

Service

The most interesting page is the Filters one:

Filters

When you check the test and look in the Activity log, you can see the output from each of those filters (from bottom to top):

Activity

Another way to view the output is via the Preview pane, which includes not only the service response and headers, but also the full output of each filter, to help you diagnose each step.

Here’s the output of the service; the full HTML of the web page:

Preview0

Let’s break down each of the filters, via the Preview filter output.

The first filter, a Block one, takes the service response as its Input, and has Start text of <tbody> and End text of <td class="replies">. This finds the first occurrence of each of those bits of HTML in the service response, which corresponds with the most recent post information:

Filter1

This filter outputs that:

Preview1

The second filter is another Block one. It takes the output of the first filter as its input, and narrows it down further to just the title of the post. Notice that it also uses options disclosed on the right-hand-side of the filter configuration: it looks for the second occurrence of the Start text, searching from the beginning of the input:

Filter2

The output of this filter is the post title:

Preview2

The third filter is yet another Block (it is one of the most useful filters), but the input is different: this time it uses the output of the first filter, instead of the previous one (as is the default). It also has an option to look for the third occurrence:

Filter3

It extracts the author information:

Preview3

Filter number four is different. It uses an Ignore Links filter to extract out just the author name from the previous filter output. The previous filter doesn’t do this as when you were not logged in on the Dejal site, only the name is included (in which case this filter has no effect):

Filter4

The output is just the non-HTML part of the input:

Preview4

Next we’re back to a Block filter again, but this time looking at the original service response text to extract the number of replies to the post:

Filter5

This should always output a number:

Preview5

We then use a Singular or Plural filter, to take the number found in the previous filter and output “reply” if it is one, or “replies” for any other number:

Filter6

As seen in the preview:

Preview6

The last filter puts it all together: an Override Custom filter uses variables to combine the output of several filters in a nice readable way. In this case all the variables are variations of the filter output, but other variables are available too. Something that isn’t immediately obvious is that you can insert numbers to reference specific filters (otherwise it refers to the previous one):

Filter7

Which results in:

Preview7

So now that we’ve got some nice output text, what do we do with it? Of course, you can just see it in the Tests list, if you have the last change and failure displayed:

Tests

But you’ll probably want to get a notification:

Notifiers

I hope this case study is helpful. Most tests don’t need a series of filters like this, and there are other ways to achieve similar effects (like writing all the logic in a script), but it can be very useful when you want it. You can use similar techniques in your own tests.

How can I play a sound during a break in Time Out?

To play a sound or perform other actions before, during, or after a break, check out the Actions page of the break editor:

Actions page

Other actions include the ability to display a notification (with an optional sound), fade out the currently playing sound (useful at the end of the break), flash the screen, and speak some text with speech synthesis. Several scripts are provided, too.

To add an action, simply click the + button in the top-right corner of the window, to display a menu of available actions:

Add action menu

(When you first click this button, the scripts won’t be there, and there will just be “More…” item at the end; choose this to install the scripts.)

The first bunch are the various actions, followed by scripts, which are like customizable actions. At the end of the menu are items to open the Scripts folder in the Finder, so you can edit or add scripts, and go to the Time Out Extras page to download more scripts.

Once you add an action, you’ll see a header row with the name of the action and some other controls:

Action header

You can use the interval picker and pop-up menu to indicate when to use the action. The interval picker enables you to offset from the action stage by a number of seconds, minutes or even hours (click on the units to change them). Instead of just being able to play a sound at the start and/or end of a break, you can choose from many more times, including before due, after skipping, and more:

Action when menu

After those controls is a Preview (Preview) button, that will demonstrate the action. And a Remove (Remove) button to remove the action.

Here is a brief video to demo the feature: adding a Play Sound action to play a long music track, and a Fadeout Sound action to make it fade out when the break successfully finishes. (You might instead want to have it fade out for any end, otherwise it’d keep playing till done if you skip.)

This is a powerful and flexible feature of the app, especially when using custom scripts.

On vacation

Please note that I’ll be on vacation for the next couple of weeks, with unknown internet access, so support queries may be delayed. Please post to the /r/Dejal community on Reddit, so others may be able to assist.

My wife and I will be dropping off our motorhome for servicing, our cat Paladin for boarding, and will be catching flights for the first time in years, heading to the US Virgin Islands to celebrate Jenn’s milestone birthday.

Paladin

No doubt I’ll take lots of photos, and will do posts on my Sinclair Trails blog once we’re back, so you can look forward to that.

Next Dejal post on the 21st. See you then!

Why are my Simon tests timing out on my Apple Silicon Mac?

If you install Simon on an Apple Silicon (M1, M2, etc) based Mac, you may notice Web Page tests timing out.

That is because the Web Page service uses an embedded helper tool to load the HTML in a separate process, to improve performance and reduce the risk of crashing Simon. But currently this helper is Intel-only. Some other helpers, e.g. to send emails or upload reports to a remote server, are also Intel-only.

This is fine, but it means that you need to install Rosetta, Apple’s emulation layer to enable running Intel apps on Apple Silicon.

The main Simon app is universal, so launching it won’t prompt to install Rosetta, but you can override that by checking the “Open using Rosetta” option in the Finder’s Get Info window:

Open using Rosetta

Just remember to uncheck that option after you’ve opened Simon, so subsequent launches use the universal code.

Using Simon to watch YouTube subscriber counts

A customer sent a query, asking how to use Simon to monitor the subscriber counts on YouTube channels.

This is easy for Simon to do, by having Web Page tests for each YouTube channel, each with a filter to extract the subscriber count, and whatever notifier you wish.

The first step is to add a Web Page test for a YouTube channel, and look at the HTML output in the Preview pane, to find how the subscriber count appears.

Test

For example, for my Sinclair Trails channel, the HTML includes:

    "subscriberCountText":{"accessibility":{"accessibilityData":{"label":"30 subscribers"}},"simpleText":"30 subscribers”},

Yes, I currently only have 30 subscribers… rather sad. Please subscribe to help me reach a more respectable number!

A sensible default choice for a filter is the Block one, though in this case a better choice would be the Find Regular Expression filter. But if you want to have several tests with the same notifier configuration, an even better choice is to create a new custom notifier, so you don’t have to configure the notifier for each test.

A regular expression to extract the subscriber count from that HTML could be:

    subscriberCountText.+?simpleText\":\"(.+?)\”\}

This will look for text starting with “subscriberCountText”, some more text, then “simpleText”:"” , then capture the desired text up until “”\}” .

In my case, that will result in:

    30 subscribers

To make a new filter for this, you can go to the Filters page in Simon, and add a new filter named “YouTube subscribers” (or whatever you prefer).

Then choose Find for the Filter Kind, and Regular Expression from the find options menu:

Find options

Then enter the expression as the find text, and choose Capture 1 as the output:

Custom filter

Click Done, then go back to your YouTube test, and choose this new filter on the Filters page:

Test filters

This will output just the subscriber count:

Filter output

You can see this output in the Activity log:

Activity log

Or you can add a new Email notifier to email the filter output using the {FilterOutputText} variable:

Email notifier

And of course use that notifier in your test, along with whatever other notifiers you wish:

Test notifiers

Then you can add more tests for other YouTube channels you want to monitor, specifying your YouTube subscribers filter for each. For example, CGP Grey has a few more subscribers than me:

CGP Grey test

I hope this helps!

New and updated Time Out themes: Sinclair Trails and Tropical Rain

As you know, Time Out dims the screen and by default shows its icon during a break, but has the ability to show other content via themes, as a reward for supporters of the app. Just dimming the screen is enough for a break, fine for people who want the basics, but avid users of the app can keep things interesting with other themes.

The theme can be changed on the Break Appearance settings page; click the blue Info button next to the pop-up menu to learn about the theme, and try it via the Preview button:

Appearance settings

One of the built-in themes is called Tropical Rain; it was kindly contributed by Time Out customer Nick Kaijaks. It play a HD YouTube video of a tropical rain forest, with the gentle sound of rainfall, starting from a random offset in the video, so it’s different for every break.

On macOS Ventura the theme stopped working, so it has been updated to fix that. I also increased the volume of the rainfall to 50%, since some people mentioned that they couldn’t hear it. You can adjust the volume by editing the index.html file within the theme; look for the follow line; the value can be anything from 0 to 100:

    var VOLUME = 50;

The corrected theme will be bundled in the next update of Time Out, but in the meantime you can download the update here. To install it, choose the Reveal Themes command from the end of the themes pop-up menu, and drag the uncompressed theme folder into the revealed Themes folder in the Finder, replacing the existing one.

Tropical rain theme

I have a YouTube channel called Sinclair Trails where I post timelapse videos of our motorhome travels around the US. I recently posted a video that combines the timelapse videos from 2022 into one faster video. So having just updated the Tropical Rain theme, it occurred to me that I could make a copy of that to play random parts of my timelapse video. And so the Sinclair Trails 2022 Timelapses theme was created; you can download it here.

Sinclair Trails 2022 timelapses theme

This theme plays the video without any sound. Again, you can adjust that by editing the theme source. Or use a Break Action to play your own music if you prefer.

I also have a similar timelapse video from 2021, which is available as the Sinclair Trails 2021 timelapses theme; you can download it here.

Sinclair Trails 2021 timelapses theme

Finally, I also added a theme that just shows the Sinclair Trails blog, which has new posts every day. You can follow along on my adventures exploring the country while you take your breaks. You can download this theme here.

Sinclair Trails blog theme

Why haven’t I received an email from Dejal?

If you send an email to Dejal asking for support, you should expect a reply within 24 hours. If you don’t get one, chances are your email service has mis-flagged it as spam. So check your spam folder.

If you use the contact form, and request a reply, you will get an automated reply email from the Dejal server within minutes, acknowledging receipt. And will get a personal reply within 24 hours, if needed. So if you don’t get that automatic reply, again check your spam folder.

I know it’s frustrating to write to a company and not get a reply. As an indie developer, I strive to provide excellent customer support. But it’s just as frustrating for me when I write a lengthy reply and it bounces due to a mail server being full, or thinking its spam, or other issues. So please check that you don’t have overly aggressive spam filtering if you’d like to receive a reply.

Another alternative to email, if you want to bypass those possible hassles, is to post in the Dejal community on Reddit, r/Dejal. I check that every day (well, most of the time), plus other members may be able to help you too.

And of course check the Frequently Asked Questions list, in case your issue is a commonly asked one.

Dejal year in review: 2022

As we start a new year, let’s review what happened with the Dejal apps in 2022:

Time Out icon Time Out

My popular break reminder tool, Time Out, had a significant update in 2022, to version 2.9, adding a status message in the sidebar to indicate why a break was skipped etc, the ability to schedule and exclude breaks using calendar events, support for Monterey focus, an option to hide the Pause function, new break options to pause or reset an individual break, and much more. It finished the year at version 2.9.1.

Simon icon Simon

My pro app to monitor websites and servers for changes and failures, Simon, had a feature update, to version 5.1. This added the ability to disable rendering a Web Page test, the addition of an automatic data backup, support for macOS Ventura, updated example tests, and several other improvements and fixes.

Pack icon Pack

Pack, a simple iPhone app to make it easy to pack for trips, didn’t have any updates in 2022. Now that I take my home with me when I travel, I rarely need to pack suitcases anymore. So I’m unlikely to update it, though I hope Apple leaves it available. If they eventually decide to remove it due to lack of updates, I’ll have a tough decision on whether to do an update, or discontinue it.

Date Stamp icon Date Stamp

Date Stamp, an iMessage app to provide customizable date stamp stickers, also didn’t have any changes. Since few people seem to use iMessage stickers anymore, I’m unlikely to update this, though I still think it was a fun concept, and turned out really well.

Date Stamp icon New Apps

I also have another couple of new apps in various stages of development. More about those below.

Consulting

Dejal also produces macOS and iOS apps for other companies, under the banner of Dejal Consulting.

SheetPlanner icon SheetPlanner

SheetPlanner is a pro-level outliner, planner, todo, calendar, and more. I spent 2022 working on an iPad edition of the app, plus work on a new kanban board view in version 4.0, both still in development.

NewsBlur icon NewsBlur

I have also continued to work on the iOS client for NewsBlur, a popular RSS reader. It recently had a big update with a new design and lots of other improvements.

I am currently fully booked up for the next several months at least, but am always interested in talking with potential new clients. If you have a macOS or iOS project you’d like help with (or a custom Simon enhancement), check out my consulting page for more information.

So how’d 2022 go?

The expected update of Time Out to version 2.9 (and 2.9.1) was completed, as was the update of Simon to version 5.1. And I made great progress on my consulting projects, too.

I mentioned a couple of new projects I was noodling on. One is on the back burner, but the other has had significant progress, and I’m using it every day.

What’s next for 2023?

What’s in store for 2023? As mentioned, I’m working on a new app; when not working on my consulting projects, I am concentrating on this new app. It’ll be a few more months before I’ve polished it up for release, but I’m confident that it’ll be this year. I’ve recently updated both Time Out and Simon, so don’t feel too much urgency for their next updates, though I have a lot of stuff planned for Time Out 3.0, so that’ll probably be next. Or I might opt to work on the other new app, since I’m keen to bring that into existence; another app I’d use daily. Scratching one’s own itch is a great motivation for developing an app (that’s how Time Out, Simon, and Pack all came about; Date Stamp was more of a fun idea to catch what could have been a popular new feature on iOS… but sticker apps never really caught on).

I also want to tweak the Dejal website a bit; it still doesn’t support dark mode or responsive design. And I want the new WordPress-based blog to match the style of the rest of the site. Though I’m tempted to farm those out to a web developer; I don’t have time to do it all, or much interest in web technologies.

And on the personal side, my wife and I will continue to explore the country in our motorhome, and blog about it at Sinclair Trails, and post travel timelapses on the YouTube channel (please subscribe!). I hope you’ll follow along there.

Thank you

Thank you and welcome to my new customers, and many thanks to the long-term customers who are still enjoying my apps, and of course my consulting clients. I really appreciate your support.

Simon tip: watching the Yellowstone gate cam

Here’s a fun example of using Simon for a purpose that may not be entirely obvious.

My wife and I had a big trip to Yellowstone National Park coming up, so I was curious about what the traffic was like to get into the park.

Conveniently, Yellowstone has a number of webcams that watch the park, including the west entrance gate, where we’d be entering.

So I thought I could leverage Simon to help me watch it over time — rather than keeping the web page open and watching it throughout the day, I can have Simon capture the webcam images to a local folder, then review at my convenience.

To find the URL of the webcam image, I used Safari’s web inspector:

Inspector

Then I added a custom service to Simon to download the webcam images to a folder:

Simon service script

That uses the curl command line tool to download the image and save to a local folder; the `date -v+1H +%Y%m%d%H%M%S` part of the path outputs the date and time in the format YYMMDDHHMMSS, adding one hour from my local time zone, since Yellowstone was an hour ahead of me at the time.

To schedule the captures, I added a test in Simon that checks once per minute, using that service. No filters or notifiers needed.

That results in a folder in the Finder with files like this:

Finder

I can arrow through them to quickly view them. And I can also do other things, like use the excellent Retrobatch app to convert them to a GIF:

Retrobatch

Click to view an example of the resulting GIF, showing the traffic flow from 06:00 to 18:00 on one day (the GIF is 61 MB, despite being scaled, so might take a moment to load); each frame of the GIF represents one minute, six frames per second:

That seems typical; it gets really busy around 06:30, and eases off around 12:30 every day. So a tip for Yellowstone visitors; enter in the afternoon! Of course, that really only works if you’re staying in the park, since it takes ages to get anywhere in the park. It’s a big place.

If you’re curious, I did several posts about this Yellowstone trip on my Sinclair Trails blog. Check it out!

Secret screenshot tips

[Like other recent posts, this is an updated repost of an older post from the previous Dejal blog; here’s the original in the web archive for comparison.]

I take a lot of screenshots while documenting my apps, and for my personal Sinclair Trails blog. While I’ve used third-party tools in the past, Apple’s built-in screenshot tools work really well.

The simplest is the whole-screen screenshot hotkey. Pressing ⇧⌘3 (Shift-Command-3) will save a PNG image of the whole screen (or multiple pictures if you have multiple screens) to the Desktop. (You can change the hotkey via the System Settings ▸ Keyboard ▸ Keyboard Shortcuts ▸ Screenshots options.)

Perhaps slightly less well known is ⌃⇧⌘3 (Control-Shift-Command-3), which saves the screenshot onto the Clipboard. Very handy for pasting into emails and such.

The one I find most useful is ⇧⌘4, though. This displays crosshairs with a coordinate display, and when you click-and-drag out a selection, the coordinates change to the selection size. Very handy. This saves the selected area to a PNG file.

Similarly, ⌃⇧⌘4 saves a selected region to the Clipboard.

These selection screenshot options are even more flexible than that, though. After invoking them, but before dragging a selection, you can press the Spacebar to highlight the window under the crosshairs. Clicking will then take a shot of that window, including the border.

While dragging a selection, there are more options. You can hold the (Shift) key to constrain one axis — to keep the height the same while adjusting the width, or vice versa.

You can also hold the (Option) key to adjust the size around the center point, instead of from the point where you started dragging.

And you can hold the Spacebar in selection mode to reposition the whole selection, keeping the size the same. Very handy.

And you can cancel the screenshot simply by pressing Escape. This can be useful on occasions other than just changing your mind: you can use the screenshot tool as a ruler, measuring the number of pixels of an object by dragging out a selection and reading the size display from the crosshairs, then hit Escape to exit without taking a shot.

Finally, ⌃⇧⌘5 presents an interactive panel that lets you choose between capturing the whole screen, a window, or a selection, or even recording the contents of a window or selection to a video, plus options of where to save it, a delay timer, and more.

Very useful. If anyone knows of any other tricks with the screenshot tools, please let me know!