coerceValue

Syntax coerceValue (value, toType)

Params value is the object whose datatype you wish to convert.

toType is a string4 value indicating the desired type.

Action Asks the Apple Event Manager to convert value to the datatype indicated by toType. Frontier's built-in datatype coercion facilities are not used.

Returns The resulting value of type toType if coercion is successful, an error condition otherwise.

Examples coerceValue (6.23, stringType) // same result as Frontier's string verb

   » "6.23"

coerceValue (6.23, 'doub') // creates binary [doub] value

   » "\x1E¸Qì"

coerceValue (12, listType)

   » {12}

coerceValue ({1, 2, 3}, stringType) // error; no list-to-string AE coercion available

Platform Notes This verb is only implemented in the Mac OS version of Frontier.

Notes toType can be one of Frontier's built-in types, such as stringType or doubleType, or any other 4-character code.

This verb maps directly to the Macintosh AECoerceDesc function, and is not connected to Frontier's built-in data coercion facilities.

This verb does not work on Windows.

If AppleScript is installed, any coercion 'osax' files in the Scripting Additions folder will be accessed by this verb.

Discuss