ReadBlackboardAsString Method



 
The ReadBlackboardAsString method reads the content of a SiteRemote blackboard key and returns it in string format.


Syntax

    [string=] SiteKiosk.Plugins("SiteRemote").ReadBlackboardAsString(key)
    
Parameters
    key String that specifies the blackboard key.
Return Value
    Returns a String that contains the data of a SiteRemote blackboard key.
Remarks
    The SiteRemote blackboard contains information that is assigned to a machine on a SiteRemote server. This includes for example the team name the client is assigned to, the location of the machine in the treeview and address information.


    Possible keys are:

    StC.MachineInfo.Id: Contains the ID of the machine in the SiteRemote server database.

    StC.MachineInfo.LocationInTreeview: Contains the folder path and virtual folder assignment of the machine in the SiteRemote treeview.

    StC.MachineInfo.Name: The name of the machine in a SiteRemote team.

    StC.MachineInfo.SupportInfo: Location, maintenance and owner address information assigned to the machine on SiteRemote.

    StC.TeamInfo.Name: Name of the team the machine is assigned to.


    Note that you need to enable the option Transfer machine information to clients on the Settings->General page in a SiteRemote team to make the blackboard information available on the client side.
Examples
    The following example reads the location of a machine in the SiteRemote team treeview. The return value is a string in JSON format. It can either be handled as a normal string value or converted to a JSON object to ease further processing.
    Note that you may need to include a JSON script to be able to parse the string into a JSON object (for example the JSON script by Douglas Crockford on GitHub: https://github.com/douglascrockford/JSON-js).

    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();
    
    var SiteRemotePlugin = SiteKiosk.Plugins("SiteRemote");
    
    //handle as normal string
    //example result would be a simple string like this: 
    //{"GroupName":"\/TestFolder","VirtualGroupNames":["VFolder2","VFolder1"]}
    SiteKiosk.Logfile.Notification("Machine location in treeview = " 
    + SiteRemotePlugin.ReadBlackboardAsString('StC.MachineInfo.
    LocationInTreeview'));
    
    //handle as JSON
    //first parse the string into a JSON object
    var myJSONObject = JSON.parse(SiteRemotePlugin.ReadBlackboardAsString
    ('StC.MachineInfo.LocationInTreeview'));
    
    //next get only the treeview group from the above example result
    //expected result: /Testfolder
    SiteKiosk.Logfile.Notification("Group of the machine in the treeview:
    " + myJSONObject.GroupName);
    
    //finally get the tags the machine is assigned to
    //expected result: VFolder1,VFolder2
    SiteKiosk.Logfile.Notification("Tags the machine is in:
    " + myJSONObject.VirtualGroupNames); 
    </SCRIPT>
    

Applies to
    SiteKiosk v8.7 (and later versions).

Back to top