{"id":1846,"date":"2012-06-21T10:20:18","date_gmt":"2012-06-21T10:20:18","guid":{"rendered":"http:\/\/www.mjtnet.com\/blog\/?p=1846"},"modified":"2012-06-21T10:20:18","modified_gmt":"2012-06-21T10:20:18","slug":"why-does-my-macro-stop-working-when-windows-is-lockedlogged-out","status":"publish","type":"post","link":"https:\/\/www.mjtnet.com\/blog\/2012\/06\/21\/why-does-my-macro-stop-working-when-windows-is-lockedlogged-out\/","title":{"rendered":"Why does my macro stop working when Windows is locked\/logged out?"},"content":{"rendered":"<p>Despite our <a href=\"http:\/\/www.mjtnet.com\/faqs.htm\">FAQs<\/a> we get asked a version of the following question at least once a week:<\/p>\n<blockquote><p>&#8220;I just wrote my first macro with <a href=\"http:\/\/www.mjtnet.com\/macro_scheduler.htm\">Macro Scheduler<\/a> and it works great but if I lock Windows it stops working, is this a limitation of the trial version&#8221;.<\/p><\/blockquote>\n<p>My most recent answer to this was as follows:<\/p>\n<p>No, it&#8217;s a limitation of how Windows works.  I assume that your script needs to simulate a user (i.e. send keystrokes and\/or mouse events and needs to &#8220;see&#8221; windows).<\/p>\n<p>When Windows is locked or logged out *windows cease to exist* and *there is no input console*.  Ergo you cannot simulate a user when Windows is locked or logged out.  There is nothing anyone can do about this as that is simply the way Windows works.<\/p>\n<p>A more detailed and technical explanation of this can be found here:<\/p>\n<p><a href=\"http:\/\/www.mjtnet.com\/msfaq171.htm\">http:\/\/www.mjtnet.com\/msfaq171.htm<\/a><br \/>\n<a href=\"http:\/\/www.mjtnet.com\/msfaq17.htm\">http:\/\/www.mjtnet.com\/msfaq17.htm<\/a><\/p>\n<p>Think about it for a second &#8211; can YOU use Windows when it is locked or logged out?  Of course not.  But most people don&#8217;t realise that when you lock or log out of Windows the user&#8217;s &#8220;window station&#8221; literally no longer exists, and applications no longer have UIs.  While a process may exist, it has no windows and UI objects simply aren&#8217;t there.  So there&#8217;s nothing to interact with.  Furthermore the only thing that has keyboard\/mouse focus is the security console.  So you cannot send mouse\/keyboard events.<\/p>\n<p>So in short you cannot automate user interfaces when Windows is locked or logged out.  <\/p>\n<p>Command line tasks, and tasks that do not need to access a user interface (interact with windows) may still be possible assuming they do not require logged on credentials.<\/p>\n<p>The only solutions are:<\/p>\n<p>1. Leave Windows logged in<br \/>\n2. If you are running Vista\/Windows7\/2008 Server you can use <a href=\"http:\/\/www.mjtnet.com\/autologon.htm\">Macro Scheduler&#8217;s AutoLogon system<\/a>.  See under Macro Properties.  This will log Windows back in on schedule, run the macro, and then log out again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Despite our FAQs we get asked a version of the following question at least once a week: &#8220;I just wrote my first macro with Macro Scheduler and it works great but if I lock Windows it stops working, is this a limitation of the trial version&#8221;. My most recent answer to this was as follows: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/1846"}],"collection":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/comments?post=1846"}],"version-history":[{"count":3,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/1846\/revisions"}],"predecessor-version":[{"id":1849,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/posts\/1846\/revisions\/1849"}],"wp:attachment":[{"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/media?parent=1846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/categories?post=1846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mjtnet.com\/blog\/wp-json\/wp\/v2\/tags?post=1846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}