title: How to immunise my antiprocrastination script against logout and shutdown?
body: <p>I'm trying to build a script in autohotkey which will make it annoying for myself and fellow users of the flashcard program Anki from quitting midway through a study session. </p>
  
  <p>So far I have written the following </p>
  
  <pre><code>InputBox, TimeMin, ATTENTION, Enter how long would you like to commit to answering flashcards in minutes.
  TimeMili:=TimeMin*60*1000
  SetTimer, Meh, %TimeMili%
  a:=0
  While a &lt; 1
  {
  IfWinActive User 1 - Anki
      {
      MouseMove,1298, 981
      WinKill Task Manager
      WinMaximize User 1 - Anki
      }
      Else
      {
          WinKill Task Manager
          IfWinExist User 1 - Anki 
              {
              WinActivate User 1 - Anki
              MouseMove,1298, 981
              }
      }
  }
  return
  
  !F4::
  MouseMove 350,350
  return
  
  Meh:
  MsgBox WELL DONE U R NOW FREE
  SetTimer,,OFF
  a:=10
  Return
  
  Lwin::
  Return
  
  Rwin::
  Return
  </code></pre>
  
  <p>This script disables alt + f4, kills taskmanager, maximizes the anki window whenver it is minimized and prevents the mouse coming near the red exit button on the outside of the programs window for a user-defined number of minutes. As anki can be navigated without using the mouse, this selectively impedes procrastinating actions without impeding studying.</p>
  
  <p>The script works pretty well, but it can be overcome by restarting the computer or doing a slow logout via control alt delete (win + L doesn't terminate script). Control alt delete is very hard to disable on modern windows builds, likely as a malware prevention safeguard.</p>
  
  <p>My proposed solution is to have the script perform some annoying action (e.g. deleting all desktop shortcuts) when activated, and to undo that same action when the user-defined time period terminates. I believe this would leave the annoying action unfixed if the user logs out/shuts down/restarts/slow log offs.</p>
  
  <p>I've considered using the script to create another annoying script in the startup folder, but this can be circumvented by just logging out rather than restarting/shutting down. </p>
  
  <p>Renaming/deleting keyboard shortcuts is only annoying if the user has a lot of keyboard shortcuts.</p>
  
  <p>Creating a ton of text files on the desktop and other folders is too easy to reverse and can just be ignored by the user until they have finished procreastinating</p>
  
  <p>Disabling the internet would be good, but it would still leave offline distractions (e.g. video games) available.</p>
  
  <p>How best to go about designing such an action that will temporarilly disable a PC that is trivial and reliable, but timeconsuming and boring to undo? </p>