It is currently Wed May 22, 2013 8:08 pm




Post new topic Reply to topic  [ 12 posts ] 
 [KSB] [April 18, 2012] Scripting Addons 1.3.6b73, 1.4.1b75 
Author Message
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post [KSB] [April 18, 2012] Scripting Addons 1.3.6b73, 1.4.1b75
Enclosed is our module that adds various scripting packages to the client, designer and gateway contexts. We made this module to add scripts we felt we needed, and we use them on almost every project we work on. I will enclose the module here, and the documentation will follow in the following post.

This module exposes 5 new components:
Analog Scale
Attachment:
Analog Scale.png
Analog Scale.png [ 1.06 KiB | Viewed 2079 times ]


QR Code
Attachment:
QRCode.png
QRCode.png [ 1.97 KiB | Viewed 2080 times ]


Vertical Sliding Indicator
Attachment:
Sliding Indicator.png
Sliding Indicator.png [ 1.82 KiB | Viewed 2078 times ]


Radar Chart
Attachment:
Radar Chart.png
Radar Chart.png [ 16.04 KiB | Viewed 2080 times ]


There is also a spark line, a small word sized graph (Cant post it because of attachment limitations

Also, there is a SQLTag for the number of unacknowledged alarms at [System]Alert Count

There is push alert messages, enabled in the project properties. It creates a small popup notification whenever a new alarm is pushed.

Regular price of $400 per server, but until April 30, half price ($200)
20120320 - Added module.
20120329 - Made license checks faster
20120418 - Posted 1.3.6b73,1.4.1b75, Fixed bug with Null Pointer when using system.window scripts

KSB Addon Scripts 1.3.6b73
KSB Addon Scripts 1.4.1b75


Last edited by Kyle Chase on Wed Apr 18, 2012 8:28 pm, edited 10 times in total.

Thu Mar 15, 2012 7:22 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.alert.acknowledgeAlerts(user)
Description
Acknowledges all currently unacknowledged alarms
Syntax
Parameters
String user The user that is acknowledging the alarm
Returns
nothing
Scope
Client
Designer
Example
Code:
user = system.security.getUsername()
system.alert.acknowledgeAlerts(user)



system.alert.acknowledgeAlerts()
Description
Acknowledges all currently unacknowledged alarms. User is set to System
Syntax
Parameters
String user
Returns
nothing
Scope
Gateway
Code:
system.alert.acknowledgeAlerts()



system.alert.createNotifier(title, bodyText, time, bgColor, textColor)
Description
Creates a popup displaying the latest alarm information starting in the top right hand corner. It stays above all windows, and multiple alerts stack vertically for one column
This function uses keyword invocation
Syntax
Parameters
String title The header of the notifier
String bodyText The body of the notifier
int time How long the notifier will display for. If < 0, the notifier will persist until you close it
String bgColor The background color of the notifier. Can be a color, such as "blue", or a RGB string, such as "0,0,255"
String textColor The text color of the notifier. Can be a color, such as "blue", or a RGB string, such as "0,0,255"
Returns
nothing
Scope
Client
Designer
Code:
system.alert.createNotifier("Hello","World",5000,"black","yellow")

Attachment:
createNotifier example.png
createNotifier example.png [ 19.63 KiB | Viewed 2432 times ]


Thu Mar 15, 2012 7:27 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.client.moveProject()
Description
Creates a popup based of your monitor configuration, and moves project to the monitor you select
Syntax
Parameters
nothing
Returns
nothing
Scope
Client
Designer
Example
Code:
system.client.moveProject()


Last edited by Kyle Chase on Thu Mar 15, 2012 8:29 pm, edited 1 time in total.

Thu Mar 15, 2012 8:02 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.tag.getAttribute(tagPath, attribute)
Description
Returns any of the tag attributes definable in the tag editor. To list available attributes, run the following python code
Code:
print dir(system.tag.TagProp)

Code:
'AccessRights', 'AlertAckMode', 'AlertAcknowledgeUser', 'AlertAcknowledged', 'AlertAcknowledgedTime', 'AlertActive', 'AlertActiveTime', 'AlertClearedTime', 'AlertCurrentSeverity', 'AlertCurrentState', 'AlertDeadband', 'AlertDisplayPath', 'AlertExecEnabled', 'AlertMessage', 'AlertMessageMode', 'AlertMessageSubject', 'AlertMode', 'AlertNotes', 'AlertSendClear', 'AlertTimestampSource', 'ClampMode', 'DataType', 'Deadband', 'Documentation', 'DriverName', 'Enabled', 'EngHigh', 'EngLow', 'EngUnit', 'Expression', 'ExpressionType', 'FormatString', 'HistoricalDeadband', 'HistoricalScanclass', 'HistoryEnabled', 'HistoryMaxAge', 'HistoryMaxAgeMode', 'HistoryTimestampSource', 'InterpolationMode', 'LastChange', 'Name', 'OPCItemPath', 'OPCServer', 'OPCWriteBackItemPath', 'OPCWriteBackServer', 'PollRate', 'PrimaryHistoryProvider', 'Quality', 'RawHigh', 'RawLow', 'SQLBindingDatasource', 'ScaleMode', 'ScaledHigh', 'ScaledLow', 'ScanClass', 'TagTypeSubCode', 'Tooltip', 'Value'

Syntax
Parameters
String tagPath The tag to get the attribute from
String attribute The Attribute to get, either in teh form system.tag.TagProp.attribute, or "attribute"
Returns
Object value - The value of the attribute, or null
Scope
Client
Designer
Gateway
Example
Code:
print system.tag.getAttribute("path/to/tag",system.tag.TagProp.HistoryEnabled)
>> 1


system.tag.getChildren(tagPath)
Description
Returns a list of all the children under tagPath

Syntax
Parameters
String tagPath The tag to get the attribute from
Returns
Object[] value - A list of the children
Scope
Client
Designer
Gateway
Example
Code:
system.tag.getChildren("path/to/folder")


Thu Mar 15, 2012 8:19 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.menu.addTag(tagPath, numberFormat)
Description
Adds a label to the menu, displaying the value of a SQLTag.

Syntax
Parameters
String tagPath The tag to get the attribute from
String numberFormat The java format used to display the number
Returns
nothing
Scope
Client
Designer
Example
Code:
system.menu.addTag("path/to/folder", "#,##0.##")


system.menu.addText(text)
Description
Adds a static text label to the menu bar.

Syntax
Parameters
String text The text to display
Returns
nothing
Scope
Client
Designer
Example
Code:
system.menu.addText("Hello, World!!")


system.menu.remove(string)
Description
If the text matches a tagPath that is being displayed in the menu, it will be removed. If it matches the string displayed in static text, the label will be removed from the menu.

Syntax
Parameters
String string The tag to get the attribute from
Returns
nothing
Scope
Client
Designer
Example
Code:
system.menu.addTag("path/to/folder", "#,##0.##")
system.menu.addText("Hello, World!!")

system.menu.remove("path/to/folder")
system.menu.remove("Hello, World!!")


system.menu.clearMenu()
Description
Removes all dynamic labels from the menu

Syntax
Parameters
nothing
Returns
nothing
Scope
Client
Designer
Example
Code:
system.menu.clearMenu()


Last edited by Kyle Chase on Mon Mar 19, 2012 11:01 pm, edited 1 time in total.

Thu Mar 15, 2012 8:35 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.ctg.findPen(pen)
Description
Finds the index of the requested pen
Syntax
Parameters
String pen The point to search for
Returns
Integer index The index of the pen, or -1 if the point is not in the active pen list
Scope
Client
Designer
Example
Code:
system.ctg.findPen("myPen")


system.ctg.addPen(pen)
Description
Adds the pen to the active pen list
Syntax
Parameters
String pen The pen to add to the active list
Returns
nothing
Scope
Client
Designer
Example
Code:
system.ctg.addPen("myPen")


system.ctg.deletePen(pen)
Description
Removes a pen from the active pen list
Syntax
Parameters
String pen The pen to remove from the active pen list
Returns
nothing
Scope
Client
Designer
Example
Code:
system.ctg.deletePen("myPen")


system.ctg.clearPens()
Description
Removes alls pens from the active pen list
Syntax
Parameters
nothing
Returns
nothing
Scope
Client
Designer
Example
Code:
system.ctg.clearPens()


system.ctg.updateGraph(graphId)
Description
Loads the pens from the selected graph id anf refreshes the graph
Syntax
Parameters
Integer pen The graph to open
Returns
nothing
Scope
Client
Designer
Example
Code:
system.ctg.updateGraph(7)


system.ctg.updateGraph(graphId)
Description
Loads the pens from the selected graph id anf refreshes the graph
Syntax
Parameters
Integer pen The graph to open
Returns
nothing
Scope
Client
Designer
Example
Code:
id = system.db.runPrepQuery("give/Me/My/Id",[])
system.ctg.updateGraph(id)


system.ctg.openGraph()
Description
Opens the current graph on the screen called "CTG_Graph"
Syntax
Parameters
nothing
Returns
nothing
Scope
Client
Designer
Example
Code:
system.ctg.openGraph()


system.ctg.getPensString()
Description
Returns a comma delimited string of the active pens
Syntax
Parameters
Returns
String penString The string representation of the pens list.
Scope
Client
Designer
Example
Code:
system.ctg.getPensString()


system.ctg.getPensList()
Description
Returns the list of the active pens
Syntax
Parameters
Returns
String[] penList The active pens list.
Scope
Client
Designer
Example
Code:
system.ctg.getPensList()


Mon Mar 19, 2012 10:49 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.net.httpGetBytes(url)
Description
Lets you download the bytes of just about any file
Syntax
Parameters
String[] url The full URL string of the desired file
Returns
byte[] bytes A byte array containing all the bytes of the requested file
Scope
Client
Designer
Gateway
Example
Code:
system.net.httpGetBytes("http://www.inductiveautomation.com/resources/com.inductiveautomation.website.BasePage/images/logos/logo.png")


Tue Mar 20, 2012 9:32 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.window.getWindowInstance(window,instanceid)
Description
Checks if a window with a certain instanceID is open, and if so, returns that window object.
Syntax
Parameters
String[] window The name of the window you want to check for
String[] instanceid The instance of the window you want to check for
Returns
PyObject[] window A reference to the window if it exists, else None
Scope
Client
Designer
Example
Code:
system.window.getWindowInstance("Motor Window","Pump 1")


system.window.openWindowInstance(window, instanceid, destination)
Description
Opens a window with a certain ID, and places the value of ID into Root Container.destination. If the window is already open, it its moved to the front and given focus.
Syntax
Parameters
String[] window The name of the window you want to open
String[] instanceid The instance of the window you want to open
String[] destination The property in the container that will store the instanceid. Defaults to "Tag" if omitted
Returns
PyObject[] window A reference to the window if it exists, else None
Scope
Client
Designer
Example
Code:
system.window.openWindowInstance("Motor Window","Pump 1","tag")


system.window.closeWindowInstance(window,instanceid)
Description
Closes the window with the given instance ID
Syntax
Parameters
String[] window The name of the window you want to close
String[] instanceid The instance of the window you want to close
Returns
Nothing
Scope
Client
Designer
Example
Code:
system.window.closeWindowInstance("Motor Window","Pump 1")


Thu Mar 22, 2012 1:35 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] Scripting Addons
system.stats.calculateMean(values,includeNull)
Description
Calculates the mean of a list of numbers
Syntax
Parameters
Number[] values The values
Boolean includeNull If true,If a null is found, return null
Returns
Double mean The mean
Scope
Client
Designer
Gateway
Example
Code:
mean = system.stats.calculateMean([1,2,3],0)
print mean
2


system.stats.calculateMedian(values)
Description
Sorts the list and returns the median
Syntax
Parameters
Number[] values The list of values
Returns
double median The median of the list
Scope
Client
Designer
Gateway
Example
Code:
print system.stats.calculateMedian([2,4,3])


system.stats.getStdDev(values)
Description
Returns teh standard deviation of the list
Syntax
Parameters
Number[] values The list of values
Returns
double stdDev The standard deviation of the list
Scope
Client
Designer
Gateway
Example
Code:
print system.stats.getStdDev([1,2,3,4,5])
1.581138830041898


system.stats.getLinearFit(xData,yData)
Description
Returns the values of m and b for y = mx+b
Syntax
Parameters
Number[] xData The X axis values (cannot be null)
Number[] yData The Y axis values (cannot be null)
Returns
double[] result result[0] = b, result[1] = m
Scope
Client
Designer
Gateway
Example
Code:
result = system.stats.getLinearFit([1,2,3],[3,2,1])
print result[0]
print result[1]
4.0
-1.0


system.stats.getSlope(xData,yData)
Description
Returns the slope between 2 sets of data
Syntax
Parameters
Number[] xData The X axis values (cannot be null)
Number[] yData The Y axis values (cannot be null)
Returns
double slope The slope of the line
Scope
Client
Designer
Gateway
Example
Code:
result = system.stats.getSlope([1,2,3],[3,2,1])
print result
-1.0


system.stats.getCorrelation(data1,data2)
Description
Returns the correlation between 2 sets of data
Syntax
Parameters
Number[] data1 The first set of values (cannot be null)
Number[] data2l The second set of values (cannot be null)
Returns
double correlation The correlation between the sets of data
Scope
Client
Designer
Gateway
Example
Code:
result = system.stats.getCorrelation([1,2,3],[3,2,1])
print result
-1.0


Fri Mar 23, 2012 12:05 am
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] [March 29, 2012] Scripting Addons v 1.3.4 b61
Updated Module to 1.3.4 b61

License checks now faster

Module price is $200 until April 30th. After that, it goes to its normal price of $400


Attachments:
ScriptingPackages-module-signed.modl [787.48 KiB]
Downloaded 64 times
Thu Mar 29, 2012 1:58 am
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] [April 18, 2012] Scripting Addons 1.3.6b73, 1.4.1b75
Updated to 1.3.6b73 and 1.4.1b75 (7.3 and 7.4 versions)

Fixed a NPE bug on system.window scripts

KSB Addon Scripts 1.3.6b73
KSB Addon Scripts 1.4.1b75


Wed Apr 18, 2012 8:29 pm
Profile WWW
General
General

Joined: Sun Feb 25, 2007 2:54 pm
Posts: 472
Post Re: [KSB] [June 21, 2012] Scripting Addons 1.3.6b73, 1.4.1b88
Fix NPE due to improper passing of variables

KSB Addon Scripts 1.4.1b88


Thu Jun 21, 2012 10:11 pm
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: