home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 February
/
PCWorld_2001-02_cd.bin
/
Software
/
Vyzkuste
/
visirc
/
axscript.txt
next >
Wrap
Text File
|
1997-09-01
|
3KB
|
98 lines
ActiveX Scripting Documentation (for Visual IRC '97 1.00 and above) - Revision 2
================================================================================
ViRC '97 1.00rc2 and above support ActiveX scripting, which means that you can
mix VBScript and JavaScript code within your ViRCScript code. This is an
extremely powerful feature seen in no other IRC client which allows you to use
multiple scripting languages at once to achieve the best result.
1.00rc3 and above allow additional Active Scripting language DLLs to be
installed via the Client setup/Active scripting page. This effectively allows
any language to be used, not just VBScript and JavaScript.
This document is not intended as an introduction to the VBScript or JavaScript
scripting languages. Books intended for this purpose can be purchased from your
favourite computer bookshop.
ActiveX scripting is controlled by the new LANGUAGE statement.
LANGUAGE statement
------------------
Usage: Language VBScript
...
EndLanguage
Language JavaScript
...
EndLanguage
In the ... code block, VBScript or JavaScript code can be inserted as desired.
There is, of course, a mechanism provided for VBScript and JavaScript code to
examine ViRCScript variables, execute ViRCScript statements, and so forth. This
is accomplished through the special ViRCScript object which is available to
VBScript and JavaScript code. The methods it supports are detailed below.
ViRCScript.GetVar method
------------------------
Usage (VBScript): x = ViRCScript.GetVar("$variable")
Usage (JavaScript): x = ViRCScript.GetVar("$variable");
Returns the contents of the ViRCScript variable $variable.
ViRCScript.SetVar method
------------------------
Usage (VBScript): ViRCScript.SetVar "$variable", "value"
Usage (JavaScript): ViRCScript.SetVar("$variable", "value");
Sets the value of the ViRCScript variable $variable to value.
ViRCScript.Parse method
-----------------------
Usage (VBScript): x = ViRCScript.Parse("expression")
Usage (JavaScript): x = ViRCScript.Parse("expression");
Fully evaluates expression, which can contain ViRCScript variables and
functions, and returns the evaluated expression.
ViRCScript.Execute method
-------------------------
Usage (VBScript): ViRCScript.Execute "command"
Usage (JavaScript): ViRCScript.Execute("command");
Executes the ViRCScript command command. This allows VBScript and JavaScript
code to execute regular ViRCScript statements. For example, this code will
sum all the numbers from 1 to 1000 and display the result in a standard
ViRCScript message box:
Language JavaScript
var j = 0;
for (i = 1; i <= 1000; i++)
j += i;
ViRCScript.Execute("MessageBox " + j);
EndLanguage
The same code could be expressed in VBScript as:
Language VBScript
j = 0
For i = 1 To 1000
j = j + i
Next
ViRCScript.Execute "MessageBox " & j
EndLanguage
It could be coded in ViRCScript as the following (note the similarily to the
JavaScript code):
@ $j = 0
for (@ $i = 1; $i <= 1000; $i++)
$j += $i
endfor
MessageBox $j