Start Recording Selected Portion of Screen

I'm trying to use KM to start recording a portion of my screen as a sub-macro.

I have a mostly-working macro that just simulates a user hitting cmd-shift-5 and clicking on the Record button, but every once in a while, it fails.

So I'm trying to redo this with screencapture (and yes, I have seen this tip)

But now what happens is, when the main macro activates my recordScreen submacro, the submacro won't release control until the screen recording is done, which defeats the whole purpose.

I've tried doing screencapture as both am Execute Shell Script, and indirectly as an AppleScript, but neither way works the way I want it to.

What I want to do is:

  1. the main macro runs
  2. the main macro executes the "recordScreen" submacro
  3. the main macro continues to run, and the results are captured as a video
  4. the main macro will stop the screencapture with a cmd-ctrl-esc keystroke.

Is there a way to do this?

record screen.kmmacros (21 KB)

Display-Macro-Image

You really need an interactive session -- easiest way is to spawn a new Terminal window and run the command from that. The Terminal session is then running asynchronously, so your macro will continue once the AppleScript completes.

This demo will pop a new window at the top-left of your screen (well away from the area you want to capture), start the screen capture, make a new TextEdit doc and type into it, then end the capturing. You probably don't need the second delay in the AppleScript but I've left it in there, commented out, in case you do.

There's always a delay before screencapture starts recording, hence the 2 second pause.

Screen Cap Demo.kmmacros (6.5 KB)

Image

2 Likes

That works. Thanks!