The Tools component provides the ability to add sophisticated functionality, such as generating random numbers, checking whether a particular server plug-in exists, processing the contents of an HTML form, etc., to the Web page.
Provides the ability to add sophisticated features, such as generating random numbers, checking whether a particular server plug-in exists, processing the contents of an HTML form, etc., to the Web page.
Checks the existence of the specified file. Returns TRUE if the file exists.
object.FileExists( URL As String)
Boolean.
FileExists checks only the existence of files published on your site. Therefore, it takes a relative URL rather than an absolute URL.
This example returns TRUE if MYHOME.HTM exists in the directory specified.
<% Set Tools = CreateObject ("MSWC.Tools")
File = Tools.FileExists("/bin/mypages/myhome.htm")
print File %>
Checks if the current user is the owner of the directory where the current page is located. It returns TRUE if the user's name submitted in the process form matches that of the owner's.
object.Owner()
None.
Boolean.
This example demonstrates the owner method.
<% Set Tools = CreateObject ("MSWC.Tools")
owner = Tools.Owner()
print owner %>
Checks if the specified server plug-in is registered. It returns TRUE if it is currently registered.
object.PluginExists( PluginName As String)
Boolean.
This example returns TRUE if the specified plug-in exists on the server.
<% Set Tools = CreateObject ("MSWC.Tools")
plugin = Tools.PluginExists("RealPlay.exe")
print plugin %>
Processes the contents of a form that has been submitted by a visitor to the Web site.
object.ProcessForm( OutputFileURL As String, TemplateURL As String [, InsertionPoint As String])
The template files can contain ASP scripts. A script between <% and %> delimiters is treated just like other text in the template and is copied into the output file. If the output file is an ASP document, the script will run when the output file is accessed. Scripts in template files can also be put between special <%% and %%> delimiters which cause the script to execute while ProcessForm method is executing. Since these scripts are executed before the template data is saved in the output file, the results are saved in the output file, usually as standard text.
If the InsertionPoint is not specified, the entire output file is replaced with the data.
If it exists and does not begin with an asterisk (*), the ProcessForm method finds the insertion string in the output file and places the output immediately after it. If it exists and begins with an asterisk (*), the output is placed immediately before it.
If the InsertionPoint string exists, but is not found in the output file, the data is appended to the end of the file.
Null.
If the output file does not exist, the server creates it.
This example demonstrates the ProcessForm method.
<%
Tools.ProcessForm("/Novell_home/sales/result.htm","salesprocess.asp","*Order")
%>
Returns an integer between -32768 and 32767.
object.Random()
None.
Integer.
This method is similar to the Rnd function of C language but returns an integer. To get a positive random integer, use the Abs function. To get a random integer below a specific value, use the Mod function.
This example generates a random number, gives its absolute value, and the modulus value within 200.
<% = Tools.Random %> will display a random integer between -32768 and 32767. For example, -27436. <% = ( Abs( Tools .Random ) ) %> will display a positive random integer. For example, 27436. <% = ( Tools.Random ) Mod 200 %> will display a random integer between -199 and 199. For example, 196 %>