ExecuteCommand, UIInterface Function

Syntax

ExecuteCommand(_lpszCommand)

Description

This function allows you to execute commands from the Movicon Comand List in Scripts. The lpszCommand parameter must return a string containing the command type and the parameters for executing it. The syntax must be:

 

"<CommandType ...command parameters ...''>CommandType</CommandType>"

 

When the single quote (') character is inserted directly with command's parameter, Movicon may interpret this character as the closing of the paramater's value. For instance, the following line is not correct:

 

Public Sub Click()

  'Show tooltip

  ExecuteCommand("<CommandType action='1' topic='Hello 'World''>Help</CommandType>")

End Sub

 

A solution to remedy this would be to use "&apos;" instead of  "'":

 

Public Sub Click()

  'Show tooltip

  ExecuteCommand("<CommandType action='1' topic='Hello &apos;World&apos;'>Help</CommandType>")

End Sub

 

The command parameters may be:

 

Variable Commands

variable='VariableName' a SecondVariable='DestinationVariable' action='ActionType' strobe='StrobeValue' value='VariableValue' max='MaxVal' min='MinVal' chars='MaxChars' ' alias='' pwd=''

 

where:

ActionType

0  Set Variable

1  Reset Variable

2 Toggle Variable

3 Strobe Variable

4 Increase Variable

5  Decrease Variable

6 Alphanumeric Pad

7  Numeric Pad

8 Append Value

9 Remove Value

10 Swap Plus-Minus

11 Append Decimal Mode ON-OFF

12 Move Value

13 Reset Statistics

14 Move Min. Value

15 Move Max. Value

16 Move Average  Value

17 = Set String Table Value

18 = Set Screen Alias

 

Screen Commands

synoptic='SynopticName' action='ActionType' monitor='0' parameter='ParameterList' x='Xposition' y='Yposition' width='Width' height='Height' Caption='1' Border='1' Resizeable='0' SysMenu='0' MinimizeBox='0' MaximizeBox='0' KeepPrintProportions='0' PageW='-1' PageH='-1' LMargin='-1' RMargin='-1' TMargin='-1' BMargin='-1'

 

where:

ActionType

0  Open Normal

1  Open Modal

2  Open Frame

3  Open Safe

4  Print

5  Close

6  Execute Synapse

7 Open Next

8 Open Prev

9 Capture and Print

10 Capture and Save

 

Parameterlist

parametervalue1, parametervalue2,, ..., ParametervalueN

 

Script Commands

script='ScriptName' action='ActionType' parameters='ParameterList' newInstAllowed='0' timeout="TimeoutValue"

 

whrere:

ActionType

0  Run Normal

1  Run Syncro

2  Run Safe

3  Stop

4 Unload

 

Parameterlist

parametervalue1, parametervalue2,, ..., ParametervalueN

 

User Commands

action='ActionType' level='UserLevel'

 

where:

ActionType

0  LogOn

1  LogOff

2  Edit

 

Report Commands

dlr='Data LoggerName' action='ActionType' x='XPosition' y='YPosition' width='Width' height='Height' Toolbar='0' GroupTree='true/false'' TemplateFile='' DestinationFile='' Query='' ReferencePeriod='0'' ExportFormat='0'' SelectDate='0'' Sep='59' MaxPages='0' LeftMargin='-1' RightMargin='-1' TopMargin='-1' BottomMargin='-1' PrintDlg='0' Landscape='0' Printer='' Recipient='' EmbRep=''

 

where:

ActionType

0 = View Synchronouse

1 = Print Synchronouse

2 = View

3 = Print

4 Move First

5 Move Last

6 Move Prev

7 Move Next

8 Activate

9 Save

10 Delete

11 Requery

12 Execute Query

13 Export

14 Data Analysis

15 View Textual Report

16 Print Textual Report

17 Save Textual Report

18 Append Textual Report

19 = Export Recipe

20 = Import Recipe

21 = Export and Send Email

22 = View Embedded Report

23 = Print Embedded Report

24 = Save Embedded Report

25 = Send Embedded Report

26 = Read

27 = Export all Recipe records

28 = Import all Recipe records

29 = Export Datalogger records

30 = Export Trace (Audit)

 

ReferencePeriod

0 = None

1 = Today

2 = Yesterday and Today

3 = Current Week

4 = Current Month

5 = Current Year

6 = Last 7 Days

7 = Last 30 Days

8 = Last 60 Days

9 = Last 90 Days

10 = Last Year

11 = Last 2 Years

12 = Last 5 Years

13 = Last 10 Years

 

ExportFormat

0 = Pdf

1 = Html

2 = Txt

3 = Csv

4 = Xls

5 = Mht

6 = Rtf

7 = Jpeg

 

SelectDate

0 = the date selection window will not show

1 = window for selecting dates to apply date filters will show

 

Menu Commands

menu='MenuName' x='-1' y='-1'

 

System Commands

action='ActionType' parameters='Parameter'  workingpath=''  timeout='TimeoutValue'

 

Where:

ActionType

0 Shut Down OS

1 Shut Down App

2  Launch App

3  Launch App and Wait

4 Play Sound File

5 Beep

6 Speack

7 Reboot OS

8 = Show or Hide the Output Window

9 = Wait Time

 

Parameter

Application Name

 

Help Commands

action='ActionType' topic='Topic'

 

where:

ActionType

0 = Topic

1 = Tooltip popup

 

Change Language

Language='Language'

 

Alarm Commands

action='ActionType'  AreaFilter='' Report='Report' Toolbar='true/false' GroupTree='true/false' Period='Period' Duration='Duration' Date='Date' TemplateFile='' DestinationFile='' Query='' MaxPages='10' PageHeight='-1' PageWidth='-1' LeftMargin='-1' RightMargin='-1' TopMargin='-1' BottomMargin='-1' PrintDlg='0' Landscape='0' Printer='' Recipient=''

 

where:

ActionType

0 Ack All

1 Reset All

2 Toggle Sound

3 View Report

4 Print Report

5 Export Report

6 View Textual Report

7 Print Textual Report

8 Save Textual Report

9 Append Textual Report

10 = Export and Send Email

11 View Embedded Report

12 Print Embedded Report

13 Save Embedded Report

14 Send Embedded Report

15 Reset Statistics

 

Report

OrderByDate

OrderByDuration

GroupByFrequency

GroupByThreshold

 

ReferencePeriod

0 = Period

1 = Today

2 = Yesterday or Today

3 = Current week

4 = Current month

5 = Current year

6 = Last 7 days

7 = Last 30 days

8 = Last 60 days

9 = Last 90 days

10 = Last 1 years

11 = Last 2 years

12 = Last 5 years

13 = Last 10 years

 

Event Command

eventname='Event1'

 

 

Parameter

Description

lpszCommand As String

Command Line.

 

Result

Boolean

 

Example1:

Public Sub Click()

'Set VAR00001 = 1

ExecuteCommand("<CommandType variable='VAR00001' action='0' SecondVariable='' strobe='0' value='1' max='100' min='0' _ chars=''>Variable</CommandType>")

End Sub

 

Example2:

Public Sub Click()

'Open Synopric MDI

ExecuteCommand("<CommandType synoptic='LayOut' action='0' monitor='0' parameter='' x='-1' y='-1' width='0' height='0' Caption='true' Border='true' Resizeable='false' SysMenu='false' MinimizeBox='false' MaximizeBox='false'KeepPrintProportions='0' PageW='-1' PageH='-1' LMargin='-1' RMargin='-1' TMargin='-1' BMargin='-1'>Synoptic</CommandType>")

End Sub

 

Example3:

Public Sub Click()

'Execute Script Normal

ExecuteCommand("<CommandType script='Script1' action='0' parameters='1,2,3' newInstAllowed='0' timeout='3000' >Script</CommandType>")

End Sub

 

Example4:

Public Sub Click()

'LogOn User

ExecuteCommand("<CommandType action='0' level='5'>Users</CommandType>")

End Sub

 

Example5:

Public Sub Click()

        'View Embedded Report

    ExecuteCommand("<CommandType dlr='' action='22' Query='' ReferencePeriod='0' MaxPages='0' PageHeight='-1' PageWidth='-1' LeftMargin='-1' RightMargin='-1' TopMargin='-1' BottomMargin='-1' PrintDlg='0' Landscape='0' Printer='' EmbRep='Report1'>Report</CommandType>")

End Sub

 

Example6:

Public Sub Click()

'Data Logger View Textual Report

ExecuteCommand("<CommandType dlr='Data Logger' action='15' TemplateFile='Template.txt' DestinationFile='' Query='' MaxPages='0' >Report</CommandType>")

End Sub

 

Example7:

Public Sub Click()

'Launch calc.exe

ExecuteCommand("<CommandType action='2' parameters='calc.exe' timeout='5000'>System</CommandType>")

'Close Supervisor

ExecuteCommand("<CommandType action='1' parameters='' timeout='5000'>System</CommandType>")

End Sub

 

Example8:

Public Sub Click()

'Show tooltip

ExecuteCommand("<CommandType action='1' topic='Welcome to Movicon'>Help</CommandType>")

End Sub

 

Example9:

Public Sub Click()

'Change language to English, that has been previously defined in the String Table

ExecuteCommand("<CommandType action='English'>Language</CommandType>")

End Sub

 

Example10:

Public Sub Click()

'AckAll Alarms

ExecuteCommand("<CommandType action='0' Report='' Toolbar='true' GroupTree='false' Period='' Duration='' Date=''>Alarm</CommandType>")

End Sub

 

Example11:

Public Sub Click()

'Alarms View Textual Report

ExecuteCommand("<CommandType action='6' TemplateFile='Template.txt' DestinationFile='' Query='' MaxPages='0' >Alarm</CommandType>")

End Sub

 

See Also