SLICE API: JavaScript functions

Static Functions: Slice

boolean Slice.Confirm (String message, String title)
Displays the text specified with a prompt of "OK" or "Cancel".

void Slice.ExitApplication ()
Exits the current SLICE application.

String Slice.GetDate (String pattern)
Returns the current's system date and time in the format specified.

String Slice.GetGUID ()
Returns a randomly generated GUID.

integer Slice.GetUniqueID ()
Returns an integer that is guaranteed to be unique throughout the current SLICE session.

String Slice.LoadFileDialog (String dialogTitle)
Displays a dialog that allows the user to select a file to load. The file itself is not loaded, only the location is returned.

String Slice.LoadFileDialog (String fileType, String dialogTilte)
Displays a dialog that allows the user to select a file to load of a specific type. The file itself is not loaded, only the location is returned.

String Slice.LoadFrom (String fileName)
Loads the content of the file specified.

Graphic[] Slice.LoadGraphics ()
Asks a user to select a graphic file to open (either a multi-graphic file such as a PDF or a single-graphic file such as a PNG), which is loaded and returned.

String Slice.LoadText (String fileType, String dialogTitle)
Asks the user to select a text file to open, which is loaded and returned.

TreeNode Slice.LoadXML ()
Asks the user to select a SLICE XML file to open, which is loaded and returned.

void Slice.Message (String messageText)
Displays a message in a pop-up window to the user.

void Slice.Pause (integer millis)
Pauses the execution of scripts for a given amount of time.

boolean Slice.Prompt (String message, String title)
Displays the text specified with a prompt of "Yes" or "No".

String Slice.Save (TreeNode treeNode)
Asks the user to save the current XML representation of a TreeNode.

String Slice.Save (TreeNode treeNode, String suggestedFileName)
Asks the user to save the current XML representation of a TreeNode, providing a suggested file name.

String Slice.SaveApplication ()
Asks the user to save the current XML representation of the entire SLICE tree.

String Slice.SaveApplication (String suggestedFileName)
Asks the user to save the current XML representation of the entire SLICE tree, providing a suggested file name.

boolean Slice.SaveAs (TreeNode treeNode, String fileName)
Saves the specified TreeNode to a given file name.

String Slice.SaveFileDialog (String fileType, String suggestedFileName, String dialogTitle)
Displays a dialog to the user allowing the selection of a location to save a file. The file itself is not created, only the location is returned.

String Slice.SaveText (String text, String suggestedFileName, String fileType, String dialogTitle)
Asks the user to save a text file that will contain the string specified as text.

boolean Slice.SaveTextAs (String text, String fileName)
Saves the text contained in text to a given file name.

void Slice.SetGlobal (String name, object value)
Sets a global scripting variable.

Static Functions: TreeNode

TreeNode[] TreeNode.Clone (TreeNode[] treeNodeList
Creates a new array of new TreeNode objects where the new objects are clones of the each TreeNode in the specified list.

TreeNode TreeNode.Find (String nodeId)
Searches the current SLICE tree for a TreeNode with the specified value for the "Id" attribute.

TreeNode TreeNode.FromXml (String xml)
Generates a new TreeNode object, and possibly many children objects, based on the XML supplied.

TreeNode TreeNode.MakeTreeNode (String nodeName)
Creates a new TreeNode object with a specified name.

TreeNode TreeNode.MakeTreeNode (String nodeName, String nodeType)
Creates a new TreeNode object with a specified name and "Type" attribute.

Static Functions: SliceCloud

boolean Connect (String classroom)
Connects to a specific classroom on the SliceCloud.

boolean Connect (String classroom, String)
Connects to a specific classroom on the SliceCloud.

double GetScreenHeight ()
Returns the usable screen height in pixels.

double GetFrameBorderTop ()
Returns the height, in pixels, of any platform-specific borders that is part of the topmost area of a Frame, but unsable by a SLICE app.

double GetFrameBorderLeft ()
Returns the width, in pixels, of any platform-specific borders that is part of the leftmost area of a Frame, but unsable by a SLICE app.

double GetFrameBorderBottom ()
Returns the height, in pixels, of any platform-specific borders that is part of the bottommost area of a Frame, but unsable by a SLICE app.

double GetFrameBorderRight ()
Returns the width, in pixels, of any platform-specific borders that is part of the rightmost area of a Frame, but unsable by a SLICE app.

Static Functions: System

double GetScreenWidth ()
Returns the usable screen width in pixels.

double GetScreenHeight ()
Returns the usable screen height in pixels.

double GetFrameBorderTop ()
Returns the height, in pixels, of any platform-specific borders that is part of the topmost area of a Frame, but unsable by a SLICE app.

double GetFrameBorderLeft ()
Returns the width, in pixels, of any platform-specific borders that is part of the leftmost area of a Frame, but unsable by a SLICE app.

double GetFrameBorderBottom ()
Returns the height, in pixels, of any platform-specific borders that is part of the bottommost area of a Frame, but unsable by a SLICE app.

double GetFrameBorderRight ()
Returns the width, in pixels, of any platform-specific borders that is part of the rightmost area of a Frame, but unsable by a SLICE app.