Script Wizard

Script Wizard

Script Wizard provides scripting support of dynamic Pascal compiling and execution in IDE by RemObjects Pascal Script, including Script Window and Script Library. Script items can be called in menu item or triggered by some Events.

Script Window

Users can use IDE Edit Window to edit a Pascal script file and use Script Window to compile and run it. The window contains toolbar and messages area. It is as below:

 

Script Library

Script Library allows user to manage sripts files and settings. Script items are shown in Script Wizard menu item. The Script Library window contains toolbar, script list and script item area. It is as below:

 

 

What's the Grammar of PascalScript?

PascalScript Grammar is almost the same with Object Pascal. But below are to be specified:

 

How to use Libraries?

Functions or Procedures that can be called in CnWizards' PascalScript environment should be registered in CnWizards while compiling. Now CnWizards has registered some system functions including Sysutils, Classes, Windows and ToolsApi, etc. The registered list is in PSDecl directory in CnWizards installation destination. Note: The list Pascal files are not used in runtime in CnWizards, only for reference. They come from VCL source but only interface part left for registering and maybe modified for PascalScript grammar. Those functions or procedures listed in the PSDecl files can be called in PascalScript environment in CnWizards. For the details help of a function or procedure in the listed files, users can search Delphi's help for they're the same prototypes.

Some PascalScript Demos are placed in PSDemo directory in CnWizards installation destination. Users can read them.

Contents in both directory are in continuous development. Welcome to write customized PascalScript to enhance CnWizards and IDE.

 

How to Write Code?

You can use your favorite editor to write PascalScript code. Certainly, IDE's Code Editor is a good choice. You can write a script just like write Object Pascal code, and use the Code Input Helper of CnWizards to help your writing in IDE's Code Editor. Note: To use Code Input Helper or IDE's Code Insight, you need to add all needed path to your IDE Search Path. For example, if ToolsApi was used, "Source\ToolsAPI" directory need to be added. And if CnWizUtils.pas was used, "PSDeclEx" directory should also be added.

 

How to Play with Event?

A Pascal Script can be called manually or by event(s). You can use the global object "Event" to obtain the event type or parameters. Event is an instance of TCnScriptEvent. Its Mode property represents the event type, corresponding to smManual, smIDELoaded, smBeforeCompile, smAfterCompile, smFileNotify, smSourceEditorNotify, smFormEditorNotify. So we can know the event type if we check Event.Mode value in script. Some events contains not only the event type, but also some other information, e.g. filename, source editor, etc. In this situation, Event is an instance of TCnScriptEvent's sub class. We can use a typecast to convert Event to TCnScriptEvent's sub class to get more parameters.

More information, please refer to PSDeclEx\ScriptEvent.pas and other Event demos in PSDemo directory.

 

Links

Basic Operation

CnWizards Settings

About CnWizards

 


Copyrights 2001-2015 CnPack Team