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!