This page describes Tclģ calls that manipulate AppleEvent descriptors. For information on the associated ToolBox calls and data structures, see INSIDE MACINTOSH: Interapplication Communication.


AppleEvent Descriptors

tclAE::coerceData

Tcl wrapper for ToolBox AECoercePtr call.

Synopsis

tclAE::coerceData typeCode data toType

Result

New AEDesc.

Description

Create a new AEDesc, casting data from typeCode to toType. Unlike the ToolBox call, the data is passed directly, rather than in a pointer.

Example

tclAE::coerceData "/some/path/here" alis
alis(«0000000000E2000…00073FFFF0000»)

tclAE::coerceDesc

Tcl wrapper for ToolBox AECoerceDesc call.

Synopsis

tclAE::coerceDesc anAEDesc toType

Result

New AEDesc.

Description

Create a new AEDesc, casting the original AEDesc to toType.

Example

tclAE::coerceDesc alis(«0000000000E2000…00073FFFF0000») TEXT
“/some/path/here”

tclAE::createDesc

Tcl wrapper for ToolBox AECreateDesc call.

Synopsis

tclAE::createDesc typeCode [data]

Result

Hash key for new AEDesc.

Description

Create a new AEDesc of type typeCode with optional data.

Example

tclAE::createDesc type
'type'()
tclAE::createDesc TEXT "some text"
“some text”

tclAE::duplicateDesc

Tcl wrapper for ToolBox AEDuplicateDesc call.

Synopsis

tclAE::duplicateDesc anAEDesc

Result

Hash key for duplicate AEDesc.

Description

The descriptor record specified by anAEDesc is duplicated and the new AEDesc is entered into the hash table.

tclAE::getData

Tcl wrapper for AEGetDescData call (read access for theAEDesc.dataHandle in pre-Carbon), including coercion.

Synopsis

tclAE::getData theAEDesc [desiredType] [typeCodePtr]

Result

The data held in theAEDesc.

Description

theAEDesc is cast to desiredType (if supplied). Pass '????' in desiredType to force the return of raw binary data. If supplied, the final type of the data will be placed in the variable named by typeCodePtr.

Example

tclAE::getData “3”
3
tclAE::getData “3” **** type
3
set type
TEXT
tclAE::getData “3” sing type
3.0
set type
sing

tclAE::getDescType

Tcl read access for theAEDesc.descriptorType.

Synopsis

tclAE::getDescType theAEDesc

Result

The DescType of theAEDesc.

Example

tclAE::getDescType “3”
TEXT
tclAE::getDescType 3
shor

tclAE::replaceDescData

Tcl wrapper for Carbon AEReplaceDescData call and/or Tcl write access for theAEDesc.typeCode and theAEDesc.dataHandle.

Synopsis

tclAE::replaceDescData theAEDesc typeCode data

Result

None.

Description

The data and typeCode in theAEDesc are replaced.

Example

tclAE::replaceDescData {“eeny meeny”} TEXT {miney moe}
“miney moe”

tclAE::setDescType

Tcl write access for theAEDesc.descriptorType.

Synopsis

tclAE::setDescType theAEDesc toType

Result

None.

Description

The DescType of theAEDesc is set to toType. The internal data of theAEDesc is unchanged.

Example

tclAE::setDescType {“eeny meeny”} JUNK
JUNK(«65656E79206D65656E79»)

AppleEvent Descriptor Lists

tclAE::countItems

Tcl wrapper for ToolBox AECountItems call.

Synopsis

tclAE::countItems anAEDescList

Result

The number of items in anAEDescList.

Description

Count items in anAEDescList.

Example

tclAE::countItems {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]}
3

tclAE::createList

Tcl wrapper for ToolBox AECreateList call.

Synopsis

tclAE::createList [isRecord]

Result

New AEDescList.

Description

If isRecord is present and true, an AERecord is created, otherwise an AEDescList.

Example

tclAE::createList
[]
tclAE::createList 1
{}

tclAE::deleteItem

Tcl wrapper for ToolBox AEDeleteItem call.

Synopsis

tclAE::deleteItem theAEDescList index

Result

None.

Description

Delete descriptor record at position index from theAEDescList. All subesequent descriptor records will then move up one item.

Example

tclAE::deleteItem {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]}
[123, alis(«0000000000E2000…00073FFFF0000»)]

tclAE::getNthData

Tcl emulator for ToolBox AEGetNthPtr call.

Synopsis

tclAE::getNthData theAEDescList index [desiredType] [keyIfAnyPtr] [typeCodePtr]

Result

The data from the descriptor record at position index in theAEDescList.

Description

The descriptor record specified by index is obtained from theAEDescList. The Resulting AEDesc is then processed as by tclAE::getData.

Example

tclAE::getNthData {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} 1
eeny meeny
tclAE::getNthData {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} 2 TEXT
/some/path/here
tclAE::getNthData {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} 2 TEXT key type
/some/path/here
set key
keyC
set type
TEXT

tclAE::getNthDesc

Tcl wrapper for ToolBox AEGetNthDesc call.

Synopsis

tclAE::getNthDesc theAEDescList index [desiredType] [keyIfAnyPtr]

Result

AEDesc hash key for the item descriptor.

Description

The item record specified by index is obtained from theAEDescList. The Resulting AEDesc is optionally coerced to desiredType, duplicated, and a new hash key is returned for it.

Example

tclAE::getNthDesc {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} 1
“eeny meeny”
tclAE::getNthDesc {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} 2 TEXT
“/some/path/here”
tclAE::getNthDesc {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} 2 TEXT key
“/some/path/here”
set key
keyC

tclAE::putData

Tcl emulator for ToolBox AEPutPtr call.

It does not appear to be possible to put data into an AERecord by index on Mac OS X. Use tclAE::putKeyData.

Synopsis

tclAE::putData theAEDescList index typeCode data

Result

The updated value of theAEDescList.

Description

The descriptor record specified by index in theAEDescList is replaced with a new descriptor record composed from data cast to typeCode.

Example

tclAE::putData {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} 1 TEXT "miney moe"
[123, “miney moe”, alis(«0000000000E2000…00073FFFF0000»)]
tclAE::putData {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} -1 TEXT "miney moe"
[123, “miney moe”, alis(«0000000000E2000…00073FFFF0000»), “miney moe”]

tclAE::putDesc

Tcl wrapper for ToolBox AEPutDesc call.

It does not appear to be possible to put an AEDesc into an AERecord by index on Mac OS X. Use tclAE::putKeyDesc.

Synopsis

tclAE::putDesc theAEDescList index anAEDesc

Result

The updated value of theAEDescList.

Description

The descriptor record specified by index in theAEDescList is replaced with a copy of anAEDesc.

Example

tclAE::putDesc {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} 0 345
[345, “miney moe”, alis(«0000000000E2000…00073FFFF0000»)]
tclAE::putDesc {[123, “eeny meeny”, alis(«0000000000E2000…00073FFFF0000»)]} -1 345
[123, “miney moe”, alis(«0000000000E2000…00073FFFF0000»), 345]

AppleEvent Descriptor Records

tclAE::deleteKeyDesc

Tcl wrapper for ToolBox AEDeleteKeyDesc call.

This call is presently broken. It does delete the key, but does not update the string form. Also, the call does not return the AEDesc.

Synopsis

tclAE::deleteKeyDesc theAERecord theAEKeyword

Result

The updated value of theAERecord.

Description

Delete the keyword-specified descriptor record specified by theAEKeyword from theAERecord.

Example

tclAE::deleteKeyDesc {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyB
{keyA:123, keyC:alis(«0000000000E2000…00073FFFF0000»)}

tclAE::getKeyData

Tcl emulator for ToolBox AEGetKeyPtr call.

Synopsis

tclAE::getKeyData theAERecord theAEKeyword [desiredType] [typeCodePtr]

Result

data.

Description

The keyword-specified descriptor record specified by theAEKeyword is obtained from theAERecord. The Resulting AEDesc is then processed as by tclAE::getData.

Example

tclAE::getKeyData {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyB
eeny meeny
tclAE::getKeyData {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyC TEXT type
/some/path/here
set key
keyC

tclAE::getKeyDesc

Tcl wrapper for ToolBox AEGetKeyDesc call.

Synopsis

tclAE::getKeyDesc theAERecord theAEKeyword [desiredType]

Result

New AEDesc.

Description

The keyword-specified descriptor record specified by theAEKeyword is obtained from theAERecord, optionally coerced to desiredType, duplicated, and a new hash key is returned for it.

Example

tclAE::getKeyDesc {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyB
“eeny meeny”
tclAE::getKeyDesc {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyC TEXT
“/some/path/here”

tclAE::putKeyData

Tcl emulator for ToolBox AEPutKeyPtr call.

Synopsis

tclAE::putKeyData theAERecord theAEKeyword typeCode data

Result

The updated value of theAERecord.

Description

The keyword-specified descriptor record specified by theAEKeyword in theAERecord is replaced or inserted with a new descriptor record composed from data cast to typeCode.

Example

tclAE::putKeyData {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyB TEXT "miney moe"
{keyA:123, keyB:“miney moe”, keyC:alis(«0000000000E2000…00073FFFF0000»)}
tclAE::putKeyData {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyD TEXT "miney moe"
{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»), keyD:“miney moe”}

tclAE::putKeyDesc

Tcl wrapper for ToolBox AEPutKeyDesc call.

Synopsis

tclAE::putKeyDesc theAERecord theAEKeyword anAEDesc

Result

The updated value of theAERecord.

Description

The keyword-specified descriptor record specified by theAEKeyword in theAERecord is replaced or inserted with a copy of anAEDesc.

Example

tclAE::putKeyDesc {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyB {“miney moe”}
{keyA:123, keyB:“miney moe”, keyC:alis(«0000000000E2000…00073FFFF0000»)}
tclAE::putKeyDesc {{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»)}} keyD {“miney moe”}
{keyA:123, keyB:“eeny meeny”, keyC:alis(«0000000000E2000…00073FFFF0000»), keyD:“miney moe”}

AppleEvents

tclAE::getAttributeData

Tcl emulator for ToolBox AEGetAttributePtr call.

Synopsis

tclAE::getAttributeData theAppleEvent theAEKeyword [desiredType] [typeCodePtr]

Result

The data from the keyword-specified descriptor record from theAppleEvent.

Description

The keyword-specified descriptor record specified by theAEKeyword is obtained from theAppleEvent. The Resulting AEDesc is then processed as by tclAE::getData.

Example

set ae [tclAE::send -r -s "syso" "GMT "]
aevt\ansr{'----':-18000, &tran:0, &rtid:40370184, &addr:psn («0000000000000002»), &timo:0, &inte:112, &esrc:2, &from:psn («00000000003E0001»)}
tclAE::getAttributeData $ae rtid
40370184
tclAE::getAttributeData $ae addr **** type
 
set type
psn

tclAE::getAttributeDesc

Tcl wrapper for ToolBox AEGetAttributeDesc call.

Synopsis

tclAE::getAttributeDesc theAppleEvent theAEKeyword [desiredType]

Result

New AEDesc.

Description

The keyword-specified descriptor record specified by theAEKeyword is obtained from theAppleEvent, optionally coerced to desiredType, duplicated, and a new hash key is returned for it.

Example

set ae [tclAE::send -r -s "syso" "GMT "]
aevt\ansr{'----':-18000, &tran:0, &rtid:40370184, &addr:psn («0000000000000002»), &timo:0, &inte:112, &esrc:2, &from:psn («00000000003E0001»)}
tclAE::getAttributeDesc $ae addr
psn («0000000000000002»)

Copyright © 1999–2003 Jonathan E. Guyer. All rights reserved.

Last modified Wednesday, March 12, 2003 9:15:30 AM

Valid CSS! Valid HTML 4.0!