newb @ work... |
Author: |
Message: |
ins4ne
Veteran Member
...
Posts: 1015 Reputation: 38
37 / /
Joined: Apr 2006
Status: Away
|
O.P. newb @ work...
help me guys i just created some code from the scripting documentations and modified a bit. now i got a menu when i click the plus symbol in the contactlist. but when i click on feature 1, 2 or advanced feature 1, 2 a window pops up that should only popup for "about"...
code: <ScriptInfo xmlns="urn:msgplus:scripts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:msgplus:scripts PlusScripts.xsd">
<Information>
<Name>Test Script</Name>
</Information>
<ScriptMenu>
<MenuEntry Id="MnuFeat1">Feature 1</MenuEntry>
<MenuEntry Id="MnuFeat2">Feature 2</MenuEntry>
<SubMenu Label="Advanced">
<MenuEntry Id="MnuAdvFeat1">Advanced Feature 1</MenuEntry>
<MenuEntry Id="MnuAdvFeat2">Advanced Feature 2</MenuEntry>
</SubMenu>
<Separator/>
<MenuEntry Id="MnuAbout">About...</MenuEntry>
</ScriptMenu>
</ScriptInfo>
code: function OnEvent_MenuClicked(MnuAbout)
{
var Wnd = MsgPlus.CreateWnd("Window.xml", "WndTest");
}
function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnClose") Wnd.Close(1);
}
whats my problem? i forgot something?
This post was edited on 07-20-2006 at 03:49 PM by ins4ne.
|
|
07-19-2006 06:56 PM |
|
|
absorbation
Elite Member
Posts: 3636 Reputation: 81
– / /
Joined: Feb 2005
|
RE: nwwb @ work...
code: if(ControlId == "BtnClose") {
Wnd.Close(1);
}
You had to add { to tell the script what to do if ControlId was BtnClose .
|
|
07-19-2006 07:02 PM |
|
|
Stigmata
Veteran Member
Posts: 3520 Reputation: 45
21 / /
Joined: Jul 2003
|
RE: nwwb @ work...
code: function OnEvent_MenuClicked(MnuAbout)
{
var Wnd = MsgPlus.CreateWnd("Window.xml", "WndTest");
}
function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnClose"){ Wnd.Close(1); }
}
This post was edited on 07-19-2006 at 07:03 PM by Stigmata.
|
|
07-19-2006 07:02 PM |
|
|
Pai
Full Member
w00t !
Posts: 203 Reputation: 2
– / / –
Joined: Sep 2003
|
RE: nwwb @ work...
You did, and you didn't You did remember to *check* if the ID pressed was MnuAbout, but you did it the wrong way.
It should be like this:
code: function OnEvent_MenuClicked(IdClicked)
{
if (IdClicked == "MnuAbout") var Wnd = MsgPlus.CreateWnd("Window.xml", "WndTest");
}
edit: guys, that's not what he asked And he can use code: if(ControlId == "BtnClose") Wnd.Close(1);
without any problems, as long as it is one single statement...
This post was edited on 07-19-2006 at 07:06 PM by Pai.
|
|
07-19-2006 07:02 PM |
|
|
ins4ne
Veteran Member
...
Posts: 1015 Reputation: 38
37 / /
Joined: Apr 2006
Status: Away
|
O.P. RE: nwwb @ work...
aaaaaaaaaah thx Pai it works now... just like i said newb @work. but one day i will code myself without errors
|
|
07-19-2006 07:06 PM |
|
|
ins4ne
Veteran Member
...
Posts: 1015 Reputation: 38
37 / /
Joined: Apr 2006
Status: Away
|
O.P. RE: nwwb @ work...
sorry for double post but editing the previous would be a bit weird... so my new problem...
code: function OnEvent_MenuClicked(IdClicked)
{
if (IdClicked == "MnuAbout")
var Wnd = MsgPlus.CreateWnd("Window.xml", "WndTest");
}
function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnOK"){ Wnd.Close(1); }
}
function OnEvent_MenuClicked(IdClicked)
{
if (IdClicked =="MnuToast")
var Message = "Hello";
MsgPlus.DisplayToast("", Message);
}
some conflicts... the same as my first problem... click all menus, always empty toasts. only menu toast gives me message Hello!
This post was edited on 07-19-2006 at 07:45 PM by ins4ne.
|
|
07-19-2006 07:33 PM |
|
|
Silentdragon
Full Member
if(life==null && wrists) EmoAlert();
Posts: 148 Reputation: 2
34 / / –
Joined: Jun 2006
|
RE: nwwb @ work...
You can only have one MenuClicked event. You need to do all the work in that one event. And if statements without {} only work for the next line. So do this
code: function OnWndTestEvent_CtrlClicked(Wnd, ControlId)
{
if(ControlId == "BtnOK"){ Wnd.Close(1); }
}
function OnEvent_MenuClicked(IdClicked)
{
if (IdClicked == "MnuAbout") var Wnd = MsgPlus.CreateWnd("Window.xml", "WndTest");
else if (IdClicked =="MnuToast") {
var Message = "Hello";
MsgPlus.DisplayToast("", Message);
}
}
Btw you also wrote ass instead of as.
This post was edited on 07-19-2006 at 07:44 PM by Silentdragon.
|
|
07-19-2006 07:44 PM |
|
|
ins4ne
Veteran Member
...
Posts: 1015 Reputation: 38
37 / /
Joined: Apr 2006
Status: Away
|
O.P. RE: nwwb @ work...
ok... so i wasnt very far away... i tried a bit on my own so take a look
code: function OnEvent_MenuClicked(IdClicked)
{
if (IdClicked == "MnuAbout")
var Wnd = MsgPlus.CreateWnd("Window.xml", "WndTest");
if (IdClicked == "MnuToast")
var Message = "Hello";
MsgPlus.DisplayToast("", Message);
}
i wrote that before i read your post Silentdragon...
EDIT: i hope i dont annoy you by asking all this things
This post was edited on 07-19-2006 at 07:49 PM by ins4ne.
|
|
07-19-2006 07:47 PM |
|
|
ins4ne
Veteran Member
...
Posts: 1015 Reputation: 38
37 / /
Joined: Apr 2006
Status: Away
|
O.P. RE: nwwb @ work...
sorry again for double post but whats the problem in this
code: function OnSoundEvent_CtrlClicked(Wnd, ControlId)
{
if (ControlId == "BtnPlay")
var Message = "Sound not playing! Learn about MsgPlus.PlaySound! ";
MsgPlus.DisplayToast("", Message, "notify.wav");
}
else if (ControlId == "BtnClose"){ Wnd.Close(1); }
and show me how to play and stop a sound...
This post was edited on 07-19-2006 at 09:04 PM by ins4ne.
|
|
07-19-2006 08:46 PM |
|
|
Pai
Full Member
w00t !
Posts: 203 Reputation: 2
– / / –
Joined: Sep 2003
|
RE: nwwb @ work...
The problem is that you have to include the { } s in an if statement, except if you only want one line of code executed.
For clearing up:
code: if (condition == "whatever") DoStuff('hello');
code: if (condition == "whatever") {
var doWhat = 'hello';
DoStuff(doWhat);
}
So, your code should be:
code: function OnSoundEvent_CtrlClicked(Wnd, ControlId)
{
if (ControlId == "BtnPlay") {
var Message = "Sound not playing! Learn about MsgPlus.PlaySound! ";
MsgPlus.DisplayToast("", Message, "notify.wav");
}
if (ControlId == "BtnClose") Wnd.Close(1);
}
To play the sound then the toast is displayed, notify.wav must be on your script's directory.
If you want to play a sound when you want (ie without being when the toast fires up) you use MsgPlus.Playsound('sound.wav'); and sound.wav must be in your script's directory. If you want to play a sound outside the script's directory, use "\" before. Example: "\C:\sound.wav".
|
|
07-19-2006 09:15 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|