Shoutbox

Code 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: Code Help (/showthread.php?tid=87622)

Code Help by MicroWay on 12-07-2008 at 05:50 AM

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
RE: Code Help by Felu on 12-07-2008 at 06:50 AM

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.


RE: Code Help by Spunky on 12-08-2008 at 07:41 AM

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
RE: Code Help by Felu on 12-08-2008 at 09:52 AM

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
}

RE: Code Help by Spunky on 12-08-2008 at 11:28 AM

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);

RE: Code Help by MicroWay on 12-10-2008 at 10:01 PM

Hey, Guys!!! Thanks!!!
;)