; AutoHotkey Version: 1.x ; Language: English ; Platform: Only tested on WinXP ; Author: Kocoro { Koco@MyKocoro.com ) ; ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #NoTrayIcon ;Hides the tray icon ; This is a small script that opens up a message box when you press alt-gr, if you press yes, then it opens up another message box, which if left open for 30 minutes, will run a sound file and lock your computer. (You could also set it to play a video or open a stream if you so wished) The script remains hidden unless the alarm window is open. Once you close the second msgbox, the alarm disables itself again. ; For changing the hotkey: # = Windows Key, ^ = Ctrl key, ! = Alt key, LControl & RAlt = The Alt-Gr key, if your keyboard has one. ; For example, #^z:: Send {Delete} Would press the delete key when you press the Window key, the Ctrl key and z all at the same time. ; CapsLock:: Send {Enter} Would disable your capslock and send the enter key instead. ; You can set a login-password for your computer in Control Panel > User Accounts. LControl & RAlt:: ; The hotkey, change as desired. See above for examples. Menu, Tray, Icon MsgBox, 4, Alarm Window,Set Alarm? IfMsgBox, Yes { EnvAdd, var1, 30, minutes ; This affects the time shown in the second msgbox. Change the 30 to a time of your choice. FormatTime, OutputVar, %var1%, HH:mm SetTimer, ChangeButtonNames, 1 MsgBox, 0, Alarm is now set,This alarm will go off at %OutputVar%, 1800 ; 1800 seconds = 30 minutes. Change to however long you want. (1500 = 25 minutes, 900 = 15) IfMsgBox, Timeout { Run, D:\Program Files\1st Clock\media\sounds\Outline - 05 - Shotgun.mp3 ; Change this to a file of your choice. var1= Menu, Tray, NoIcon Sleep 100 Send #l ; This presses the Windows Key + L. If you're on Windows and have a password set, this locks the computer until you type it in. ; Winamp won't respond to media keys as long as it's locked, so it can make the alarm difficult to turn off while still asleep. Exit } IfMsgBox, OK { var1= Menu, Tray, NoIcon Exit } } IfMsgBox, No { Menu, Tray, NoIcon Exit } ChangeButtonNames: IfWinNotExist, Alarm is now set Return SetTimer, ChangeButtonNames, Off ControlSetText, Button1, Disable, Alarm is now set ahk_class #32770 Return