Error: unknown (code: -2147418113) - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Error: unknown (code: -2147418113) (/showthread.php?tid=90420)
Error: unknown (code: -2147418113) by Dr Nick on 04-29-2009 at 10:38 AM
Im making my first script (and I keep adding to it when i find out how to do something new...)
Ive just started to get this error, and cant see why... Here's the debugging:
code: Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
Error: unknown (code: -2147418113)
File: Status Checker.js. Line: 94.
Function OnEvent_Timer returned an error. Code: -2147352567
Function called: OnEvent_Signin
Function called: OnGetScriptMenu
Function called: OnEvent_Uninitialize
Script has been stopped
Heres the (majority of) the code:
code: var originalPSM;
var originalPSM1;
var idleSeconds;
var isIdle;
var isBusy;
var PSMnumber;
var PSM1number;
var PSMtype;
var seconds = 60;
var allowed = 1;
function OnEvent_Initialize(MessengerStart)
{
idleSeconds = 0;
isIdle = false;
isBusy = false;
MsgPlus.AddTimer('rotate', seconds * 1000);
}
function OnEvent_Signin(sEmail)
{
MsgPlus.DisplayToast("Status Checker,","Status Checker Running...");
}
function OnEvent_Uninitialize(MessengerExit)
{
}
function updateMessage() {
if(allowed==1) {
if(PSMtype==1) {
if(PSMnumber==1) {
originalPSM = "PM1";
PSMnumber=2;
} else if(PSMnumber==2) {
originalPSM = "PM2";
PSMnumber=3;
} else {
originalPSM = "PM3";
PSMnumber=1;
}
Messenger.MyPersonalMessage = originalPSM;
PSMtype=2;
} else {
if(PSM1number==1) {
originalPSM1 = "PM1 - type 2";
PSM1number=2;
} else {
originalPSM1 = "PM2 - type 2";
PSM1number=1;
}
Messenger.MyPersonalMessage = originalPSM1; ///------This is line 94 (causing the error)
PSMtype=1;
}
}
}
function OnEvent_MyStatusChange(NewStatus) {
if(allowed==1) {
if( NewStatus == 7 || NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! 0hrs:0mins:0secs";
MsgPlus.AddTimer( "incIdle", 1000 );
MsgPlus.AddTimer( "updateDisplay", 6000 );
isIdle = true;
isBusy = false;
MsgPlus.DisplayToast("Status Checker","Idle/Away State Activated");
} else if(NewStatus == 4) {
Messenger.MyPersonalMessage = "Text me! I'm in a full screen app and msngr alerts are off! ";
isBusy = true;
isIdle = false;
idleSeconds = 0;
MsgPlus.DisplayToast("Status Checker","Busy State Activated");
} else {
isIdle = false;
isBusy = false;
idleSeconds = 0;
updateMessage();
MsgPlus.DisplayToast("Status Checker","Normal State Activated");
MsgPlus.AddTimer('rotate', seconds * 1000);
}
}
}
function OnEvent_Timer(sTimerId)
{
if( isIdle == false && isBusy == false) {
updateMessage();
MsgPlus.AddTimer('rotate', seconds * 1000);
return 0;
} else if( sTimerId == "incIdle" ) {
if(isIdle==true) {
idleSeconds ++;
MsgPlus.AddTimer( "incIdle", 1000 );
}
}
else if( sTimerId == "updateDisplay" ) {
if(isIdle==true) {
var cIdleSeconds = idleSeconds;
var idleHours = 0;
var idleMinutes = 0;
while( cIdleSeconds > 59 ) {
cIdleSeconds -= 60;
idleMinutes ++;
}
while( idleMinutes > 59 ) {
idleMinutes -= 60;
idleHours ++;
}
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! "+idleHours+"hrs:"+idleMinutes+"mins:"+cIdleSeconds+"secs";
MsgPlus.AddTimer( "updateDisplay", 6000 );
}
}
}
function OnGetScriptCommands(){
var oCommand = new Commands();
with (oCommand) {
AddCommand('pmrotate', 'Rotate your Personal Message');
if(allowed==1) {
AddCommand('pmtoggle', 'Disable Automatic PM Changes');
} else if(allowed==0) {
AddCommand('pmtoggle', 'Enable Automatic PM Changes');
}
}
return oCommand.ExportCommands();
}
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
var _command = RegExp.$1.toLowerCase();
var _param = RegExp.$2;
switch (_command) {
case 'pmrotate':
if ( _param !== '' ) {
seconds = _param;
} else {
updateMessage();
}
return '';
break;
case 'pmtoggle':
if(allowed==1) {
allowed=0;
MsgPlus.DisplayToast("Status Checker","Disabled");
} else if(allowed==0) {
allowed=1;
MsgPlus.DisplayToast("Status Checker","Enabled");
}
return '';
break;
}
}
}
function OnGetScriptMenu(nLocation){
var oMenu = new ScriptMenu();
if(allowed==1) {
oMenu.AddItem('/pmtoggle', 'Disable');
} else if(allowed==0) {
oMenu.AddItem('/pmtoggle', 'Enable');
}
oMenu.AddItem('/pmrotate', 'Rotate PM');
return oMenu.ExportMenu();
}
function OnEvent_MenuClicked(sMenuId, nLocation, oChatWnd){
OnEvent_ChatWndSendMessage(oChatWnd, sMenuId);
}
I only took out the parts that I am sure have no significance...
Thanks for the help
The script does not work, until the script is stopped, and re-started again - I dont know why.
Nick
RE: Error: unknown (code: -2147418113) by Dr Nick on 04-29-2009 at 10:47 AM
If you want the full script (with everything, rather than bits cut out) - its attached here as a zip file
Please help soon - I have no idea what i did to cause this - im guessing a typo I cant find?
Thanks
Nick
RE: Error: unknown (code: -2147418113) by matty on 04-29-2009 at 01:11 PM
I made a few changes. Those are highlighted.
js code: var originalPSM;
var originalPSM1;
var idleSeconds;
var isIdle;
var isBusy;
var PSMnumber;
var PSM1number;
>>>var PSMtype = 1;<<<
var seconds = 15;
var allowed = 1;
>>>var aPSMArray [<<<
>>> 1 : 'Growing old is mandatory, growing up is optional',<<<
>>> 2 : 'Tower: "Please report height and position?" - Pilot: "I\'m 5 foot 10 and sitting up front!';<<<
>>> 3 : 'The owner of a \'91 Toyota Camry!';<<<
>>> 4 : 'He who dies with the most toys wins!!!';<<<
>>> 5 : 'You\'d Better Run, Egg!!!';<<<
>>> 6 : '<?php while(!success) { $try++; } ?>';<<<
>>> 7 : 'There are 10 kinds of ppl in this world! One kind know binary, and the other doesn\'t';<<<
>>> 8 : 'There is no "I" in team, but there is an "m" and an "e"!';<<<
>>> 9 : 'Extension Maths is just like doing normal Maths..... TO THE EXTREME!!!';<<<
>>> 10 : 'Never play leapfrog with a unicorn ;)';<<<
>>> 11 : 'One day Wally should wear something different and really screw everyone up';<<<
>>> 12 : 'Parental Controls: Settings used to controls ones parents activity on ones computer.';<<<
>>> 13 : 'Part of being sane, is being a little bit crazy.';<<<
>>> 14 : 'I have noticed that the people who are late are often so much jollier than the people who have to wait for them.';<<<
>>> 15 : 'I believe whatever doesn\'t kill you simply makes you... stranger...';<<<
>>> 16 : 'You haven\'t seen a tree until you\'ve seen its shadow from the sky';<<<
>>> ];<<<
function OnEvent_Initialize(MessengerStart) {
idleSeconds = 0;
isIdle = false;
isBusy = false;
MsgPlus.AddTimer('rotate', seconds * 1000);
}
function OnEvent_Signin(sEmail) { MsgPlus.DisplayToast("Nick,","You're so awesome!"); }
function updateMessage() {
if(allowed==1) {
if(PSMtype==1) {
if (PSMNumber < 16)
>>> originalPSM = aPSMArray[++PSMnumber];<<<
}
else {
originalPSM = "There are only two ways to live your life. One is as though nothing is a miracle. The other is as if everything is.";
PSMnumber=1;
}
Messenger.MyPersonalMessage = originalPSM;
PSMtype=2;
} else {
if(PSM1number==1) {
originalPSM1 = "Nick Has 12.5% Of His (au) License";
PSM1number=2;
} else {
originalPSM1 = "Nick Has 31.5% Of His (ap) License";
PSM1number=1;
}
Messenger.MyPersonalMessage = originalPSM1;
PSMtype=1;
}
}
}
function OnEvent_MyStatusChange(NewStatus) {
if(allowed==1) {
if( NewStatus == 7 || NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! 0hrs:0mins:0secs";
MsgPlus.AddTimer( "incIdle", 1000 );
MsgPlus.AddTimer( "updateDisplay", 6000 );
isIdle = true;
isBusy = false;
//Messenger.MyDisplayPicture = "C:\\Program Files\Messenger Plus! Live\Scripts\StatusDP\DP\offline.jpg";
MsgPlus.DisplayToast("Status Checker","Idle/Away State Activated");
} else if(NewStatus == 4) {
Messenger.MyPersonalMessage = "Text me! I'm in a full screen app and msngr alerts are off! :)";
isBusy = true;
isIdle = false;
idleSeconds = 0;
MsgPlus.DisplayToast("Status Checker","Busy State Activated");
} else {
isIdle = false;
isBusy = false;
idleSeconds = 0;
updateMessage();
MsgPlus.DisplayToast("Status Checker","Normal State Activated");
MsgPlus.AddTimer('rotate', seconds * 1000);
}
}
}
function OnEvent_Timer(sTimerId) {
if( isIdle == false && isBusy == false) {
updateMessage();
MsgPlus.AddTimer('rotate', seconds * 1000);
return 0;
} else if( sTimerId == "incIdle" ) {
if(isIdle==true) {
idleSeconds ++;
MsgPlus.AddTimer( "incIdle", 1000 );
}
}
else if( sTimerId == "updateDisplay" ) {
if(isIdle==true) {
var cIdleSeconds = idleSeconds;
var idleHours = 0;
var idleMinutes = 0;
while( cIdleSeconds > 59 ) {
cIdleSeconds -= 60;
idleMinutes ++;
}
while( idleMinutes > 59 ) {
idleMinutes -= 60;
idleHours ++;
}
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! "+idleHours+"hrs:"+idleMinutes+"mins:"+cIdleSeconds+"secs";
MsgPlus.AddTimer( "updateDisplay", 6000 );
}
}
}
function OnGetScriptCommands(){
var oCommand = new Commands();
with (oCommand) {
AddCommand('pmrotate', 'Rotate your Personal Message');
>>> AddCommand('pmtoggle', (allowed === 1 ? 'Disable' : 'Enable')+' Automatic PM Changes');<<<
}
return oCommand.ExportCommands();
}
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
var _command = RegExp.$1.toLowerCase();
var _param = RegExp.$2;
switch (_command) {
case 'pmrotate':
if ( _param !== '' ) {
seconds = _param;
} else {
updateMessage();
}
return '';
break;
case 'pmtoggle':
if(allowed==1) {
allowed=0;
MsgPlus.DisplayToast("Status Checker","Disabled");
} else if(allowed==0) {
allowed=1;
MsgPlus.DisplayToast("Status Checker","Enabled");
}
return '';
break;
}
}
}
function OnGetScriptMenu(nLocation) {
var oMenu = new ScriptMenu();
>>> with (oMenu) {<<<
>>> AddItem('/pmtoggle', (allowed === 1 ? 'Disable' : 'Enable') );<<<
>>> AddItem('/pmrotate', 'Rotate PM');<<<
>>> }<<<
return oMenu.ExportMenu();
}
function OnEvent_MenuClicked(sMenuId, nLocation, oChatWnd) { OnEvent_ChatWndSendMessage(0, sMenuId); }
RE: Error: unknown (code: -2147418113) by Dr Nick on 04-30-2009 at 11:23 AM
Thanks, made the changes, closed messenger, opened it back up, and i get the same error in the debugger
Also, my PM does not rotate itself like it should.
Any idea's why this is still happening???
Thanks, Nick I knew Id work it out eventually!
I took out the script from the on Initialize part, and put it in the On Signin part, so it wasnt trying to change my PM b4 i signed in...
This solved the problem, thanks for tidying up the script for me Matty!
RE: Error: unknown (code: -2147418113) by Spunky on 04-30-2009 at 12:08 PM
Make sure you use
js code:
function OnEvent_Initialize() {
if ( Messenger.MyStatus > 1) {
OnEvent_SigninReady( Messenger.MyEmail );
}
}
function OnEvent_SigninReady( Email ) {
// Start script here...
}
}
RE: Error: unknown (code: -2147418113) by matty on 04-30-2009 at 12:33 PM
Or the other way around
js code: function OnEvent_Initialize() {
if (Messenger.MyStatus < STATUS_INVISIBLE) return;
// Do stuff here
}
function OnEvent_SigninReady( Email ) { OnEvent_Initialize(); }
Which in my opinion is better because one less function call.
RE: Error: unknown (code: -2147418113) by roflmao456 on 04-30-2009 at 07:41 PM
I think it's better to use a switch or even the Array instead of all those else ifs..
RE: Error: unknown (code: -2147418113) by matty on 04-30-2009 at 08:04 PM
js code: var originalPSM='';
var originalPSM1='';
var idleSeconds=0;
var isIdle=0;
var isBusy=0;
var PSMnumber=0;
var PSM1number=0;
var PSMtype=1;
var seconds=15;
var allowed=1;
var aPSMArray = new Array [
1 : 'Growing old is mandatory, growing up is optional',
2 : 'Tower: "Please report height and position?" - Pilot: "I\'m 5 foot 10 and sitting up front!',
3 : 'The owner of a \'91 Toyota Camry!',
4 : 'He who dies with the most toys wins!!!',
5 : 'You\'d Better Run, Egg!!!',
6 : '<?php while(!success) { $try++; } ?>',
7 : 'There are 10 kinds of ppl in this world! One kind know binary, and the other doesn\'t',
8 : 'There is no "I" in team, but there is an "m" and an "e"!',
9 : 'Extension Maths is just like doing normal Maths..... TO THE EXTREME!!!',
10 : 'Never play leapfrog with a unicorn ;)',
11 : 'One day Wally should wear something different and really screw everyone up',
12 : 'Parental Controls: Settings used to controls ones parents activity on ones computer.',
13 : 'Part of being sane, is being a little bit crazy.',
14 : 'I have noticed that the people who are late are often so much jollier than the people who have to wait for them.',
15 : 'I believe whatever doesn\'t kill you simply makes you... stranger...',
16 : 'You haven\'t seen a tree until you\'ve seen its shadow from the sky'
];
function OnEvent_Initialize(MessengerStart) {
if (Messenger.MyStatus < STATUS_INVISIBLE) return false;
MsgPlus.DisplayToast("Nick,","You're so awesome!");
idleSeconds = 0;
isIdle = false;
isBusy = false;
MsgPlus.AddTimer('rotate', seconds * 1000);
}
function OnEvent_SigninReady( sEmail ) { OnEvent_Initialize(); }
function updateMessage() {
if(allowed==1 && PSMtype==1) {
if (PSMNumber < 16) {
originalPSM = aPSMArray[++PSMnumber];
}
else {
originalPSM = "There are only two ways to live your life. One is as though nothing is a miracle. The other is as if everything is.";
PSMnumber=1;
}
Messenger.MyPersonalMessage = originalPSM;
PSMtype=2;
} else {
if(PSM1number==1) {
originalPSM1 = "Nick Has 12.5% Of His (au) License";
PSM1number=2;
} else {
originalPSM1 = "Nick Has 31.5% Of His (ap) License";
PSM1number=1;
}
Messenger.MyPersonalMessage = originalPSM1;
PSMtype=1;
}
}
function OnEvent_MyStatusChange(NewStatus) {
if(allowed==1) {
if( NewStatus == 7 || NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! 0hrs:0mins:0secs";
MsgPlus.AddTimer( "incIdle", 1000 );
MsgPlus.AddTimer( "updateDisplay", 6000 );
isIdle = true;
isBusy = false;
//Messenger.MyDisplayPicture = "C:\\Program Files\Messenger Plus! Live\Scripts\StatusDP\DP\offline.jpg";
MsgPlus.DisplayToast("Status Checker","Idle/Away State Activated");
} else if(NewStatus == 4) {
Messenger.MyPersonalMessage = "Text me! I'm in a full screen app and msngr alerts are off! :)";
isBusy = true;
isIdle = false;
idleSeconds = 0;
MsgPlus.DisplayToast("Status Checker","Busy State Activated");
} else {
isIdle = false;
isBusy = false;
idleSeconds = 0;
updateMessage();
MsgPlus.DisplayToast("Status Checker","Normal State Activated");
MsgPlus.AddTimer('rotate', seconds * 1000);
}
}
}
function OnEvent_Timer(sTimerId) {
if( isIdle == false && isBusy == false) {
updateMessage();
MsgPlus.AddTimer('rotate', seconds * 1000);
return 0;
} else if( sTimerId == "incIdle" ) {
if(isIdle==true) {
idleSeconds ++;
MsgPlus.AddTimer( "incIdle", 1000 );
}
}
else if( sTimerId == "updateDisplay" ) {
if(isIdle==true) {
var cIdleSeconds = idleSeconds;
var idleHours = 0;
var idleMinutes = 0;
while( cIdleSeconds > 59 ) {
cIdleSeconds -= 60;
idleMinutes ++;
}
while( idleMinutes > 59 ) {
idleMinutes -= 60;
idleHours ++;
}
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! "+idleHours+"hrs:"+idleMinutes+"mins:"+cIdleSeconds+"secs";
MsgPlus.AddTimer( "updateDisplay", 6000 );
}
}
}
function OnGetScriptCommands(){
var oCommand = new Commands();
with (oCommand) {
AddCommand('pmrotate', 'Rotate your Personal Message');
AddCommand('pmtoggle', (allowed === 1 ? 'Disable' : 'Enable')+' Automatic PM Changes'); }
return oCommand.ExportCommands();
}
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
var _command = RegExp.$1.toLowerCase();
var _param = RegExp.$2;
switch (_command) {
case 'pmrotate':
if ( _param !== '' ) {
seconds = _param;
} else {
updateMessage();
}
return '';
break;
case 'pmtoggle':
if(allowed==1) {
allowed=0;
MsgPlus.DisplayToast("Status Checker","Disabled");
} else if(allowed==0) {
allowed=1;
MsgPlus.DisplayToast("Status Checker","Enabled");
}
return '';
break;
}
}
}
function OnGetScriptMenu(nLocation) {
var oMenu = new ScriptMenu();
with (oMenu) {
AddItem('/pmtoggle', (allowed === 1 ? 'Disable' : 'Enable') );
AddItem('/pmrotate', 'Rotate PM');
}
return oMenu.ExportMenu();
}
function OnEvent_MenuClicked(sMenuId, nLocation, oChatWnd) { OnEvent_ChatWndSendMessage(0, sMenuId); }
RE: Error: unknown (code: -2147418113) by Dr Nick on 05-01-2009 at 06:21 AM
Thanks guys...
I was planning on that in the near future
While we're at it, is there a way to keep all the PSM's stored in a file, in a way that under the scripts menu, you can open a dialogue which can be used to add/ remove PSM's of each type?
Thanks,
Nick
RE: Error: unknown (code: -2147418113) by Dr Nick on 05-01-2009 at 07:05 AM
Made a few changes to the script - it wasn't working properly, so i fixed it
javascript code: var originalPSM='';
var originalPSM1='';
var idleSeconds=0;
var isIdle=0;
var isBusy=0;
var PSMnumber=0;
var PSM1number=0;
var PSMtype=1;
var seconds=3;
var allowed=1;
var aPSMArray = new Array();
aPSMArray[1]='Tower: "Please report height and position?" - Pilot: "I\'m 5 foot 10 and sitting up front!';
aPSMArray[2]='The owner of a \'91 Toyota Camry!';
aPSMArray[3]='He who dies with the most toys wins!!!';
aPSMArray[4]='You\'d Better Run, Egg!!!';
aPSMArray[5]='<?php while(!success) { $try++; } ?>';
aPSMArray[6]='There are 10 kinds of ppl in this world! One kind know binary, and the other doesn\'t';
aPSMArray[7]='There is no "I" in team, but there is an "m" and an "e"!';
aPSMArray[8]='Extension Maths is just like doing normal Maths..... TO THE EXTREME!!!';
aPSMArray[9]='Never play leapfrog with a unicorn ;)';
aPSMArray[10]='One day Wally should wear something different and really screw everyone up';
aPSMArray[11]='Parental Controls: Settings used to controls ones parents activity on ones computer.';
aPSMArray[12]='Part of being sane, is being a little bit crazy.';
aPSMArray[13]='I have noticed that the people who are late are often so much jollier than the people who have to wait for them.';
aPSMArray[14]='I believe whatever doesn\'t kill you simply makes you... stranger...';
aPSMArray[15]='You haven\'t seen a tree until you\'ve seen its shadow from the sky';
aPSMArray[16]='There are only two ways to live your life. One is as though nothing is a miracle. The other is as if everything is.';
aPSMArray[17]='Growing old is mandatory, growing up is optional';
var bPSMArray = new Array();
bPSMArray[1]='Nick Has 18% Of His (au) License';
bPSMArray[2]='Nick Has 31.5% Of His (ap) License';
function OnEvent_Initialize(MessengerStart) {
if (Messenger.MyStatus < STATUS_INVISIBLE) return false;
MsgPlus.DisplayToast("Nick,","You're so awesome!");
idleSeconds = 0;
isIdle = false;
isBusy = false;
MsgPlus.AddTimer('rotate', seconds * 1000);
}
function OnEvent_SigninReady( sEmail ) { OnEvent_Initialize(); }
function updateMessage() {
if(allowed==1) {
if(PSMtype==1) {
if (PSMnumber < 17) {
originalPSM = aPSMArray[++PSMnumber];
if(PSMnumber==17) {
PSMnumber=0;
}
}
PSMtype=2;
} else {
if (PSM1number < 2) {
originalPSM = bPSMArray[++PSM1number];
if(PSM1number==2) {
PSM1number=0;
}
}
PSMtype=1;
}
Messenger.MyPersonalMessage = originalPSM;
}
}
function OnEvent_MyStatusChange(NewStatus) {
if(allowed==1) {
if( NewStatus == 7 || NewStatus == 6 ) {
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! 0hrs:0mins:0secs";
MsgPlus.AddTimer( "incIdle", 1000 );
MsgPlus.AddTimer( "updateDisplay", 6000 );
isIdle = true;
isBusy = false;
MsgPlus.DisplayToast("Status Checker","Idle/Away State Activated");
} else if(NewStatus == 4) {
Messenger.MyPersonalMessage = "Text me! I'm in a full screen app and msngr alerts are off! :)";
isBusy = true;
isIdle = false;
idleSeconds = 0;
MsgPlus.DisplayToast("Status Checker","Busy State Activated");
} else {
isIdle = false;
isBusy = false;
idleSeconds = 0;
updateMessage();
MsgPlus.DisplayToast("Status Checker","Normal State Activated");
MsgPlus.AddTimer('rotate', seconds * 1000);
}
}
}
function OnEvent_Timer(sTimerId) {
if( isIdle == false && isBusy == false) {
updateMessage();
MsgPlus.AddTimer('rotate', seconds * 1000);
return 0;
} else if( sTimerId == "incIdle" ) {
if(isIdle==true) {
idleSeconds ++;
MsgPlus.AddTimer( "incIdle", 1000 );
}
}
else if( sTimerId == "updateDisplay" ) {
if(isIdle==true) {
var cIdleSeconds = idleSeconds;
var idleHours = 0;
var idleMinutes = 0;
while( cIdleSeconds > 59 ) {
cIdleSeconds -= 60;
idleMinutes ++;
}
while( idleMinutes > 59 ) {
idleMinutes -= 60;
idleHours ++;
}
Messenger.MyPersonalMessage = "Text/ ring me and I'll be back ASAP! "+idleHours+"hrs:"+idleMinutes+"mins:"+cIdleSeconds+"secs";
MsgPlus.AddTimer( "updateDisplay", 6000 );
}
}
}
function OnGetScriptCommands(){
var oCommand = new Commands();
with (oCommand) {
AddCommand('pmrotate', 'Rotate your Personal Message');
AddCommand('pmtoggle', (allowed === 1 ? 'Disable' : 'Enable')+' Automatic PM Changes'); }
return oCommand.ExportCommands();
}
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
var _command = RegExp.$1.toLowerCase();
var _param = RegExp.$2;
switch (_command) {
case 'pmrotate':
if ( _param !== '' ) {
seconds = _param;
} else {
updateMessage();
}
return '';
break;
case 'pmtoggle':
if(allowed==1) {
allowed=0;
MsgPlus.DisplayToast("Status Checker","Disabled");
} else if(allowed==0) {
allowed=1;
MsgPlus.DisplayToast("Status Checker","Enabled");
}
return '';
break;
}
}
}
function OnGetScriptMenu(nLocation) {
var oMenu = new ScriptMenu();
with (oMenu) {
AddItem('/pmtoggle', (allowed === 1 ? 'Disable' : 'Enable') );
AddItem('/pmrotate', 'Rotate PM');
}
return oMenu.ExportMenu();
}
function OnEvent_MenuClicked(sMenuId, nLocation, oChatWnd) { OnEvent_ChatWndSendMessage(0, sMenuId); }
RE: Error: unknown (code: -2147418113) by roflmao456 on 05-02-2009 at 03:23 AM
yeah it's possible just try out the activexobject: Scripting.FileSystemObject
RE: Error: unknown (code: -2147418113) by Dr Nick on 05-02-2009 at 03:39 AM
Thanks, rofl
Haven't used activex before, but no doubt ill find a tutorial
RE: Error: unknown (code: -2147418113) by roflmao456 on 05-02-2009 at 03:46 AM
I usually look over here for the functions to Scripting.FileSystemObject:
http://www.tutorial-web.com/asp/fso/
just have to know how to interpret that into jscript and you're fine.
code: var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\psm-list.txt",8,1);
I didn't script JScript since december so i'm pretty 'rusty' right now
gotta finish WLMini Music Player...
RE: Error: unknown (code: -2147418113) by Dr Nick on 05-02-2009 at 04:33 AM
Thanks...
This looks very advanced for me.
i think I better practice a little more then have another go, if I still cant get it, ill make another thread later on...
|