title: Best way for AutoHotkey v2 to send `Win+x`, `u`, `s` sequence
body: <p>With AutoHotkey v2 I'm trying to put my computer to sleep using the sequence <code>Win+x</code> (to bring up the quick links menu), <code>u</code> (for &quot;Shutdown…&quot;), <code>s</code> (for &quot;Sleep&quot;). (If you know a better way to put the computer to sleep let me know, but this has been discussed extensively in other questions, and the recommended approach puts the computer into hibernate on my machine, not sleep, as explained elsewhere. So let's just stick with this scenario.)</p>
  <p>Let's say I want to map this sequence to <code>Win+z</code> (for &quot;zzzzzzz&quot; for sleeping). This does not work:</p>
  <pre><code>#z::
  {
    SendEvent &quot;#xus&quot;
  }
  </code></pre>
  <p>This does not work either:</p>
  <pre><code>#z::
  {
    SendEvent &quot;#x&quot;
    SendEvent &quot;u&quot;
    SendEvent &quot;s&quot;
  }
  </code></pre>
  <p>This is the only approach that seems to work, sort of:</p>
  <pre><code>#z::
  {
    SendEvent &quot;#x u s&quot;
  }
  </code></pre>
  <p>It seems sort of finicky and doesn't always work. Sometimes it makes a system sound, as if an incorrect key was pressed. Moreover I don't know what the spaces mean: is AutoHotkey sending spaces, or is that merely a separator between keys to send? I used it by trial-and-error, and could find no documentation on what spaces even mean for AutoHotkey v2.</p>
  <p>What's the best way to send the <code>Win+x</code>, <code>u</code>, <code>s</code> sequence in AutoHotkey v2 to achieve my goal of putting the computer to sleep via a &quot;sleep&quot; menu? (If there is a better, more easily achievable &quot;sleep&quot; menu I'd be interesting in knowing that as well.)</p>