Shoutbox

[ help ] Stop script from running on both msn's - 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: [ help ] Stop script from running on both msn's (/showthread.php?tid=92721)

[ help ] Stop script from running on both msn's by CarlosHero on 10-29-2009 at 02:37 PM

I have a script which reads from a txt file when i send the command [read], but because i have the script installed myself to test it when im signed into 2 accounts it doesn't work, how would i make it so the script only runs on the account the message is received on. Also i noticed when i signed into ebuddy to test it i was still signed into 2 accounts and it din't work but id be guessing that would be the same problem. So i just need to know how to make it only run on the account that receives the command.

Regards,
CH


RE: [ help ] Stop script from running on both msn's by Spunky on 10-29-2009 at 03:04 PM

You have to check the email of the user running the script. It'll be the only way as scripts run an instance for each instance of WLM open.


RE: [ help ] Stop script from running on both msn's by matty on 10-29-2009 at 03:09 PM

Javascript code:
var bEnabled = true;
 
function OnEvent_Initialize () {
    if ( Messenger.MyStatus < STATUS_INVISIBLE ) return false;
    if ( Messenger.MyEmail !== 'johndoe@hotmail.com' ) {
        bEnabled = false;
    }
}
 
function OnEvent_SigninReady () {
    OnEvent_Initialize ();
}


Then before doing anything check the variable bEnabled

Javascript code:
function OnEvent_ChatWndReceiveMessage ( ... ) {
    if ( bEnabled === true ) {
        // ... do things here
    }
}


RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-29-2009 at 03:18 PM

Thanks for the replyg guys.

@matty when I tested the code when I read the txt file it shown up as a blank message in both conversations.

Would something like this work instead of having to use the email.

code:
if(Origin!=Messenger.MyName){                    // If the receive message isn't send by you

RE: [ help ] Stop script from running on both msn's by tribbium on 10-29-2009 at 03:38 PM

Haven't tested it but, couldn't you write to a file or the registry flagging that the program has been initialized so that other instances can recognize it and not initialize?


RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-29-2009 at 03:50 PM

I'm not sure mate haven't tried that but wouldn't have a clue where to start to test it.


RE: [ help ] Stop script from running on both msn's by matty on 10-29-2009 at 03:58 PM

quote:
Originally posted by CarlosHero
Thanks for the replyg guys.

@matty when I tested the code when I read the txt file it shown up as a blank message in both conversations.

Would something like this work instead of having to use the email.

code:
if(Origin!=Messenger.MyName){                    // If the receive message isn't send by you

That would work only if your names are different. But then this isn't exactly the answer to your question. You asked how to make a script work only for a specific email which is what I provided. Not how to reply to a message only if you aren't the original sender.
RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-29-2009 at 04:45 PM

Ah sorry if you misunderstood me, what I meant to say was how would I make the script only run on the account the command was received on. Say i was signed in on 2 seperate account without needing to know the email. Like how would I add it to this

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message,MsgKind){
     if(Message.indexOf("[read]")>0){
         sendstatus(ChatWnd);
         return Message.substr(0,Message.indexOf("[read"));
     }

Would this work?

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message,MsgKind){
    if(Origin!=Messenger.MyName){                    // If the receive message isn't send by you
     if(Message.indexOf("[read]")>0){
         sendstatus(ChatWnd);
         return Message.substr(0,Message.indexOf("[read"));
     }

}

RE: [ help ] Stop script from running on both msn's by matty on 10-29-2009 at 04:59 PM

quote:
Originally posted by CarlosHero
Ah sorry if you misunderstood me, what I meant to say was how would I make the script only run on the account the command was received on. Say i was signed in on 2 seperate account without needing to know the email. Like how would I add it to this

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message,MsgKind){
     if(Message.indexOf("[read]")>0){
         sendstatus(ChatWnd);
         return Message.substr(0,Message.indexOf("[read"));
     }

Would this work?

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message,MsgKind){
    if(Origin!=Messenger.MyName){                    // If the receive message isn't send by you
     if(Message.indexOf("[read]")>0){
         sendstatus(ChatWnd);
         return Message.substr(0,Message.indexOf("[read"));
     }

}

Javascript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message,MsgKind){
    if(Origin!=Messenger.MyName){                    // If the receive message isn't send by you
        if(Message.indexOf("[read]")>0){
            sendstatus(ChatWnd);
            return Message.substr(0,Message.indexOf("[read"));
        }
    }}


You missed the highlighted }
RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-29-2009 at 05:11 PM

I tried adding it to this mate

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message,MsgKind){
    if(Origin!=Messenger.MyName){                    // If the receive message isn't send by you
     if(Message.indexOf("[read]")>0){
         sendstatus(ChatWnd);
         return Message.substr(0,Message.indexOf("[read"));
     }
}



But when I test it say I'm A sending the commands i see it like

A says: hai [read]

B says:

And B see's it like

A says: hai

B says: Online

But I'm supposed to see it like

A says: hai [read]

B says: Online

and B is supposed to see it like

A says: hai

B says:

Regards,
CH


RE: [ help ] Stop script from running on both msn's by matty on 10-29-2009 at 08:24 PM

Post all of your code.


RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-31-2009 at 11:25 AM

Thanks for the quick reply, I think i have something wrong with the code. When i try and read this from the txt file.

URL: http://msgplus.net/scripts/
Script: NudgesToolsScript 1.38
Downloads: 1,822,901
rating: 4Star

it just sends like a weird blue line

Regards,
CH


RE: [ help ] Stop script from running on both msn's by CookieRevised on 10-31-2009 at 11:48 AM

I extremely and very strongly suggest you use the proper syntax '/command' for commands.
Do not use inline texts like '[command]' to trigger a command!

You can have a lot, and I mean a lot, of troubles later on with other scripts, emoticons, etc, if you keep on using the syntax '[command]' within normal text.


RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-31-2009 at 12:03 PM

If I use those commands would that fix the problem of me getting the blue line?


RE: [ help ] Stop script from running on both msn's by CookieRevised on 10-31-2009 at 12:16 PM

Probably not, as those are two different things though. (although I can think of one situation were it might be related: emoticons)

Using the proper '/command' syntax is more so you wont run into troubles later on. It is not good when you learn how to make scripts and do it immediatly with bad practices. It's better to learn it in the correct way from the start. It would make scripting (and looking for errors, etc) much easier... ;)

As for the blue line: can you post a screenshot?


RE: [ help ] Stop script from running on both msn's by CarlosHero on 10-31-2009 at 12:25 PM

Now my problem is, when I type the command in the chat window when I send the info out of mdr.txt its invisible in both conversations unless i use mattys code with the email. anyway i can do this without the email ?


RE: [ help ] Stop script from running on both msn's by matty on 11-02-2009 at 02:23 PM

Did you post your code?