Why are you trying to lock mirc and your script, it's just useless, you can simply disable all /cmd when mirc is locked...
would be good to send a command to mirc that i unlocked it. then i can open mirc as soon as i know the right password is given in the "mirc lock dialog", the only thing i can type in it while locked is just /lock, everything else is disabled.
When mirc is locked, there nothing you can do, there nothing you can type/do, you just have access to the tray icon in order to unlock it.
The idea would be to unlock your script when mirc is unlocked, but i'm not sure with what you're blocking in your script.