What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » what is wrong with this script?

what is wrong with this script?
Author: Message:
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. what is wrong with this script?
code:
//global variables:   
        var fsObj = new ActiveXObject("Scripting.FileSystemObject");
        var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\defwelcomemsg.txt', 1);
        var DefWelcomemsg = fileObj.ReadAll();
        fileObj.Close();
       
        var fsObj2 = new ActiveXObject("Scripting.FileSystemObject");
        var fileObj2 = fsObj2.OpenTextFile(MsgPlus.ScriptFilesPath + '\\defgoodbyemsg.txt', 1);
        var DefGoodbyemsg = fileObj2.ReadAll();
        fileObj2.Close();
       

//functions
function OnEvent_Initialize(MessengerStart)
{

}

function OnGetScriptMenu(Location)
{
    var ScriptMenu ="<ScriptMenu>";
    ScriptMenu +="<MenuEntry Id=\"window\">Polite Preferences</MenuEntry>";
    ScriptMenu +="</ScriptMenu>";
    return ScriptMenu;
}

function OnEvent_MenuClicked(MenuId, Location, Wnd)
{
    switch(MenuId)
    {
        case "window":
       
        var PlusWnd = MsgPlus.CreateWnd( 'windows_new.xml', 'Polite', 0 );
        PlusWnd.SetControlText("EdtWelcomeMsg", DefWelcomemsg)
        PlusWnd.SetControlText("EdtGoodbyeMsg", DefGoodbyemsg)
       
        break;
    }
       
}



function OverwriteFile (file, content)
{
        var fileObj4 = new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 0);
        fileObj4.Write(content);
        fileObj4.Close();
}

function OnPoliteEvent_CtrlClicked(PlusWnd, CtrlId) {
if(CtrlId == "Btnlol") {
OverwriteFile("defwelcomemsg.txt", PlusWnd.GetControlText("EdtWelcomeMSg"));
OverwriteFile("defgoodbyemsg.txt", PlusWnd.GetControlText("EdtGoodbyeMsg"));

}
}


function OnEvent_Signin(Email)
{
     var Message = DefWelcomemsg;
     MsgPlus.DisplayToast("Hello", Message);

}
function OnEvent_Signout(Email)
{
    var Message = DefGoodbyemsg;
     MsgPlus.DisplayToast("Goodbye", Message);
}


function OnEvent_Uninitialize(MessengerExit)
{
}



it doesn;t work
[Image: wakakipt2.png]
01-27-2007 04:53 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: what is wrong with this script?
What exactly doesn't work about it?
01-27-2007 04:55 PM
Profile PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
RE: what is wrong with this script?
could you be a bit more specific? for example: what doesn't work..
or show us the debug output...
01-27-2007 04:55 PM
Profile E-Mail PM Find Quote Report
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. RE: what is wrong with this script?
edit:i fixed it but now there is another problem

my save button doesn;t work

This post was edited on 01-27-2007 at 05:35 PM by Wakaki.
[Image: wakakipt2.png]
01-27-2007 05:24 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: what is wrong with this script?
Does "defwelcomemsg.txt" actually contain anything? That error means youre trying to read an empty file.
01-27-2007 05:35 PM
Profile PM Find Quote Report
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. RE: what is wrong with this script?
code:
function OnPoliteEvent_CtrlClicked(PlusWnd, CtrlId) {
if(CtrlId == "Btnlol") {
OverwriteFile("defwelcomemsg.txt", PlusWnd.GetControlText("EdtWelcomeMSg"));
OverwriteFile("defgoodbyemsg.txt", PlusWnd.GetControlText("EdtGoodbyeMsg"));

}



this function doesn;t work:S

this is my window xml file:

code:
<?xml version="1.0" encoding="UTF-16" ?>
- <Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd">
- <GlobalColors>
- <GlobalColor Id="green">
  <Red>80</Red>
  <Green>200</Green>
  <Blue>65</Blue>
  <Alpha>220</Alpha>
  </GlobalColor>
- <GlobalColor Id="bg">
- <BaseColor>
  <Saturation>2</Saturation>
  <Brightness>0.6</Brightness>
  <Transparency>82</Transparency>
  </BaseColor>
  </GlobalColor>
  </GlobalColors>
- <Window Id="Polite" Version="1">
- <Attributes>
  <Caption>Windows Live Messenger</Caption>
  </Attributes>
- <TitleBar>
- <Title>
  <Text>Preferences</Text>
  </Title>
  </TitleBar>
  <Position Width="475" Height="155" />
  <DialogTmpl />
- <Controls>
- <Control xsi:type="StaticControl" Id="LblTop">
  <Position Top="9" Width="404" Left="80" Height="20" />
  <Transparency>180</Transparency>
  <Caption>Fill the fields below in if you want to change youre Welcome or Goodbye message:</Caption>
  </Control>
- <Control xsi:type="StaticControl" Id="LblWelcomeMsg">
  <Position Top="35" Width="112" Left="9" />
  <Caption>Current Welcome message:</Caption>
  </Control>
- <Control xsi:type="EditControl" Id="EdtWelcomeMsg">
  <Position Top="35" Width="300" Left="100" />
  </Control>
- <Control xsi:type="StaticControl" Id="LblGoodbyeMsg">
  <Position Top="70" Width="112" Left="9" />
  <Caption>Current Goodbye message:</Caption>
  </Control>
- <Control xsi:type="EditControl" Id="EdtGoodbyeMsg">
  <Position Top="70" Width="300" Left="100" />
  </Control>
- <Control xsi:type="ButtonControl" Id="BtnCancel">
  <Position Left="400" Top="100" Width="50" />
  <Caption>Close</Caption>
  </Control>
- <Control xsi:type="ButtonControl" Id="Btnlol">
  <Position Left="330" Top="100" Width="50" />
  <Caption>Save</Caption>
  </Control>
  </Controls>
  </Window>
  </Interfaces>

[Image: wakakipt2.png]
01-27-2007 05:38 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On