What is WebBatch?
Keywords: webbatch how it works
WebBatch is a Win-CGI Scripting Language for Windows 95/98/ME/NT/2000/XP and newer based Web Servers.To use WebBatch you pretty much need to run your OWN web server with a direct connect to the Internet.
It should work on pretty much any web server running on Windows NT or 95 that supports Standard CGI scripting.
The purpose of WebBatch is to allow a WinBatch-looking script on the server side of an Interconnect connection to Interact with your Browser. WebBatch is a special variant of WinBatch designed to work with Web Servers and execute scripts when users request certain web pages or fill out forms. WebBatch executes on the server side, not on the Client side where the user is sitting with the Browser.
When you set up Webbatch, read through the help file to see how to create a virtual directory under your web server that points to where Webbatch.exe is installed (usually in \Program Files\Webbatch). And when you set up your HTML, you need to locate that file in your /webcgi/ virtual directory on your web server.
Here's a sample html file:
<html> <head> <title>Test FTP</title> </head> <body link="#0000EE" vlink="#551A8B" alink="#FF0000" background="speckle.gif"> <h1>Testing Web Script...</h1> <FONT FACE="Tahoma"><FONT SIZE=+1> <p><A HREF="/webcgi/webbatch.exe?Test/hello.web">Test</a> </FONT> </BLOCKQUOTE> </body> </html>And here's a sample weber file for FTPing:;**** HELLO.WEB ****** webout("Content-type:text/html", 2) webout("<html>",1) webout("<head>",1) webout("<title>Hello,world!</title>",1) webout("</head>",1) webout("<body>",1) webout("<Strong>FTP Download</Strong><BR>",1) ;***** form used to make selection from report list ********* WebOut('<FORM ACTION="/webcgi/webbatch.exe?Test/move2.web" METHOD=POST>',1) WebOut(`<Input TYPE="checkbox" NAME="tran" VALUE="Yes">`,1) WebOut(`Transaction Files<BR>`,1) WebOut(`<Input TYPE="checkbox" NAME="arch" VALUE="Yes">`,1) WebOut(`Archive Files<P>`,1) WebOut(`<Input TYPE="checkbox" NAME="rept" VALUE="Yes">`,1) WebOut(`Report Files<BR>`,1) WebOut(`<Input TYPE="checkbox" NAME="fina" VALUE="Yes">`,1) WebOut(`Financial Files<P>`,1) WebOut(`<Input TYPE="checkbox" NAME="acct" VALUE="Yes">`,1) WebOut(`Accounting Files<BR>`,1) WebOut(`<Input TYPE="checkbox" NAME="dail" VALUE="Yes">`,1) WebOut(`Daily Report Files<P>`,1) WebOut(`<Input TYPE="submit" VALUE="Start Download">`,1) WebOut(`<Input TYPE="reset" VALUE="Reset form"><P>`,1) WebOut(`</Form>`,1) webout("</body>",1) webout("</html>",1)which then launches:; **** MOVE2.WEB ****** webout("Content-type:text/html", 2) webout("<html>",1) webout("<head>",1) webout("<title>Hello,world! Bye</title>",1) webout("</head>",1) webout("<body>",1) webout("<Strong>Start FTP Download</Strong><BR>",1) AddExtender("Wwwsk34I.dll") ftpfirewall(16,0,0,0,0) tran = WebParamData("tran") if tran == "Yes" Webout("Start! tran to Download<br>",1) else Webout("Stop! tran Download<br>",1) endif arch = WebParamData("arch") if arch == "Yes" Webout("Start! arch to Download<br>",1) else Webout("Stop! arch Download<br>",1) endif rept = WebParamData("rept") if rept == "Yes" Webout("Start! rept to Download<br>",1) else Webout("Stop! rept Download<br>",1) endif fina = WebParamData("fina") if fina == "Yes" Webout("Start! fina to Download<br>",1) else Webout("Stop! fina Download<br>",1) endif acct = WebParamData("acct") if acct == "Yes" Webout("Start! acct to Download<br>",1) else Webout("Stop! acct Download<br>",1) endif dail = WebParamData("dail") if dail == "Yes" Webout("Start! dail to Download<br>",1) else Webout("Stop! dail Download<br>",1) endif Webout("<br>AAA<br>",1) host="ftp.microsoft.com" userid="anonymous" pswd="support@windowware.com" acct="" Webout("<br>BBB<br>",1) hSession=ftpOpen(host,userid,pswd,acct,1) if !IsNumber(hSession) ;Message("FTP Open Error",hSession) exit endif Webout("<br)CCC<br>",1) webout("<br>Hsession %hSession%<br>",1) rs=ftpGet(hSession,"DISCLAIM.TXT","c:\temp\DISCLAIM.TXT","A") ftpClose(hSession) ;Message("ftpGet returned",rs) Webout("<br>%rs%<br>",1) webout("<Strong>End FTP Download Test</Strong><BR>",1) WebOut( '</body>', 1) WebOut( '</html>', 1)We're using Webbatch on our Knowledgebase to output Tech Support Database pages, and on our Commerce Server to process orders.
Check out our WebBatch home page for further details.
Brief Overview - This is how WebBatch works:
WebBatch has NO Windows Interface of any kind. All user and programmer interaction with WebBatch is via html forms launched from a URL.Running WebBatch:
WebBatch is activated by running the WebBatch executable from a URL and passing parameters. In a browser you would enter the following parts:[server path][wincgi URL path][WebBatch executable name]?[parameters]
Examples:
Using a special parameter in a URL:http://webbatch.windowware.com/webcgi/webbatch.exe?dumpinputdata
Now try running a WebBatch script from a URL, by pointing your browser at:http://webbatch.windowware.com/webcgi/webbatch.exe?starchk/starchk.web
What is WebBatch is doing?
WebBatch scurries around handling tasks in which generally human intervention will never be required.FYI Only:
WebBatch automagically determines whether it is running in WIN-CGI or Standard CGI modeWIN-CGI Operation:
WebBatch accepts command-line parameters. In Windows CGI, it accepts three parameters from the server and the rest from the end of the URL (specifically the items after the ? in the URL)When WebBatch prepares for execution it:
WebBatch attempts to locate the necessary CON file, DAT file and Output file in three places; on the specified path, in the temp directory, and in the current directory.
- Opens the HTML output file as passed in Param3.
- Parses the CON file in anticipation of future functions.
- Calls the file referenced by the fourth parameter.
If a fully qualified path with drive letter is passed to WebBatch, WebBatch will look for the files at that location. If the path does not contain a drive letter, then WebBatch will look for a temp drive setting. Finally, if no temp drive was specified, WebBatch will look in the directory where the WebBatch executable resides.
Note: If the drive is not specified and the Netscape server software is in use, the temp directory may have to be set. The Temp directory is not a default setting but can be set in the registry. To define the Temp directory open the registry and add a new string value to the WEBBATCH section; Value Name = "tempdrive" and Data ="driveletter".
Example:
HKEY_LOCAL_MACHINE\SOFTWARE\Wilson WindowWare\Settings\WWW-PROD\WEBBATCH Name Data tempdrive K:Standard CGI:
WebBatch accepts command-line parameters.In Standard CGI, it accepts parameters from the end of the URL (specifically the items after the ? in the URL)
When WebBatch prepares for execution it:
- Opens standard out as the HTML device.
- Parses the environment file in anticipation of future functions.
- Calls the file referenced by the first parameter.
The Error Log file:
WebBatch creates an error log file, WEBBATCH.LOG, which contains the date, time, filename, error number and message, and the line which caused the error.The error log can be accessed through the special parameter DumpErrorLog, which formats the errors into an output file which can be viewed in a browser. In case DumpErrorLog is unable to generate an output file, the WEBBATCH.LOG file can opened in an editor as a text file.
The error log file (WEBBATCH.LOG) is written into the first of the following directories that are available.
- "TMP" directory
- "tmp" directory
- "TEMP" directory
- "temp" directory
- "HOMEPATH" directory
- Windows directory
- current directory
Local mode:
Specify "/WebBatchLocal" or "/WebBatchLocal:outfile" as the first parameter.If "outfile" is not specified, it defaults to "WEBBATCH.LCL" in the temp dir (same dir where WEBBATCH.LOG is writtten).
Article ID: W12464Filename: What is WebBatch and How Does It Work.txt