Use this instead
js code:
function OnEvent_Initialize(MessengerStart) {
if (Messenger.MyStatus < STATUS_INVISIBLE) return false;
StartDetach();
}
function OnEvent_SigninReady(sEmail) {
OnEvent_Initialize(true);
}
The reason this is happening is because of the following:
When the script is started and no one is logged in the Messenger object isn't populated completely. By that I mean Messenger.MyEmail doesn't exist etc. When your script calls StartDetatch() you are trying to read the registry but because Messenger.MyEmail doesn't exist yet it fails. By checking if the user is logged in you can prevent this from happening. By adding the function OnEvent_SigninReady this is called when the entire login process is completed and the contact list is fully gathered from the servers.