Object Pm

Global object in the PROMOTIC system accessible by the Pm name.

The basic concept of VBScript and JavaScript languages makes them ideal for safe programming. For example the standard functions of the VBScript language include powerful instruments for algorithm creation, but do not offer any means cor connection with hardware environment. For example these do not allow writing to or reading disk, setting time, control I/O units, etc.
The best approach how to upgrade the JavaScript/VBScript language by functionality that language functions don't have, is to create objects that have the required properties and methods.
In the PROMOTIC system there is a large number of such objects (so-called Pma objects) that enable an access to databases, access for serial link and for Ethernet, calling of a DLL connection, etc.
By calling methods over the Pmg object we usually accomplish the status change of the concrete object (of this instance). It means that methods of these objects don't have global character.
In the PROMOTIC system there is one global object accessible directly from any hierarchical level of the tree. This object is accessible in the script by the "Pm" variable (i.e. calling in the script it is Pm.MethodName). The Pm object contains properties and methods that extend the functions set, for example, by writing to disk, time setting, data setting, etc.

Pm application properties and methods:
AlSoundEnable/disable sound notification of alarms
AppFullNamePath to the application with the application name
AppNameThe PROMOTIC application name
AppPriorityApplication priority
AppStop()Termination of the application
AxGetObject()Creates a reference to ActiveX object
Beep()Replay of the Windows OS system sound
CallAxMethod()Calling ActiveX object methods in the JavaScript language
ClockStart()Starting the time clock
ClockStop()Stopping the time clock
ColorOper()Various operations with defined color
ColorRgb()Returns the color by entering the three RGB components
ControlSound()Controls of the sound server of the PROMOTIC system
CreatePmAction()Creates object of the PmAction type
CreatePmArray()Creates object of the PmArray type
Array1()Creates and fills 1-dimensional array with values
CreatePmBuffer()Creates object of the PmBuffer type
CreatePmExpr()Creates object of the PmExpr type
CreatePmForm()Creates object of the PmForm type (obsolete)
CreatePmFormat()Creates object of the PmFormat type
CreatePmMap()Creates object of the PmMap type
CreateProcess()Starting the program (*.exe, *.com, *.bat) without waiting for the termination
CreateProcessSync()Starting the program (*.exe, *.com, *.bat) with waiting for the termination
DdeExecute()Sending the command to the DDE server
EvalMacro()Evaluation of the macro expression
FindViewers()Returns the list of object viewers according to selected criteria
GenerateId()Returns a unique numeric identifier
GetActiveWorkspace()Returns active PmaWorkspace object.
GetRtLangs()Returns the list of all national languages supported in the application
GetSystemInfo()Returns the system information
HttpFormDataParse()Parsing data from uploaded files
HTTPGetFormValue()Decoding the text string delivered from the Web browser
JsonParse()Transforms JSON format text into object, array or elementary value
JsonStringify()From object, array or elementary value creates text in the JSON format
LicenceInfo()Information about licences of the PROMOTIC application
MethodsAccess to global methods of the application
NetGetAddress()Returns the computer local address in the network
NetTestPC()Test whether the asked computer is accessible in the network
PlaySound()Playing the sound file *.wav
RestartGui()Executes restart of the application graphic interface
RtLangThe language version of the runtime application
ShellExecute()Running or printing the file or the registered document
ShutDown()Shutdown of the Windows OS
WDogRefresh()Refresh of the WatchDog program counter
WinEnviromentRead()Reading of environment variable
WinEnviromentWrite()Writing into the environment variable
WndOper()Operation execution over the opened window of another application
Pm properties and methods for users' administration (see Users and permissions):
AddUser()Adds new PROMOTIC user
FindUserIdLocal()Returns the identifier of the local user that refers to the entered login parameters
FindUserIdNet()Returns the identifier of the network user that refers to the entered login parameters
GetUserInfo()Returns information from the user system
LoggedUserReturns the PmUser object, that represents the logged user
Logoff()Logging off the logged local user without the query
Logon()Login of the local user without the input window
RemoveUser()Deletes existing PROMOTIC user
TestUserInGroup()Test whether the user is or isn't a member of the user group
WndEditUserPassword()Displays the box for editing the password
WndEditUsers()Displays the window for editing the PROMOTIC users
WndLogoff()Displays the Logging off the user window
WndLogon()Displays the Logging on the user window
Pm methods for access to INFO system (see INFO system):
Debug()Text dump into the Debug item of the INFO system
InfoAction()Calling the action over the item in the INFO system
InfoErrorAdd()Writing application errors into the "Errors/Application" tab in the INFO system
InfoErrorClear()Delete the errors of defined type in the INFO system
InfoLogReg()Creates new user tab in the Debug item of the INFO system
InfoLogAdd()Writing text into the user tab in the Debug item of the INFO system
InfoWriteToFile()Write the content of the INFO system tab into the text file
InfoWriteToString()Returns the content of the tab of the INFO system in the form of a string
Pm visualization methods:
CreateView()Object for viewer opening
InputBox()Entering the value by the user
InputBoxForDateTime()Window for entering date and time
InputBoxForFilePath()Window for file/folder selection (obsolete)
MessageBox()Displays the message in the window and waits for the user's click
PrintHtmlPage()Print or display the preview of the HTML page or text
PrintScreen()Print the whole screen to a printer or into the file
PrinterCfg()Displaying the printer selection and setup window
SelectionDialog()It allows to select the one option from the list in the input window (obsolete)
ShowHelp()Displays of help topic
Pm string methods (See also: VBScript string functions):
DecryptText()Text decryption
EncryptText()Text encryption
StringCmp()Returns a result of a comparison of the two strings
StringCodeAt()Returns the code of Unicode character on the definde position in the string
StringCodeFrom()Returns the character associated with the specified Unicode code
StringFind()Searches the text for requested string from the defined position.
StringJoin()Returns a string created by merging the substrings contained in 1-dimensional array
StringLen()Returns the number of characters in the string
StringOper()String operation
StringReplace()Replacement of the keyword in the string by the value
StringSplit()Returns a 1-dimensional array of substrings
StringSub()Returns the substring of another string
Pm date and time methods (See also: VBScript date and time functions):
CreateDate()Creates date and time from its individual components
CreatePmDateObject()Creates the auxiliary PmDateObject object for working with date and time
DateAdd()Returns a date to which a specified time-span has been added
DateDiff()Returns the number of time-spans between two dates
GetDateOf()Returns dates from defined base date
IsDaylight()Test of the "daylight-saving time"
TimeSystem time
Pm properties and methods mathematic and others:
Abs()Absolute value of a number
ArrayOper()Array operations
Atan()Returns the arctangent (invertetd tangent) of a number
Ceil()Returns the smallest integer greater or equal to a given number
Cos()Returns the cosine of an angle
EThe Euler's number (the base of natural logarithms)
Exp()Returns the value of "e raised to the power of y"
Floor()Returns the largest integer less or equal to a given number
GetBit()Returns a value of the variable bit
GetVarType()Returns the data type of the value
IsInt()Test whether the value is integer
IsValid()Test the validity of the value
Linear()Obtains the functional value (or the argument) of the linear function
LN10The natural logarithm of 10
LN2The natural logarithm of 2
LOG10EThe base-10 logarithm of e
LOG2EThe base-2 logarithm of e
LogN()Returns logarithm of a number
PIPi number
Pow()Computes the value of "x raised to the power of y"
Random()Returns a random number in defined range
Round()Returns number rounded to a specified number of decimal places or whole places
SetBit()Changing a bit of the variable
Sign()Returns an integer indicating the sign of a number
Sin()Returns the sine of an angle
Sqrt()The square root of a number
SQRT2The square root of 2
Tan()Returns the tangent of an angle
ToNumber()Conversion to numeric value
TransformValue()Transformation of the value
Trunc()Returns the integer part of a number (removes any fractional digits)
Pm disk/files methods:
DirCreate()Creates the folder for files
DirExist()Test the existence of file folder
DirRemove()Deletes the file folder
DiscGetFreeSpace()Returns the free space on the disk
DiscGetPath()Returns the requested path (eventually also file name) in Microsoft format
DiscGetTotalSpace()Returns the disk capacity
FileCopy()Copy of the file
FileCsvRead()Reading from the CSV file
FileCsvWrite()Writing into the CSV file
FileDelete()Deletes the file
FileFind()Search for files and folders in the specified path
FileGetAttr()Returns the file attributes
FileGetCreationTime()Returns the creation time of the file
FileGetLastAccessTime()Returns the last access time to the file
FileGetLastWriteTime()Returns the last write time into the file
FileGetLength()Returns the size of the file (in bytes)
FileMove()Move (rename) of the file (folder)
FileSetAttr()Sets the file attributes
FileTextRead()Reading of the text file
FileTextReplace()Replacement of text in the text file
FileTextWrite()Saving the variable (or array of variables) into the text file
IniFileRead()Reading the item from the *.ini file
IniFileWrite()Writing the item into the *.ini file
Obsolete properties and methods:
FormatDate()Creates a text string containing date and time
ScanDate()Obtains date and time from text value
StringFormat()Writing an array of values into a text string
StringScan()Reading data from the string
AppQuit()Termination of the application
BlinkerBlinking with the panel windows refresh period
CDbl()Returns an expression converted to the value of the Double type
CSng()Returns an expression converted to the value of the Single type
CreatePmList()Creates object of the PmList type
CpuUsageComputer CPU usage
FileBinaryRead()Reading the content of the binary file into the variable of the Array type
FileBinaryWrite()Saving the content of the variable of the Array type into the binary file
FileReadVariable()Reading the value of the variable from the file
FileWriteVariable()Saving the value of the variable into the file
InputBoxForStringSelection()It allows to select the string from the list in the input window (obsolete)
MemoryUsageComputer memory usage
OtherAppOper()Operation execution over the opened window of another application
RtLanguageThe language version of the runtime application (obsolete)
WndHtmlPage()Displays the HTML pages in modal/non-modal window
WndInfo()Window of the INFO system

Pm9.00.05: InfoLogReg and InfoLogAdd new methods: Methods allow registering a new item into the INFO system and then adding new entries into item. This is generalization of the Pm.Debug method for user defined logging.
Pm8.02.04: New constants were added that are used for mathematic calculations: PI, E, SQRT2, LN10, LN2, LOG10E and LOG2E.
Pm8.02.01: Many new methods were added that replace the original VBScript methods. These new methods are functional also in Web panels (JavaScript and VBScript). The new methods are:
- Pm.GetSystemInfo new method for detecting the resolution of the screen. It is functional also for Web panels.
- Pm.CpuUsage new property for detecting the load of the CPU.
- Pm.GetActiveWorkspace new method for detecting the active workspace (of the PmaWorkspace object). It can be used for example when creating multi display applications.
- Pm.PrintHtmlPage method: Fixed bug: the printing did not work in Windows OS 7.
PROMOTIC 9.0.25 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
- Pm
- Abs
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.