Forum Home
Press F1
 
Thread ID: 93153 2008-09-05 08:13:00 Programmers wanted pcuser42 (130) Press F1
Post ID Timestamp Content User
702755 2008-09-06 05:52:00 Neither the tablet PC nor the desktop's keyboard have a calculator button. :D

Although the mousepad has a calculator. :xmouth:
pcuser42 (130)
702756 2008-09-07 05:03:00 Here's a basic AutoHotkey (http://www.autohotkey.com/) script that would work but it could be improved on immensely, it doesn't lock the computer down but you need to answer correctly to remove the window. It runs in the background and asks a question every seven minutes. As you can see, Task Manager is forced to close if found open. To quit the app just go Ctrl+Shift+Esc and use "hello" for the password.

Tweak and compile as you like, here's one I compiled earlier (pipi.co.nz).


#NoTrayIcon
#SingleInstance Force

SetTimer, CloseTaskmgr, 100
SetTimer, AskQuestion, 420000

AskQuestion:
Random, intOne, 3, 12
Random, intTwo, 3, 12
Answer := intOne * intTwo

Gui +Owner +AlwaysOnTop -Caption
Gui, Font, S30 CDefault, Verdana
Gui, Color, FFFFCC
Gui, Add, Text, x10 y20 w60 h50 Center, %intOne%
Gui, Add, Text, x80 yp w30 hp Center, ×
Gui, Add, Text, x120 yp w60 hp Center, %intTwo%
Gui, Add, Text, x190 yp w30 hp Center, =
Gui, Add, Edit, x230 yp w120 hp Number Limit3 Center vGuess
Gui, Add, Button, x360 yp w120 hp Default, OK
Gui, Show, Equation, Time for some math
Return

GuiClose:
ButtonOK:
Gui, Submit, NoHide

If Guess = %Answer%
GoSub, CorrectAnswer
Else
ControlFocus, Edit1
ControlSetText, Edit1
Return

Return
Return

CorrectAnswer:
Gui, Destroy
MsgBox, 64, Well done, Your answer was correct, 4
Return

CloseTaskmgr:
SetTimer, CloseTaskmgr, off
Process, Wait, taskmgr.exe, 4
Process, Close, taskmgr.exe
SetTimer, CloseTaskmgr, on
Return

^+Esc::
InputBox, password,Password,,hide,200,100,,100
If password = hello
ExitApp
Return
sal (67)
702757 2008-09-08 04:30:00 I'm trying it now. Thanks for that. :) pcuser42 (130)
702758 2008-09-08 06:15:00 Perfect, almost. I've tweaked it a bit to change the password and actually make them enter one to close it. :)

Now to figure out how to lock the computer as well. :D
pcuser42 (130)
702759 2008-09-08 22:19:00 You could even get tricky and increment/decrement gap between equations, with a floor/ceiling, say -remove 30 seconds for each incorrect answer and add 30 seconds for each correct answer, tops 15 mins. sal (67)
702760 2008-09-08 22:42:00 Thing is, he spends a lot of time on the computer

Which is why he isn't learning his maths.
How about, he answers correctly a certain number of maths questions (and some study) and then he is allowed on the PC. But not before.
pctek (84)
1 2 3