Script Help.... - 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: Script Help.... (/showthread.php?tid=62613)
Script Help.... by nokturnal on 07-05-2006 at 08:42 PM
Hey guys,
First off I have to apologize for this stupid question and I hope I don't get yelled at too badly, but I just can't get it working.
I am attempting to do the 'Window Test' tutorial in the scripting documentation and can't seem to get the CreateWnd method to work.
Here is the code:
Window Test.js
code: function OnEvent_Initialize(MessengerStart) {
var Wnd = MsgPlus.CreateWnd("InterfaceTest.xml", "WndTest");
}
InterfaceTest.xml
code: <Interfaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Window Id="WndTest" Version="1">
<Attributes>
<Caption>Test Window</Caption>
</Attributes>
<TitleBar>
<Title>
<Text>Hello!</Text>
</Title>
</TitleBar>
<Position Width="180" Height="75"/>
<DialogTmpl/>
<Controls>
<Control xsi:type="StaticControl" Id="LblTop">
<Position Left="10" Top="10" Width="150"/>
<Caption>Hello world!</Caption>
</Control>
<Control xsi:type="ButtonControl" Id="BtnClose">
<Position Left="112" Top="25" Width="50"/>
<Caption>Close</Caption>
</Control>
</Controls>
</Window>
</Interfaces>
The files are in the same directory inside c:/../../Messenger Plus! Live/Scripts/Window Test/
Debug window says:
Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
... and no window
I have MessengerPlus! Live 4.0.0.235 with MSN 8.0.0792.00
Any idea's?
RE: Script Help.... by pollolibredegrasa on 07-05-2006 at 08:48 PM
When creating the XML, make sure it is saved in unicode.
RE: Script Help.... by Silentdragon on 07-05-2006 at 08:48 PM
Hmm, try this. Open your xml file in wordpad and save it as a unicode xml file.
RE: Script Help.... by NiteMare on 07-05-2006 at 08:50 PM
is the xml file saved as unicode?, i had the same problem and that fixed it
RE: Script Help.... by BstrdSmkr on 07-05-2006 at 08:51 PM
I could be wrong here, but try dropping the "var Wnd= " part. such as:
code: function OnEvent_Initialize(MessengerStart)
{
MsgPlus.CreateWnd("InterfaceTest.xml", "WndTest");
}
RE: Script Help.... by L. Coyote on 07-05-2006 at 09:00 PM
You shouldn't create windows in the Initialize event, unless you're already connected. Try doing it on sign in, or verify the current status and the MessengerStart variable.
From the script documentation:
quote: Scripts should keep their initialization to a strict minimum when MessengerStart is true. No window must be displayed at that time and no time consuming task must be launched.
RE: Script Help.... by foaly on 07-05-2006 at 09:13 PM
u have to save the xml in unicode 16...
unicode 8 won't work either...
RE: Script Help.... by nokturnal on 07-05-2006 at 09:21 PM
You guys are amazing!
There was a combination of problems I think. Textpad must have been saving out unicode 8. After I recreated the file in Wordpad and saved out it out in unicode everything worked.
I also moved the handling of the window creation out of the init event and into OnEvent_MyStatusChange.
The window test tutorial should be changed to reflect Leonardo's observation about not creating windows inside the init event unless you handle MessengerStart.
Thanks again guys! And if i ever to create something worthwhile I will be sure to post it
Cheers
|