PlatformService Reference

From The Foundry MODO SDK wiki
Jump to: navigation, search

The platformservice interface provides information about the system that modo is running on. This includes the user that the application is licensed to, the application version, and operating system information.

Attributes

Querying the platformservice ScriptQuery interface reveals ten root attributes and one attribute group:

  • licensedto
  • exipiresin
  • serialnum
  • numlicenses
  • appname
  • appversion
  • appbuild
  • isheadless
  • ostype
  • osname
  • osversion
  • paths
  • path.???
  • importpaths
  • isapp64bit
  • alias

Licensing

Basic licensing information can be read with these attributes, including the name of the licensed owner of the application and how long before the license key expires.

licensedto

Get the name of the licensed modo user. Returns the string (unregistered), localized to the current language, if the application is not licensed.

Datatype string
Example query platformservice licensedto ?
Result 'John Doe

expiresin

Get the number of days before the license key expires. If this is a permanent key, this returns -1.

Datatype string
Example query platformservice expiresin ?
Result -1

serialnum

Get the serial number of a licensed application. This is only valid when licensedto does not return (unregistered).

Datatype string
Example query platformservice serialnum ?
Result [serial number of the license]

numlicenses

Get the number of machines that this license supports. This is only valid when licensedto does not return (unregistered).

Datatype integer
Example query platformservice numlicenses ?
Result 1

Application Information

Basic application information can be read with these attributes, including the name of the application and the version and build numbers.

appname

Get the name of the application. For modo, this will be the string modo.

Datatype string
Example query platformservice appname ?
Result modo

appversion

Get the version number of the application.

Datatype integer
Example query platformservice appversion ?
Result 601

appbuild

Get the build number of the application.

Datatype integer
Example query platformservice appbuild ?
Result 48460

isapp64bit

Returns true if the application itself is 64 bit, and false if it is 32 bit. This does not report if the OS is 64 or 32 bit, just if the application itself is.

Datatype integer
Example query platformservice isapp64bit ?
Result 1

Headless Operation

The nexus infrastructure supports running in a headless mode without a user interface.

isheadless

Returns true if the application is running without a user interface.

Datatype integer
Example query platformservice isheadless ?
Result 0

Operating System Information

ostype

Get the operating system type. This will be MacOSX, Win32 or Linux.

Datatype string
Example query platformservice ostype ?
Result MacOSX

osname

Get a more human-readable operating system name.

Datatype string
Example query platformservice osname ?
Result Mac OS X 10.7.3

osversion

Get a version string from the operating system. The format is dependent on the OS. For example, Windows will commonly include the service pack as well.

Datatype string
Example query platformservice osversion ?
Result 10.7.3

Paths

This attribute returns a list of file system paths used by modo. See Path Aliases: Standard Paths for more information.

paths

Get a list of paths names used by modo.

Datatype string
Example query platformservice paths ?
Result [list of paths]

path Attributes

The path attributes are used to obtain information about a path alias. The internal name of the path is used as the selector. Currently only one attribute is defined, which resolves the internal name into an absolute file system path.

paths.path

Get the alias's absolute file system path.

Datatype string
Example query platformservice path.path ? temp
Result /Users/jangell/Library/Application Support/Luxology/AutoSave

importpaths

The import paths attribute is used to get a list of all imported resource paths. These paths are used for the default location for scripts and icons, and are scanned on startup for auxiliary config files.

importpaths

Get the imported resource paths.

Datatype string
Example query platformservice importpaths ?
Result [list of all imported paths]

Resolving Aliases

The alias attribute resolves an alias into an absolute path. This can be used with any aliases the user may have created, or the implicit alias defined by a kit. If the alias cannot be resolved, this will return the original alias passed in. The alias can include subdirectories, which will be included in the returned string. This may not work with all aliases explicitly defined by modo itself; those can be read with paths and path.path as described above. It can also be used to resolve kit aliases into absolute paths. The selector is the name of the alias to resolve, including any option subdirectories.

alias

Resolve a path alias into an absolute path.

Datatype string
Example query platformservice alias ? "myAlias:SubDir"
Result [absolute path of the alias]/SubDir

More Information