js code:
var regPath;
var twitterusername;
var twittername;
var twittertimer;
function OnEvent_Initialize ( )
{
if ( Messenger.MyStatus < STATUS_INVISIBILE ) return false;
regPath = MsgPlus.ScriptRegPath + Messenger.MyUserId;
/*
this will never work and will always return false.
Firstly: twittertimer is undefined. You have not assigned a value to it yet.
Secondly load settings is called after the check which will never get called because of the above statement
Thirdly you are performing a bitwise comparison which means the types and value have to match.
In this instance because WScript.Shell has no knowledge of different variable types it is loaded as a string.
A string and a number do not match regardless if it is "0" and 0 because their types are different.
Forthly is this the entire script? If so Shell is not declared anywhere...
*/
if (twittertimer === 0) return false;
loadsettings();
MsgPlus.AddTimer("nextUpdate", twittertimer*60*1000);
}
function OnEvent_SigninReady ( sEmail ) {
OnEvent_Initialize ( );
}
function loadsettings(){
twittername = Shell.RegRead(regPath + "\\twitterusername");
twittertimer= Shell.RegRead(regPath + "\\twittertimer");
}
I will post an update in a moment which should work.
js code:
var twitterusername;
var twittername;
var twittertimer;
function OnEvent_Initialize ( )
{
if ( Messenger.MyStatus < STATUS_INVISIBILE ) return false;
loadsettings();
if ( twittertimer == 0 ) return false;
MsgPlus.AddTimer( 'nextUpdate', twittertimer*60*1000 );
}
function OnEvent_SigninReady ( sEmail )
{
OnEvent_Initialize ( );
}
function loadsettings ( )
{
var Shell = new ActiveXObject ( 'WScript.Shell' );
var regPath = MsgPlus.ScriptRegPath + Messenger.MyUserId;
twittername = Shell.RegRead(regPath + '\\twitterusername');
twittertimer = Shell.RegRead(regPath + '\\twittertimer');
}