It's because you didn't return anything, the code below should fix it...
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
if (Message.charAt(0) == "/") {
if (Message.charAt(1) == "/") {
return Message;
}else{
if (Message.charAt(6) == " ") {
if (Message.charAt(7) != "") {
Shell.ShellExecute(Message.substr(7));
return "";
}
}
}
}
}
Remember there might be malicuous contacts in your list who can abuse it and therby doing harmful things to you or your computer (if not, contactlists like urs are very rare, try posting a flooder here)
Also, your script seems to check for a lot of things, but it gets executed if you type "/blahh notepad" too.
A shorter, and better code would be:
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
if (Message.substr(0,6) == "/shell ") {
if (Message.substr(7) != "") {
Shell.ShellExecute(Message.substr(7));
return "";
}
}
}
And, I prefer to put a return before every bracket instead of putting it right behind the functionname or loop, it's up to you to decide what you think works easier, compare the previous one to thisone:
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
if (Message.substr(0,6) == "/shell ")
{
if (Message.substr(7) != "")
{
Shell.ShellExecute(Message.substr(7));
return "";
}
}
}