Accessing System Information with SenseTalk
These functions provide information about various aspects of the system where the SenseTalk script is running.
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.
If fileOrFolder
is not specified, the diskSpace
function returns the amount of space available on the volume containing the current working folder, as indicated by the folder
global property.
Syntax:
the diskSpace {of fileOrFolder}
diskSpace({fileOrFolder})
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.
Returns: The number of your version of Eggplant Functional. For example: Eggplant 19.2.1-Windows
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})
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()
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()
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()
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()
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()
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()
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()
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()
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()
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.
Syntax:
the userInfo
userInfo()
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 {long} version
version()
the senseTalkVersion
senseTalkVersion()
the buildNumber
buildNumber()
Examples:
if version() >= 2.0 then useAdvancedFeatures
put the long version
if the senseTalkVersion < requiredVersion then exit all
put buildNumber() into latestBuildUsed