whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
RE: my first script any help would be appriciated..
quote: Originally posted by CookieRevised
This will not work in all circumstances!
You have no control with this over the other scripts. Especially when you're executing multiple Messengers quickly after eachother, delays in loading (and loading Plus!, skins and scripts) will start to happen. This makes that another instance of this script might still be running (or still need to start running) by the time the 'main' script finishes. In other words, the 'main' script will remove the registry check before one of those other scripts get executed, and you're back to square one...
So, do not use a single boolean, instead you must keep track of what accounts have been signed in, or rather in the process of signing in because the actual sign in might fail.
How about this?
js code: // add to the top
var shell = new ActiveXObject("WScript.Shell");
// ...
function OnEvent_Initialize(MessengerStart)
{
try {
// value exists, check the count, write the new one
var Count = shell.RegRead(MsgPlus.ScriptRegPath + "\\RunCount");
shell.RegWrite(MsgPlus.ScriptRegPath + "\\RunCount", Count--, "REG_DWORD");
if (Count === 0) {
// we're finished, delete the (correct) key :)
shell.RegDelete(MsgPlus.ScriptRegPath + "\\RunCount");
}
return false;
} catch (error) {
// not yet running, make a registry value, continue
shell.RegWrite(MsgPlus.ScriptRegPath + "\\RunCount", emailList.length, "REG_DWORD");
}
// Check if there's anything to be done
if(emailList.length > 0) {
MsgPlus.AddTimer('windowDelayer', delayOpenWnd);
}
}
// ...
This post was edited on 07-03-2010 at 12:15 PM by whiz.
|
|