What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Code Help

Code Help
Author: Message:
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
37 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. Code Help
Hello people!!!
I'm trying to use this script with Rapidshare. I'm not good on scripting and I know it can sound strange, but what I'm trying to make is a script that you enter RapidShare URL with de code (that begin with /) and after 16 minutes it'll open the URL.
Don't know what's happening with it -> Nothing on Debugging

jscript code:
function OnGetScriptCommands(){
var ScriptCommands = "<ScriptCommands>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>rapiddown</Name>";
ScriptCommands += "<Description>Colocar URL</Description>";
ScriptCommands += "<Parameters>&lt;URL&gt;</Parameters>";
ScriptCommands += "</Command>";
ScriptCommands += "</ScriptCommands>";

return ScriptCommands;
}


function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
if (Message.substr(0, 11) == "/rapiddown "){
var truedown = Message.substr(Message.search(' '));
downloadtime();
return "";
}
}


function downloadtime()
{
MsgPlus.AddTimer("timer", 960000);
MsgPlus.DisplayToast("RapidDown","16 minutos para novo download");
}

function OnEvent_Timer(timerID, truedown)
{
if(timerID == "timer")
{
MsgPlus.DisplayToast("RapidDown", "Abrindo link!");
Operurl(truedown);
}

function Openurl(truedown)
{
    new ActiveXObject('WScript.Shell').Run(truedown);

   
    }
}

Thanks
;)



PS: truedown is the URL I typed with "/" code!!!
PS2: If someone wants to use the code, be free to use it

This post was edited on 12-07-2008 at 05:54 AM by MicroWay.
12-07-2008 05:50 AM
Profile PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Code Help
OnEvent_Timer takes just one parameter i.e. TimerID.

Also either declare truedown as a global variable or remove the var before it in the function.

This post was edited on 12-07-2008 at 07:18 AM by Felu.
12-07-2008 06:50 AM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Code Help
quote:
Originally posted by Felu
Also either declare truedown as a global variable or remove the var before it in the function

Declare it globally else you won't be able to use it in the OnEvent_Timer function
<Eljay> "Problems encountered: shit blew up" :zippy:
12-08-2008 07:41 AM
Profile PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Code Help
quote:
Originally posted by Spunky
quote:
Originally posted by Felu
Also either declare truedown as a global variable or remove the var before it in the function

Declare it globally else you won't be able to use it in the OnEvent_Timer function
If you assign a value to a variable inside a function but don't declare it, it becomes a global variable.

I mean like
jscript code:
var globalvar = 1; //Global variable
function test(){
globalvar1 = 1; //Global variable
var localvar2 = 1; //Local to the function test
}
12-08-2008 09:52 AM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Code Help
quote:
Originally posted by Felu
If you assign a value to a variable inside a function but don't declare it, it becomes a global variable.

Exactly, but you already declared the variable outside a function, making it global. I thought all variables should be declared and you couldn't just go:
jscript code:
function one(){
    myVar = 100;
}

function two(){
    myVar += 100;
}

Debug.Trace(myVar);
<Eljay> "Problems encountered: shit blew up" :zippy:
12-08-2008 11:28 AM
Profile PM Find Quote Report
MicroWay
Senior Member
****

Avatar
Do you want me? Try to get me!

Posts: 571
Reputation: 16
37 / Male / Flag
Joined: Jul 2006
Status: Away
O.P. RE: Code Help
Hey, Guys!!! Thanks!!!
;)
12-10-2008 10:01 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