Accessing System Information with SenseTalk
On this page:
- DiskSpace Function
- EggplantVersion Function
- Env Function
- HostAddresses Function
- Hostname, HostNames Functions
- Machine Function
- Platform Function
- ProcessInfo Function
- Processor Function
- SystemInfo Function
- SystemVersion Function
- UserInfo Function
- Version, LongVersion, SenseTalk Version, BuildNumber Functions
DiskSpace Function
Behavior: Returns the number of bytes of free space available on a disk.
Use the diskSpace function to find out how much free space (in bytes) is available on a file system.
Parameters: The name of an existing file or folder. Optional.
If the diskSpace function is called without any parameter, it returns the amount of free space in bytes in the file system containing the current working folder. If a parameter is given, it should be the name of an existing file or folder, and diskSpace will return the amount of free space on the file system containing that file or folder.
Syntax:
the diskSpace [{of fileOrFolder}|(fileOrFolder)]
diskSpace (fileOrFolder)Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Example:
put diskSpace() into spaceRemaining
if diskspace is less than a Megabyte then
put "You have less than a megabyte of space remaining!"
end if
if diskSpace("/Volumes/sparky") is less than 1000 then
put "Less than a thousand bytes left on /Volumes/sparky!!"
end if
EggPlantVersion Function
Behavior: Returns the number of your version of Eggplant Functional.
Parameters: None.
Example:
log the eggPlantVersion
Env Function
Behavior: The env function provides access to the environment variables supplied by the environment in which SenseTalk is running.
Parameters: One environment variable. Optional.
Call env with 1 parameter that is the name of a particular environment variable to retrieve the value of that variable. Call env with no parameters to get a property list containing all of the environment variables.
Syntax:
the env {of varName}
env (varName)
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put env("Home") into homeFolder
put env() -- display all available information
HostAddresses Function
Behavior: The hostAddresses function returns a list of all of the IP addresses for the host computer where SenseTalk is running.
Call hostAddresses to find all of the network IP addresses for the local host.
Parameters: None.
Syntax:
the hostAddresses
hostAddresses()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put item 1 of the hostAddresses into myIPAddress
HostName, HostNames Functions
Behavior: The hostName function returns the standard host name of the machine on which the script is running. The hostNames function returns a list of all of the known host names.
Call hostName or hostNames to find names by which the local host may be known on the network.
Parameters: None.
Syntax:
the hostName
hostName()
the hostNames
hostNames()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put the hostName into localName
Machine Function
Behavior: Returns the type of machine hardware of the computer where SenseTalk is running.
Call machine to determine the machine hardware platform.
Parameters: None.
Syntax:
the machine
machine()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
if the machine is "i386" then put "Intel" into hardwareType
OSInfo Function
Behavior: The OSInfo function returns a property list containing various items of information about the operating system of the machine where SenseTalk is running.
Call OSInfo to learn information about the host operating system.
Parameters: None.
Syntax:
the OSInfo
OSInfo()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put the OSInfo
Platform Function
Behavior: The platform function returns the name of the host operating system where SenseTalk is running, such as "MacOS", "Linux", etc.
Call platform to make decisions based on SenseTalk's host platform.
Parameters: None.
Syntax:
the platform
platform()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
if the platform is "MacOS" then exit script
ProcessInfo Function
Behavior: The processInfo function returns a property list containing information about the process within which the script is running, including its name, parameters, and process id.
Call processInfo to obtain information about the identity of the process running the script.
Parameters: None.
Syntax:
the processInfo
processInfo()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put the processInfo
Processor Function
Behavior: The processor function returns the type of processor of the host computer where SenseTalk is running, such as "x86", "Power Macintosh", etc.
Call processor to determine the CPU type for the local host.
Parameters: None.
Syntax:
the processor
processor()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put the processor into CPUType
SystemInfo Function
Behavior: The systemInfo function returns a property list containing various pieces of information about the system where SenseTalk is running.
Call systemInfo to learn information such as the amount of memory installed or the processor byte order for the local host.
Parameters: None.
Syntax:
the systemInfo
systemInfo()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
put the systeminfo's memorySize /1 GB into gigaBytes
if systemInfo().NativeByteOrder is "Big-Endian" then swap
SystemVersion Function
Behavior: The systemVersion function returns the version number of the system where Eggplant Functional is running.
Use systemVersion to check which OS version a script is running on.
Parameters: None.
Syntax:
the systemVersion
systemVersion()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
if systemVersion() begins with "10.5" then put "Leopard!"
UserInfo Function
Behavior: The userInfo function returns a property list containing various pieces of information about the user account where SenseTalk is running.
Call userInfo to get information about the logged-in user, such as their FullName, ShortName, and HomeDirectory.
Parameters: None.
Examples:
put the userInfo's FullName into fullName
set the folder to userInfo().HomeDirectory
Version, Long Version, SenseTalkVersion, BuildNumber Functions
Behavior: These functions provide the current version number of the application (a number), a long form of the version (a string containing more information), the version of the SenseTalk engine being used (a number), and the current build number (a whole number) respectively.
Use these functions to identify what version of an application or of SenseTalk is in use. This might be useful, for example, to determine if a specific feature is available and avoid using it otherwise.
Parameters: None.
Syntax:
the userInfo
userInfo()
the {long} version
version()
the senseTalkVersion
senseTalkVersion()
the buildNumber
buildNumber()
Syntax definitions for language elements follow these formatting guidelines:
- boldface: Indicates words and characters that must be typed exactly
- italic: Indicates expressions or other variable elements
- {} (curly braces): Indicate optional elements.
- [] (square brackets) separated by | (vertical pipes): Indicate alternative options where one or the other can be used, but not both.
Example syntax:
In this example, "open file" is required and must be typed exactly. "fileName" is a variable element; it is the path to and name of the file being opened. The following expression is optional and indicates why the file is being opened. If this expression is added, "for" is required and must be typed exactly. One of the following must be included, but only one, and they also must be typed exactly: "reading", "writing", "readwrite", "appending", or "updating".
Examples:
if version() >= 2.0 then useAdvancedFeatures
put the long version
if the senseTalkVersion < requiredVersion then exit all
put buildNumber() into latestBuildUsed