First of all, welcome everybody on the new AHK forum, nice to meet you again!
I have a problem with locking my CD drive. I want to disable it so it won't open when I accidentally press the button.
I have a simple AHK script running always in the background. It has some simple keyboard fixes, nothing serious. It runs automatically on a system startup via a shortcut in:
C:\Users\Me\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Now i want to add there an option to automatically lock my drive on a system startup.
I changed a tray menu and when I press it, it works like magic.
But it doesn't work when I add this line in the main code (not in a menu).
Can someone help me or point me in some direction?
Thanks in advance for your help.
Code: Select all
;
; AutoHotkey Version: 1.1.25.01
; Language: English/Polish
; Platform: Win7
; Author: mauritius @ AHK forum
;
#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.
FileEncoding, UTF-8
#MaxMem 1024
Menu, Tray, NoStandard
Menu, Tray, Add, Pause Script, PauseScript
Menu, Tray, Add
Menu, Tray, Add, Lock CD, LockCD
Menu, Tray, Add, Unlock CD, UnLockCD
Menu, Tray, Add
Menu, Tray, Add, Exit
Sleep 5 * 60 * 1000 ;wait 5 minutes
Drive, Lock, F: ;it doesn't work here
Return
PauseScript:
Pause, Toggle
return
LockCD:
Drive, Lock, F: ;here it works
return
UnLockCD:
Drive, Unlock, F:
return
Exit:
ExitApp
return