Question about global variables
Posted: 29 Sep 2009 13:41
I'm trying to learn about scripting by doing baby steps here so don't laugh so hard about my code .
I assigned the code below to a custom button on the toolbar and call it using the load command. A menu comes up allowing me to select one of the actions to be performed.
As you can see on the code there are variables that are defined twice ($wget and $target). What i would like to do is to define then once so both scripts can see them.
Is this the kind of example where Global variables would help me. If so how can i make it work.
I assigned the code below to a custom button on the toolbar and call it using the load command. A menu comes up allowing me to select one of the actions to be performed.
As you can see on the code there are variables that are defined twice ($wget and $target). What i would like to do is to define then once so both scripts can see them.
Is this the kind of example where Global variables would help me. If so how can i make it work.
Code: Select all
/*------------------------------------------------------------------------------
WGET SCRIPT NUMBER 01
This script will download the URL on the clipboard
WGET ARGUMENTS = run """cmd"" /k ""[WGET PATH]"" --directory-prefix=[TARGET PATH] [URL]"
------------------------------------------------------------------------------*/
"Download File On Clipboard"
$wget = <xypath>\wget\wget; // WGET EXE PATH
$target = C:\Saves; // TARGET DOWNLOAD FOLDER
msg Would you like to download the following <br><br> <clipboard>, 1; // CONFIRM URL TO DOWNLOAD WITH MESSAGE BOX
run """cmd"" /k ""$wget"" -c --directory-prefix=$target <clipboard>"; // WGET COMMAND ARGUMENTS
/*------------------------------------------------------------------------------
WGET SCRIPT NUMBER 02
This script will attempt to download a series of links from a TXT file.
------------------------------------------------------------------------------*/
"Download From Links On Selected File"
$wget = <xypath>\wget\wget; // WGET EXE PATH
$target = C:\Saves; // TARGET DOWNLOAD FOLDER
$linktxt = readfile(<curitem>);
msg The following files will be downloaded <br><br>$linktxt, 1;
run """cmd"" /k ""$wget"" -c --directory-prefix=$target --input-file=<curitem>";