2

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.

So far I have written the following

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 < 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

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.

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.

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.

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.

Renaming/deleting keyboard shortcuts is only annoying if the user has a lot of keyboard shortcuts.

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

Disabling the internet would be good, but it would still leave offline distractions (e.g. video games) available.

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?

John Salter
  • 182
  • 10
  • 2
    This sounds like it's getting dangerously close to malware territory. Not saying that you are creating malware, just that it can be dangerous if something goes south and you are unable to taskkill. A safer approach (imo) would to lock the user into a VM, where it can be harder to access files on the physical machine. (+1 because this interested me) – IoCalisto Aug 08 '19 at 18:46
  • Any advice as to how might I implement this in practice? – John Salter Aug 09 '19 at 10:12
  • I'm not the admin, I'm just a regular user looking for a good solution. (that ideally many people can benefit from aswell, ideally one that even my grandma could use without too much assistance) – John Salter Aug 09 '19 at 10:25

1 Answers1

3

While your AutoHotkey solution is a clever way to dissuade people from exiting out of the program, you will never get a true 100% rock solid solution for the following reason: you are logging in with a user that is allowed to do stuff. If you can do stuff, you and others will figure out a clever way around to do it, and no, as amazing as AutoHotkey is, it can't disable the unplugging of a power cord.

On the other hand, yes, you can make the penalties for circumventing the protections increasingly painful (up to the penultimate format c: nuclear option, which I would garner guarantees 99% compliance), but you will always start to run into issues, and still you won't get compliance.

The better solution is to use features that are baked into Windows via Group/Local Security Policies that will limit things. By using a special user with locked down privileges, they physically won't be able to do things because they can't (for ex. you can disable the start menu, power options, sites, etc.).

You really want to lock things down to a single app? Well Windows has a special Kiosk Mode where you literally can -only- have one app running, and you can't get out of it no matter what. There are dozens of special Kiosk Policies that can be applied from removing sign out options from Ctrl-Alt-Delete to Removing Task Manager.

HAL9256
  • 12,384
  • 1
  • 34
  • 46
  • 1
    Is this solution practical for me to write into a program any windows user can download and run, or will it only be useful if I am an administrator for all the people who want to use the program? I'm just a masters student with no special powers over other peoples computers so if the latter is the case I won't be able to make use of your answer. I'm far from an experienced programmer, but i'm willing to put a lot of work into this project if a good outcome can realistically be achieved. Any further advice you have would be greatly appreciated. – John Salter Aug 09 '19 at 10:21