Programming Guide (JScript)



Yüklə 6,96 Mb.
Pdf görüntüsü
səhifə22/22
tarix07.11.2018
ölçüsü6,96 Mb.
#78683
1   ...   14   15   16   17   18   19   20   21   22

97
name
type
value
range
1
Test run
Item
Runs the script with the test event
-
-
 -
2
Test run
in 
third-
party
debugger
Item
Runs the script using the
third-party debugger
-
-
-
3
Edit test event
Item
Opens the window for editing test events
-
-
-
4
Summary
information
Item
Opens the Thread Information
window showing system, test and user
messages related to the current script
-
-
-
5
Go to line
Item
Opens the window for entering the script
line and character number to go to
-
-
-
The Message list menu elements
The 
 menu contains commands for changing the message display parameters in the debugger window.
Message list
Table describes the elements of the 
 menu.
Message list

Element
name
Element 
type
Description
Units
Defaul
t
value
Value 
range
1
Clear
Item
Clears the
 field
 Description
in the debugger window
-
-
 
2
Colors
Item
Opens the window allowing to
specify the words that a line should
contain to be highlighted in color
-
-
-
3
Search
Item
Searches for a word in the 
 
Description
window
-
-
-
4
Set filter
Item
Opens the window allowing to set the filtering
criteria for the messages in the debugger window.
-
-
-
5
Apply filter
Item
Applies the current filter
-
-
-


98
1.  
2.  
The Filter dialog window
The Filter window allows to set the filtering criteria for the messages displayed in the 
 field of the debugger window.
Description
To open the Filter window, do one of the following:
Click the Edit test message (
) button in the 
 toolbar.
Editor-Debugger
In the 
, select 
.
Debug and edit menu
Edit test message
Figure shows the Filter window.
Table describes the elements in the Filter window.
№ Element 
name
Element 
type
Description
Units
Defaul
t
value
Value
range
1
Include
Text field
Only the lines containing the
Latin, Cyrillic and
Empty
Unlimited number


99
1.  
2.  
words from this field will be
displayed in the debugger window
special symbols
of characters
2
Exclude
Text field
The lines containing the words from
this field will not be displayed
in the debugger window
Latin, Cyrillic and
special symbols
Empty
Unlimited number
of characters
The Color dialog window
The 
 dialog window is used for setting up color highlighting of the lines containing certain words.
Color
To open the 
 window, do one of the following:
Color
Click the Colors (
) button in the 
 toolbar.
Editor-Debugger
In the 
t menu, select 
.
Message lis
Colors
Figure shows the Color window.


100
Table describes the elements in the 
 window.
Color
 
№ Element 
name
Element
type
Description
Units
Defaul
t
value
Value
range
1
Words
Text field
Contains the words or any sequences
of characters, that make the line
containing one of them, highlighted.
Latin, Cyrillic
and special symbols
Empty
Unlimited number
of characters
2
Color
Drop-down
list
The color for highlighting the lines
RGB format
Grey
RGB colors
The toolbar of the Editor-Debugger utility


101
The 
 toolbar is used for calling frequently used functions of the utility.
Editor-Debugger
The toolbar operates in two modes: when the script control buttons are active, or when the debugger window control buttons are active.
The mode depends on the currently active tab of the 
 utility: either the 
 tab for editing scripts, or the 
 tab for viewing messages 
Editor-Debugger
Script Debug/Edit
Script Messages
in the debugger window.
Figure shows the toolbar in the script editing mode.
Table shows the elements of the toolbar in the script editing mode.

Element
name
Element 
type
Description
Units
Defaul
t
value
Value 
range
1
Test run
Button
Runs the script with the test event
-
-
-
2
Test run in third-party
Button
Runs the script using the third-party debugger
-
-
-


102
debugger
3
Save
Button
Saves the script to the Script object
-
-
-
4
Edit test event
Button
Opens the window for editing test events
-
-
-
5
Summary information
Button
Opens the Thread Information window that displays
system, test and user messages related
to the current script
-
-
-
Figure shows the toolbar in the script debugging mode.
Table shows elements of the toolbar in the script debugging mode.

Element
name
Element 
type
Description
Units
Defaul
t
value
Value 
range


103
1.  
2.  
1.  
2.  
3.  
4.  
5.  
1.  
2.  
1
Clear
Button
Clears the Description field in the debugger window
-
-
 
2
Colors
Button
Opens the window allowing to specify the words that
a line should contain to be highlighted in color
-
-
-
3
Search
Button
Searches for a word in the Description window
-
-
-
4
Set filter
Button
Opens the window allowing to set the filtering criteria
for the messages in the debugger window.
-
-
-
5
Apply filter
Button
Applies the current filter
-
-
-
Appendix 2. Creating virtual objects with ability to set events, 
reactions and states
Purpose of virtual objects and their implementation in Intellect
Virtual objects represent software emulation of new 
objects and allow configuring their states, reactions and events. Virtual objects are handled using scripts, macrocommands 
Intellect 
and macroevents.
Virtual objects are created using the ddi.exe and CustomTypeEditor.exe utilities in the <
 installation folder>\Tools.
Intellect
In the 
 section you can find an example of creating 2 types of virtual objects that can be used to show the state of abandoned object detection tool on the 
How to create a virtual object
map or to show any other user states. The states of objects are changed using macros, scripts or via IIDK.
How to create a virtual object
Here one can find out how to create the following virtual objects:
CUSTOM type with SLAVE (Computer) parent type.
CUSTOM_CHILD type with CUSTOM parent type (see item 1).
An object of the CUSTOM type has the property set:
Custom_param1 and custom_param2 parameters
Events: ALARM, INFO, ON, OFF
Reactions: ON, OFF
States: ON, OFF
State machine:
Set ON state for ON event
Set OFF state for OFF event
The CUSTOM_CHILD type of the object is created to demonstrate tree structure and has no user parameters, events, reactions or states.
dbi file preparation


104
1.  
2.  
3.  
4.  
A dbi file is prepared using the ddi.exe utility. Details on how to handle it can be found in the 
 section of 
The ddi.exe utility for editing database templates and external settings files
Adm
.
inistrator's Guide
 A dbi file for objects of CUSTOM and CUSTOM_CHILD type is created as follows:
Run dbi.exe (see 
).
The ddi.exe utility for editing database templates and external settings files
Go to the 
tab.
DBI 
Create two objects – OBJ_CUSTOM and OBJ_CUSTOM_CHILD – as shown in the figure below.
Save changes using the 
 command in the 
 menu. The saved file must have dbi extension and must be located in 
 installation directory - C:\Program Files (x86)
Save
File
Intellect
\Intellect\intellect.custom.dbi
dbi file preparation is complete.
ddi file preparation
Important!
Object (table) names should look like OBJ_.
Note.
Id, name, parent_id, flags and guid parameters are mandatory for all objects. Custom_param1 and custom_param2 are user parameters.


105
1.  
2.  
A ddi file is prepared using the ddi.exe utility. Details on how to handle it can be found in the 
 section of 
  
 files
The ddi.exe utility for editing database templates and external settings
Ad
.
ministrator's Guide
A ddi file for CUSTOM and CUSTOM_CHILD object types is created as follows:
Run ddi.exe (see 
).
The ddi.exe utility for editing database templates and external settings files
Create CUSTOM and CUSTOM_CHILD objects in the 
 tab as shown below.
DDI


106
3.  
4.  
Go to the 
 tab and configure events that are to be supported by the object (see the figure).
Events
Go to the 
 tab and configure reactions that are to be supported by the object (see the figure).
Reactions
Note.
Reactions of virtual objects are automatically converted into events. In other words, a virtual object automatically generates an event when there is a reaction.


107
4.  
5.  Go to the 
 tab and describe the states that the object can take. Here there are two states – ON and OFF.
States
Note.


108
5.  
6.  
7.  
Go to the 
 tab and set the object state change logic.
Transition rules
Transition rules is a simple state machine – an event is an input action and a state is a result.
An unconditional transition is used in this case: if CUSTOM||ON event is received, then there is transition to the ON state, if CUSTOM||OFF event is received, then there is 
transition to the OFF state.
To save changes use the 
 command in the 
 menu. The saved file must have the ddi extension and be stored in the folder corresponding to the required language, e.g. 
Save
File
C:\Program Files (x86)\Intellect\Languages\en\intellect.custom.ddi
The ddi file preparation is completed.
XML file preparation
An XML file is prepared using the CustomTypeEditor.exe utility that can be found in <
 installation directory>\Tools. The utility overview is shown below.
Intellect
 
The postfix of file name is specified in the 
 column – the image that is stored in <
 installation directory>\Bmp. For instance, these will be custom_off.
Image
 Intellect
bmp and custom_on.bmp files (corresponding to ON and OFF states) for CUSTOM object. These files will be used by the map module.


109
1.  
2.  
3.  
4.  
5.  
An XML file for a virtual object is created as follows:
Specify the name of object type in the 
 field (1).
object_type
Specify the name of parent type in the 
 field (2).
parent_type
If the object type has child types, then set the 
 checkbox checked (3).
has_child
Repeat steps 1-3 for all object types.
Save a file with any name in the 
 installation directory using the 
 – 
command.
Intellect
File
Save 
The XML file is now created. The file contents look like this:



CUSTOM
SLAVE
1


CUSTOM_CHILD
CUSTOM


Modify it manually if required.
Creating and using a virtual object in Intellect
On the page:
Showing on the map


110
Using in macros
Sample program in Jscript to change virtual 
object state
 
When dbi, ddi and XML files are ready objects of a new type along with standard objects can be created in 
 hardware tree.
Intellect
 
User parameters are displayed on the settings panel of the created virtual object – custom_param1 and custom_param2 in this example. Their values can be set in the table.


111
Showing on the map
When an object is created in the hardware tree it can be placed on the map and set reactions can be executed in the object context menu (see 
Configuring the interactive map for 
).
object state indication and controlling the objects
 
Using in macros
When a virtual object is created in the hardware tree it can be used in macros.


112
 
Sample program in Jscript to change virtual object state
Problem. Using macro 1 change a state of virtual object 1 to ON and show the icon corresponding to this state on the map.
Solution. As state transition rules are set, when ON event is sent from the virtual object the state will be automatically changed to ON and the icon specified in ddi file (see 
ddi file 
) to this state will be shown on the map. A script for sending ON event looks like this:
preparation
 
if (Event.SourceType == "MACRO" && Event.SourceId == "1" && Event.Action == "RUN")
{
Note.
Reactions of virtual objects are automatically converted into events. Thus, in the sample when 
reaction is executed the object state changes thanks to set state transition 
ON 
rules (see 
) and the icon corresponding to the state will be shown on the map.
ddi file preparation


113
    var msgevent = CreateMsg();
    msgevent.SourceType = "CUSTOM";
    msgevent.SourceId = "1";
    msgevent.Action = "ON";
    NotifyEvent(msgevent);
}

Document Outline

  • Programming in JScript
    • JScript functionality in Intellect
    • Description of the JScript object model in Intellect
      • The Core object and its built-in methods
        • The Core object
        • The SetObjectParam method
        • The SetObjectState method
        • The DebugLogString method
        • The Base64Decode method
        • The Sleep method
        • The Itv_var method
        • The Int_var method
        • The GetObjectParentType method
        • The GetIPAddress method
        • The GetObjectName method
        • The GetObjectState method
        • The GetObjectParam method
        • The GetObjectParentId method
        • The DoReactStr method
        • The DoReact method
        • The DoReactSetupCore method
        • The DoReactSetup method
        • The DoReactGlobal method
        • The NotifyEventStr method
        • The NotifyEvent method
        • The NotifyEventGlobal method
        • The CreateMsg method
        • The Lock and Unlock methods
        • The IsAvailableObject method
        • The GetUserId method
        • The GetEventDescription method
        • The GetObjectIdByParam method
        • The SaveToFile method
        • The GetLinkedObjects method
        • The WriteIni method
        • The ReadIni method
        • The AddIni method
        • The SetTimer method
        • The KillTimer method
        • The GetObjectChildIds method
      • The MsgObject and Event objects and their built-in methods and properties
        • The MsgObject and Event objects
        • The GetSourceType method
        • The GetSourceId method
        • The GetAction method
        • The GetParam method
        • The SetParam method
        • The MsgToString method
        • The StringToMsg method
        • The StringToParams method
        • The Clone method
        • The GetObjectIds method
        • The GetObjectParams method
        • The SourceType property
        • The SourceId property
        • The Action property
    • Programming tools
      • The Script object
      • The Editor-Debugger utility
      • The Debug window
        • Enabling the Debug window
        • Working with Debug window
          • Copying information on event or reaction to the clipboard
          • Highlighting messages
          • Event and reaction filter
          • Searching for events and reactions
          • Clearing the Debug window
      • Getting the list of object names, reactions and events in INTELLECT™
    • Creating, saving and deleting scripts
      • Creating a script
      • Saving a script
      • Deleting a script
    • Creating your first script
    • Script debugging
      • Script debugging features
      • Creating and using test events
        • Creating test events
        • Running the script with a test event
      • Using debugger windows of the Editor-Debugger utility
        • Debugger window types: Script Messages and Thread Information
        • Displaying messages about starting, verifying, changing and executing scripts in the debugger windows
      • Using third-party debugger programs
    • Examples of scripts in JScript language
  • Programming Guide (JScript). Conclusion
  • Appendix 1. Description of the Editor-Debugger utility
    • The purpose of the Editor-Debugger utility
    • The interface of the Editor-Debugger utility
      • The Editor-Debugger window
      • The Script Debug/Edit tab
        • Description of the Script Debug/Edit tab
        • The Script object panel in the Script Debug/Edit tab
      • The Script Messages tab
        • Description of the Script Messages tab
        • The Script object panel in the Script Messages tab
      • Main menu
      • The Filter dialog window
      • The Color dialog window
      • The toolbar of the Editor-Debugger utility
  • Appendix 2. Creating virtual objects with ability to set events, reactions and states
    • Purpose of virtual objects and their implementation in Intellect
    • How to create a virtual object
      • dbi file preparation
      • ddi file preparation
      • XML file preparation
      • Creating and using a virtual object in Intellect

Yüklə 6,96 Mb.

Dostları ilə paylaş:
1   ...   14   15   16   17   18   19   20   21   22




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə