title: Cursor disappears in screen recordings after typing into text field using Quartz-based scripts
body: <p>I'm seeking clarity on a problem I am encountering while building a semi-automated screencasting &amp; video encoding pipeline. A solid technique for addressing it would be lovely as well :-)</p>
  
  <h2>The problem</h2>
  
  <p>The setup: a Quartz-based + Applescript library enacts a screencast script that triggers screenrecording in an application like Quicktime, interacts with a website, then afterwards exports the screenrecording to a target location. </p>
  
  <p>This pipeline works. With one exception: the mouse cursor disappears in the resulting screen recording after using either the Quartz-based library or Applescript to type into a text field. Note that when I watch the screencast acted out live, I see the mouse cursor the whole time. </p>
  
  <h2>Restoring the cursor</h2>
  
  <p>I have found some techniques that restore the mouse cursor while the screencast is being enacted:</p>
  
  <ul>
  <li>Manually type something after the input text box loses focus (doesn't work programmatically)</li>
  <li>Switching to a different application via cmd-tab (works manually and programmatically via Applescript)</li>
  <li>Launching a new application with Applescript, but only if it comes to the foreground (the mechanism for why this works is probably the same as switching to a different application)</li>
  <li>Doing a right-click to trigger a context menu to appear. Can be done programmatically, and can be within the same application. </li>
  </ul>
  
  <p>My temporary workaround is to simply issue two quick cmd-tab commands via Applescript after every time that the script types text. This works alright, though it does leave some minor artifacts in the resulting screencast.  </p>
  
  <h2>Details of setup &amp; experiments</h2>
  
  <p>A few more details about the technology I'm using here. </p>
  
  <ul>
  <li>The machine is a 2013 MBP running Yosemite</li>
  <li>I have used two independent Quartz-based libraries for simulating user actions: <a href="https://github.com/joseph/osxautomation" rel="nofollow">osxautomation</a> and <a href="https://github.com/BlueM/cliclick" rel="nofollow">cliclick</a>, both of which exhibit the same issue. </li>
  <li>I have used three different techniques for doing the screenrecoding: Quicktime, Camtasia, and ffmpeg (ffmpeg -f avfoundation -i "1:0" out.avi). These all probably use AV Foundation under the hood, though I'm not sure about that. </li>
  <li>I have used Safari, Firefox, and Chrome as the target browser for the interactions</li>
  </ul>
  
  <p>Any insights into what might be causing the problem and/or ideas for a better workaround would be appreciated!!</p>
  
  <p>p.s. I'm not familiar with most of the technologies involved, like Quartz and AV Foundation, so my apologies in advance if my description is fundamentally flawed, or if I've tagged a technology that doesn't bear at all upon the problem.</p>