Accessing System Information with SenseTalk

These functions provide information about various aspects of the system where the SenseTalk script is running.

diskSpace function

What It Does

Returns the number of bytes of free space available on a disk.

When to Use It

Use the diskSpace() function to find out how much free space (in bytes) is available on a file system.

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.

Examples

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

Tech Talk

Syntax:the diskSpace {of fileOrFolder} diskSpace(fileOrFolder)

diskSpace(fileOrFolder)

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.

EggPlantVersion Function

Example:

log the eggPlantVersion

Parameters: None.

Returns: The number of your version of Eggplant Functional. For example: Eggplant 16.1.2-Windows

Behavior: Returns the number of your version of Eggplant Functional.

env function

What it Does

The env function provides access to the environment variables supplied by the environment in which SenseTalk is running.

When to Use It

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.

Examples

put env("Home") into homeFolder

put env() -- display all available information

Tech Talk

Syntax: the env {of varName}

env(varName)

hostAddresses function

What it Does

The hostAddresses function returns a list of all of the IP addresses for the host computer where SenseTalk is running.

When to Use It

Call hostAddresses to find all of the network IP addresses for the local host.

Examples

put item 1 of the hostAddresses into myIPAddress

Tech Talk

Syntax: the hostAddresses

hostAddresses()

hostName, hostNames functions

What it Does

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.

When to Use It

Call hostName or hostNames to find names by which the local host may be known on the network.

Examples

put the hostName into localName

Tech Talk

Syntax:the hostName

hostName()

the hostNames

hostNames()

machine function

What it Does

Returns the type of machine hardware of the computer where SenseTalk is running.

When to Use It

Call machine to determine the machine hardware platform.

Examples

if the machine is "i386" then put "Intel" into hardwareType

Tech Talk

Syntax: the machine

machine()

OSInfo function

What it Does

The OSInfo function returns a property list containing various items of information about the operating system of the machine where SenseTalk is running.

When to Use It

Call OSInfo to learn information about the host operating system.

Examples

put the OSInfo

Tech Talk

Syntax: the OSInfo

OSInfo()

platform function

What it Does

The platform function returns the name of the host operating system where SenseTalk is running, such as "MacOS", "Linux", etc.

When to Use It

Call platform to make decisions based on SenseTalk's host platform.

Examples

if the platform is "MacOS" then exit script

Tech Talk

Syntax:the platform

platform()

processInfo function

What it Does

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.

When to Use It

Call processInfo to obtain information about the identity of the process running the script.

Examples

put the processInfo

Tech Talk

Syntax: the processInfo

processInfo()

processor function

What it Does

The processor function returns the type of processor of the host computer where SenseTalk is running, such as "x86", "Power Macintosh", etc.

When to Use It

Call processor to determine the CPU type for the local host.

Examples

put the processor into CPUType

Tech Talk

Syntax: the processor

processor()

systemInfo function

What it Does

The systemInfo function returns a property list containing various pieces of information about the system where SenseTalk is running.

When to Use It

Call systemInfo to learn information such as the amount of memory installed or the processor byte order for the local host.

Examples

put the systeminfo's memorySize /1 GB into gigaBytes

if systemInfo().NativeByteOrder is "Big-Endian" then swap

Tech Talk

Syntax:the systemInfo

systemInfo()

systemVersion function

What it Does

The systemVersion function returns the version number of the operating system on the host computer where SenseTalk is running.

When to Use It

Use systemVersion to check which OS version a script is running on.

Examples

if systemVersion() begins with "10.5" then put "Leopard!"

Tech Talk

Syntax: the systemVersion

systemVersion()

userInfo function

What it Does

The userInfo function returns a property list containing various pieces of information about the user account where SenseTalk is running.

When to Use It

Call userInfo to get information about the logged-in user, such as their FullName, ShortName, and HomeDirectory.

Examples

put the userInfo's FullName into fullName

set the folder to userInfo().HomeDirectory

Tech Talk

Syntax: the userInfo

userInfo()

version, long version, senseTalkVersion, buildNumber functions

What it Does

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.

When to Use It

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.

Examples

if version() >= 2.0 then useAdvancedFeatures

put the long version

if the senseTalkVersion < requiredVersion then exit all

put buildNumber() into latestBuildUsed

Tech Talk

Syntax: the {long} version

version()

the senseTalkVersion

senseTalkVersion()

the buildNumber

buildNumber()

 

This topic was last updated on October 11, 2019, at 11:18:54 AM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant