LUALoriotPro WEB site

LoriotPro scripting documentation
Extensions for LUA language

Table of contents Search function

Print the current page Mail this  link UTUBE Channel version française

lpav.SetOption - Change graphical objet global parameters

LoriotPro has extended the LUA sripting language by providing its own LUA libraries. The new functions provided are dedicated to the creation of monitoring and SNMP automation application.

Syntax

lpav.SetOption(optionref, 'value') ;

Description

Change the parameters of a graphical object.

Parameters

Optionref - The referenece of the parameter to modify as define in the loriotinit.lua file

dofile(lp.GetPath().."/config/script/loriotinit.lua");

value - The new value to assign to the option

Optionref Value description
LPAV_NAME The object name
LPAV_FONTNAME The text font name
LPAV_FONTSIZE The text font size
LPAV_LINEWIDTH The line width
LPAV_LINESTYLE The line style
LPAV_EXPRESSION The expression
LPAV_POLLING

1 - Polling enable (dynamic object)
0 - Polling disable

LPAV_POLLING_INTERVAL The polling interval (mini 15 s)
LPAV_SELECTED

1 - Object selected
0 - Object not selected

LPAV_OBJECTTYPE The object type
LPAV_HIDEN_TEXT

1 - hidden text
0 - not hidden

LPAV_NOBORDER

1 - border when mouse over
0 - no border

LPAV_TEXTMODE  
LPAV_TEXTSTYLE see link below
LPAV_UNIT Unit apply to a Vumeter object
LPAV_X The position of the object from the left border of the drawing area
LPAV_X1 The horizontal size of the object
LPAV_Y The position of the object from the top border of the drawing area
LPAV_Y1 The vertical size of the object
LPAV_TYPE

The object type

LPAV_OBJ_WORLD =0;
LPAV_OBJ_COUNTRY =1;
LPAV_OBJ_ORGANIZATION =2;
LPAV_OBJ_ORGANIZATION_UNIT = 3;
LPAV_OBJ_NETWORK =4;
LPAV_OBJ_HOST_1 =6;
LPAV_OBJ_ROUTER =7;
LPAV_OBJ_SHORTCUT_1 =8;
LPAV_OBJ_SHORTCUT_2 =9;
LPAV_OBJ_MRTG =10;
LPAV_OBJ_PLUGIN =11;
LPAV_OBJ_BADPLUGIN = 12;
LPAV_OBJ_LORIOTPRO = 13;
LPAV_OBJ_HOST_2_ROUTER = 15;
LPAV_OBJ_HOST_3_SWITCH =16;
LPAV_OBJ_HOST_4 = 17;
LPAV_OBJ_HOST_5 = 18;
LPAV_OBJ_HOST_6 = 19;
LPAV_OBJ_VIEWPLUGIN =20
LPAV_OBJ_HOST_SERVER = 27;
LPAV_OBJ_HOST_IMPRIMANTE =28;
LPAV_OBJ_HOST_PHONE =29;
LPAV_OBJ_RECT = 30;
LPAV_OBJ_CIRCLE = 31;
LPAV_OBJ_FILL_RECT = 32;
LPAV_OBJ_FILL_CIRCLE = 33;
LPAV_OBJ_H_LINE = 34;
LPAV_OBJ_V_LINE = 35;
LPAV_OBJ_DIR_EMF = 36;
LPAV_OBJ_TEXT = 37;
LPAV_OBJ_FILL_TEXT = 38;
LPAV_OBJ_FULL_RECT = 39;
LPAV_OBJ_FULL_CIRCLE = 40;
LPAV_OBJ_H45_LINE = 41;
LPAV_OBJ_V45_LINE = 42;
LPAV_OBJ_FULL_TEXT = 43;
LPAV_OBJ_BASIC_SHAPE = 44;
LPAV_OBJ_ANALOGIC_METER_01 = 45;
LPAV_OBJ_HOST_HUB = 46;
LPAV_OBJ_CONNECTOR =144;

LPAV_CONNECTED_TO1 uid - UID of a connected object
LPAV_CONNECTED_TO2

uid - UID of a connected object

Example :

lp_value = 0;
lp_buffer ="error";

dofile(lp.GetPath().."/config/script/loriotinit.lua");

zz=LPAV_OBJ_ANALOGIC_METER_01;

-- Créé des objects r s
k=0;
for i=0,20 do
lpav.Insert(10*i,1,9,9,zz);
if (k==0) then lpav.SetRef(1,"r"); k=1; else lpav.SetRef(1,"s"); k=0; end
lpav.SetBrush(0,255,0);
lpav.SetFontName("Mistral");
lpav.SetName(i);
lpav.SetClipart( lp.GetPath().."/card/vumeters/vumeter8.emf");
lpav.SetOption(LPAV_UNIT,"%");
end
zz=LPAV_OBJ_FILL_CIRCLE;
-- Créé des objects s r
for i=0,20 do
lpav.Insert(10*i,30,9,9,zz);
if (k==0) then lpav.SetRef(1,"s"); k=1; else lpav.SetRef(1,"r"); k=0; end
lpav.SetBrush(0,255,0);
lpav.SetName("test-r"..i);
lpav.SetOption(LPAV_LINESTYLE,55);
end

lpav.ClearAllSelected()
--lpav.DeleteAllSelected();
i=lpav.FindRef(1,0,"r","a");
if (i>0) then
for j=0, i do
-- lp.Trace("pass"..j);
if lpav.SelectUID(a[j]) then
lpav.SetLineColor(255,45,89);
lpav.SetLineWidth(3);
end
end
end
i=lpav.FindRef(1,0,"s","aa");
if (i>0) then
for j=0, i do
--lp.Trace("pass"..j);
if lpav.SelectUID(aa[j]) then
lpav.SetLineColor(255,45,255);
lpav.SetLineWidth(5);
x,y,x1,y1=lpav.GetPosition();
lpav.SetPosition(x,y+10,x1,y1);
lpav.Insert(1,1,100,100,LPAV_OBJ_CONNECTOR);
lpav.SetOption(LPAV_CONNECTED_TO1,a[j]);
lpav.SetOption(LPAV_CONNECTED_TO2,aa[j]);
lpav.SetOption(LPAV_LINEWIDTH,1);
lpav.SetLineColor(100,45,45);
end
end
end
lp.Trace("fin");
lpav.RefreshMap();

LPAV_ISRATIO

1 - The proportions of the object are kept when changing the size of the object
0 - Proportions are lost

LPAV_LEFT_MOUSE_MENU 1 - The contextual menu of the object is opened with the left mouse button
0 - The default (right click)
LPAV_RESULT_IS_TEXT

1 - The text inside a graphical Text object is replaced by the result of the expression
0 - No change

LPAV_OBJ_TEXT = 37;
LPAV_OBJ_FILL_TEXT = 38;
LPAV_OBJ_FULL_TEXT = 43;

LPAV_RESULT_IS_NAME

1 - the object name is replace by the result of the expression
0 - no change

This is equivalent to the graphical option Fill Name below:

LPAV_REF1 A character string assigned to the user define reference variable 1.
Use with the lpav.FindRef, lpav.GetRef, lpav.SelectAllRef, lpav.SetRef functions.
LPAV_REF2 A character string assigned to the user define reference variable 2.
Use with the lpav.FindRef, lpav.GetRef, lpav.SelectAllRef, lpav.SetRef functions.
LPAV_REF3 A character string assigned to the user define reference variable 3.
Use with the lpav.FindRef, lpav.GetRef, lpav.SelectAllRef, lpav.SetRef functions.
LPAV_REF4

A character string assigned to the user define reference variable 4.
Use with the lpav.FindRef, lpav.GetRef, lpav.SelectAllRef, lpav.SetRef functions.

LPAV_ISCOUNTER

1 - snmp counter value
0 - other snmp type

This is equivalent to the graphical option below:

LPAV_CONNECTOR_AUTO_ALIGN

1 - The connector object (line between two objects) is automatically positioned
0 - disable

LPAV_OBJ_CONNECTOR =144;

LPAV_NOIPSOURCE_TEST

0 - The IP source is checked
1 - The IP source is not checked. The snmp agent can use any IP address to answer.

This is equivalent to the graphical option below:

LPAV_NOSELECTABLE 1 - The object can not be selected with a single mouse click
LPAV_CLIPART A charactere string that defines the clipart file attached to this object.
LPAV_STATUS  
LPAV_MAPTYPE  

Return Values

result=1 if ok, nil if error

Example


lp_value = 0;
lp_buffer ="error";

dofile(lp.GetPath().."/config/script/loriotinit.lua");

zz=LPAV_OBJ_ANALOGIC_METER_01;

-- Créé des objects r s
k=0;
for i=0,20 do
lpav.Insert(10*i,1,9,9,zz);
lpav.SetOption(LPAV_X,10*i);
lpav.SetOption(LPAV_Y,1);
lpav.SetOption(LPAV_X1,10*i);
lpav.SetOption(LPAV_Y1,10*i);
if (k==0) then lpav.SetRef(1,"r"); k=1; else lpav.SetRef(1,"s"); k=0; end
lpav.SetBrush(0,255,0);
lpav.SetOption( LPAV_FONTNAME,"Mistral");
lpav.SetOption(LPAV_NAME,"test");
lpav.SetOption( LPAV_CLIPART, lp.GetPath().."/card/vumeters/vumeter8.emf");
lpav.SetOption(LPAV_UNIT,"%");
end
zz=LPAV_OBJ_FILL_CIRCLE;
-- Créé des objects s r
for i=0,20 do
lpav.Insert(10*i,30,9,9,zz);
if (k==0) then lpav.SetRef(1,"s"); k=1; else lpav.SetRef(1,"r"); k=0; end
lpav.SetBrush(0,255,0);
lpav.SetName("test-r"..i);
lpav.SetOption(LPAV_LINESTYLE,55);
end

lpav.ClearAllSelected()
--lpav.DeleteAllSelected();
i=lpav.FindRef(1,0,"r","a");
if (i>0) then
for j=0, i do
-- lp.Trace("pass"..j);
if lpav.SelectUID(a[j]) then
lpav.SetLineColor(255,45,89);
lpav.SetLineWidth(3);
end
end
end
i=lpav.FindRef(1,0,"s","aa");
if (i>0) then
for j=0, i do
--lp.Trace("pass"..j);
if lpav.SelectUID(aa[j]) then
lpav.SetLineColor(255,45,255);
lpav.SetLineWidth(5);
x,y,x1,y1=lpav.GetPosition();
lpav.SetPosition(x,y+10,x1,y1);
lpav.Insert(1,1,100,100,LPAV_OBJ_CONNECTOR);
lpav.SetOption(LPAV_CONNECTED_TO1,a[j]);
lpav.SetOption(LPAV_CONNECTED_TO2,aa[j]);
lpav.SetOption(LPAV_LINEWIDTH,1);
lpav.SetLineColor(100,45,45);
end
end
end
lp.Trace("fin");
lpav.RefreshMap();

 


www.loriotpro.com