cwScript 1.0 ManualCopyright (c) 2000 by The Network Connection, Inc.
All Rights Reserved
What is cwScript
cwSript is an active server component (Activex OCX Control) that executes Script commands within Clarion. Through properties and methods, script code can be executed, and variables can be read and written to at runtime from a Clarion program.Some examples of programs that can be written are:
- SQL programs using Microsoft's ADO technology.
- Automation programs that have full control of Microsoft's Office Suite through OLE.
- Email clients that access SMTP and POP3 servers using DLLs from companies like Mabry.
- Any program that can make use of VB or third party ActiveX DLLs.
System Requirements
General Requirements
- Windows 95/98 or Windows NT 4.0+/Windows 2000.
- Clarion for Windows version 2.1 or later.
Clarion Demo Application
The CW Demo Application will be available on August 1, 2000.
Getting Started
Download and install the demo file above. The xScripting.OCX file will be installed and registered in your windows\system directory. A demo CW 4 application will be installed in C:\Program Files\CWScripting. You should be able to open the APP with a later version of Clarion.
Using cwScript
To use cwScript in a CW application, you must create a 32 bit application and place an instance of the xScripting control on your CW form. Follow the steps below to accomplish this.
- With a CW form displayed select the OLE Control from the Toolbox. Move the curser over the form and place the control on the from by dragging the mouse.
- Right click on the OLE Control and select properties. Check the 32-bit box and select the Ocx radio button. From the Object Type pull down select xScripting.xScript. The Ole Property form show look like this:
Sample CW Application
cwScript is shipped with a sample CW application that allows you to test some ActiveX DLLs.Scripting Documentation
For more information on Microsoft's Scripting Technology look at http://msdn.microsoft.com/scripting/default.htm.
Object Reference
cwScript Properties
Property and Type Comments Example AllowUI As Integer 0=False, 1=true. If true then MSGBOX and other pop-up windows can be used. (default=true) Read/Write ?ole{'AllowUI'}=0 ErrorColumn As Integer The column that an error occurred on. Read Only loc:EC=?ole{'ErrorColumn'} ErrorLine As Integer The line that an error occurred on. Read Only loc:EL=?ole{'ErrorLine'} ErrorDescription As String Text description of error. Read Only loc:Des=?ole{'ErrorDescription'} ErrorNumber As Integer Error number. Read Only loc:EN=?ole{'ErrorNumber'} Language As String Scripting Language to Use. VBScript or JavaScript. Default=VBScript. Read/Write ?ole{'Language'}='JavaScript' AddCode As String Set code to execute. Write Only ?ole{'AddCode'}=loc:Code Run As String Procedure name to execute. Write Only ?ole{'Run'}='MainProcedure' ExecuteStatement As String Run Current Statement. Must Be Valid Script Syntax. Write Only ?ole{'Execute'}='sVar="Hello World"' Execute As String Same As ExecuteStatement cwEval(Script As String) As String Evaluates any Valid Script Statement. Read/Write ?ole{'cwEval'}='now' loc:vbTime=?ole{'cwEval}
ScriptPath As String Path of Script File. If ="" then full path must be used in ScriptFile. Read/Write ?ole{'ScriptPath'}='C:\Windows' ScriptFile As String Name of file containing script. When Read returns FileName, when written to loads script text file. ?ole{'ScriptFile'}='Script.Txt' ScriptText As String Script text loaded by ScriptFile. Read Only loc:Script=?ole{'ScriptText'} Timeout As Integer Script Timeout. -1=Unlimited, 0=Automatic (Default) ?ole{'TimeOut'} = -1 ErrNumber as Integer Internal error number. (See Below) Read Only ErrDescription as String Internal error description. Read Only LogStatus as Integer Write LogFile 0=False, 1=True (Default=0) ?ole{'LogStatus'=1 LogFile as String Log File Name (Default=OCX Path\xScriptingLog.Txt) ?ole{'LogFile'}='C:\MYLOG.TXT'
cwScript MethodsError Codes
Method Name Comments About Displays Registration and Version Information. Reset Clears current Script. LogReset Clears Log File.
Error Code Description 0 No Error 1 Script Text File Not Found.