Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSAppleEventDescriptorMBS class.

NSAppleEventDescriptorMBS.appleEventWithEventClass(eventClass as string, eventID as string, targetDescriptor as NSAppleEventDescriptorMBS, returnID as Int16, transactionID as UInt32) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor that represents an Apple event, initialized according to the specified information.

eventClass: The event class to be set in the returned descriptor.
eventID: The event ID to be set in the returned descriptor.
addressDescriptor: A pointer to a descriptor that identifies the target application for the Apple event. Passing nil results in an Apple event descriptor that has no keyAddressAttr attribute (it is valid for an Apple event to have no target address attribute).
returnID: The return ID to be set in the returned descriptor. If you pass a value of kAutoGenerateReturnID, the Apple Event Manager assigns the created Apple event a return ID that is unique to the current session. If you pass any other value, the Apple Event Manager assigns that value for the ID.
transactionID: The transaction ID to be set in the returned descriptor. A transaction is a sequence of Apple events that are sent back and forth between client and server applications, beginning with the client's initial request for a service. All Apple events that are part of a transaction must have the same transaction ID. You can specify kAnyTransactionID if the Apple event is not one of a series of interdependent Apple events.

Returns a descriptor for an Apple event, initialized according to the specified parameter values, or nil if an error occurs.

Constants such as kAutoGenerateReturnID and kAnyTransactionID are defined in AE.framework, a subframework of ApplicationServices.framework.

NSAppleEventDescriptorMBS.currentProcessDescriptor as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Create and return an application address descriptor using the current process.
Example
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.currentProcessDescriptor
MsgBox "Process ID: "+str(d.processIDValue)

The result is suitable for use as the "targetDescriptor" parameter of appleEventWithEventClass.

NSAppleEventDescriptorMBS.descriptorWithAlias(item as folderitem) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with type typeAlias that stores the specified folderitem reference.
Example
// pick a folderitem
dim folder as FolderItem = SpecialFolder.Desktop

// create value with file reference
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithAlias(folder)

// convert back to FolderItem
dim file as FolderItem = d.FSRefValue

// show path
MsgBox file.NativePath

This type can be converted internally to FSRef descriptor.

NSAppleEventDescriptorMBS.descriptorWithApplicationURL(fileURL as string) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Create and return an application address descriptor using the file URL for an application.
Example
dim f as FolderItem = SpecialFolder.Applications.Child("Stickies.app")
dim u as string = f.URLPath
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithApplicationURL(u)
MsgBox d.applicationURLValue

The result is suitable for use as the "targetDescriptor" parameter of appleEventWithEventClass.

See also:

NSAppleEventDescriptorMBS.descriptorWithApplicationURL(item as folderitem) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Create and return an application address descriptor using the folderitem for an application.
Example
dim f as FolderItem = SpecialFolder.Applications.Child("Stickies.app")
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithApplicationURL(f)
MsgBox d.applicationURLValue

The result is suitable for use as the "targetDescriptor" parameter of appleEventWithEventClass.

See also:

NSAppleEventDescriptorMBS.descriptorWithBoolean(value as Boolean) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with type typeBoolean that stores the specified Boolean value.
Example
dim a as NSAppleEventDescriptorMBS
a = NSAppleEventDescriptorMBS.descriptorWithBoolean(true)
MsgBox a.stringValue // shows true

Returns a descriptor with the specified Boolean value, or nil if an error occurs.

NSAppleEventDescriptorMBS.descriptorWithBundleIdentifier(BundleID as String) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Create and return an application address descriptor using the bundle identifier.
Example
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithBundleIdentifier("com.apple.iCal")
MsgBox d.bundleIDValue

The result is suitable for use as the "targetDescriptor" parameter of appleEventWithEventClass.

Some examples using this method:

NSAppleEventDescriptorMBS.descriptorWithCurrentProcessSerialNumber as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates descriptor with current process serial number.
Example
dim n as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithCurrentProcessSerialNumber
MsgBox n.stringValue // shows app name

NSAppleEventDescriptorMBS.descriptorWithDate(value as date) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor with a date value.
Example
dim d as new date
dim n as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithDate(d)

dim x as date = n.dateValue
MsgBox x.LongDate+" "+x.LongTime // shows today

NSAppleEventDescriptorMBS.descriptorWithDateTime(value as dateTime) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 20.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor with a date value.

NSAppleEventDescriptorMBS.descriptorWithDescriptorType(descriptorType as string, data as memoryblock) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with the specified event type that stores the specified data.

descriptorType: The descriptor type to be set in the returned descriptor.
data: The data, as a memoryblock, to be set in the returned descriptor.

Returns a descriptor with the specified type and data, or nil if an error occurs.

You can use this method to create a descriptor that you can build into a complete Apple event by calling methods such as setAttributeDescriptor, setDescriptor, and setParamDescriptor.

See also:

NSAppleEventDescriptorMBS.descriptorWithDescriptorType(descriptorType as string, data as memoryblock, offset as UInt32, length as UInt32) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with the specified event type that stores the specified data (from a series of bytes).

descriptorType: The descriptor type to be set in the returned descriptor.
bytes: The data, as a sequence of bytes, to be set in the returned descriptor.
offset: offset in memoryblock.
length: The length, in bytes, of the data to be set in the returned descriptor.

Returns a descriptor with the specified type and data, or nil if an error occurs.

See also:

NSAppleEventDescriptorMBS.descriptorWithDouble(value as Double) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor with a double value.
Example
dim a as NSAppleEventDescriptorMBS
a = NSAppleEventDescriptorMBS.descriptorWithDouble(5)
MsgBox a.stringValue // shows 5

NSAppleEventDescriptorMBS.descriptorWithEnumCode(enumerator as string) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with type typeEnumerated that stores the specified enumerator data type value.

enumerator: A type code that identifies the type of enumerated data to be stored in the returned descriptor.

Returns a descriptor with the specified enumerator data type value, or nil if an error occurs.

NSAppleEventDescriptorMBS.descriptorWithFileURL(fileURL as string) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor for a file URL.
Example
dim f as FolderItem = SpecialFolder.Applications.Child("Stickies.app")
dim u as string = f.URLPath
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithFileURL(u)
MsgBox d.fileURLValue

See also:

Some examples using this method:

NSAppleEventDescriptorMBS.descriptorWithFileURL(item as folderitem) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor for a file URL based on the folderitem.
Example
dim f as FolderItem = SpecialFolder.Applications.Child("Stickies.app")
dim d as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithFileURL(f)
MsgBox d.fileURLValue

See also:

NSAppleEventDescriptorMBS.descriptorWithInt16(value as Int16) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with Apple event type typeSInt16 that stores the specified integer value.
Example
dim a as NSAppleEventDescriptorMBS

a = NSAppleEventDescriptorMBS.descriptorWithInt16(5)

MsgBox a.stringValue // shows 5

NSAppleEventDescriptorMBS.descriptorWithInt32(value as Int32) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with Apple event type typeSInt32 that stores the specified integer value.
Example
dim a as NSAppleEventDescriptorMBS
a = NSAppleEventDescriptorMBS.descriptorWithInt32(5)

MsgBox a.stringValue // shows 5

Returns a descriptor containing the specified integer value, or nil if an error occurs.

NSAppleEventDescriptorMBS.descriptorWithProcessIdentifier(PID as Integer) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 16.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Create and return an application address descriptor using the process identifier.
Example
// get my PID
dim p as new ProcessMBS
p.GetCurrentProcess
dim pid as Integer = p.ProcessID

// make process ID descriptor
dim n as NSAppleEventDescriptorMBS = NSAppleEventDescriptorMBS.descriptorWithProcessIdentifier(pid)

// show it
MsgBox "ProcessID: "+str(n.processIDValue) + EndOfLine + n.stringValue

The result is suitable for use as the "targetDescriptor" parameter of appleEventWithEventClass.

NSAppleEventDescriptorMBS.descriptorWithSingle(value as single) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor with a single value.
Example
dim a as NSAppleEventDescriptorMBS
a = NSAppleEventDescriptorMBS.descriptorWithSingle(5)
MsgBox a.stringValue // shows 5

NSAppleEventDescriptorMBS.descriptorWithString(text as string) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with type typeUnicodeText that stores the text from the specified string.
Example
dim a as NSAppleEventDescriptorMBS
a = NSAppleEventDescriptorMBS.descriptorWithString("Hello World")

MsgBox a.stringValue

Returns a descriptor that contains the text from the specified string, or nil if an error occurs.

Some examples using this method:

NSAppleEventDescriptorMBS.descriptorWithTypeCode(typeCode as string) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor initialized with type typeType that stores the specified type value.

typeCode: The type value to be set in the returned descriptor.

Returns a descriptor with the specified type, or nil if an error occurs.

NSAppleEventDescriptorMBS.descriptorWithUInt32(value as UInt32) as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a descriptor with an unsigned integer value.
Example
dim a as NSAppleEventDescriptorMBS
a = NSAppleEventDescriptorMBS.descriptorWithUInt32(5)
MsgBox a.stringValue // shows 5

NSAppleEventDescriptorMBS.listDescriptor as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates and initializes an empty list descriptor.

Returns an empty list descriptor, or nil if an error occurs.

A list descriptor is a descriptor whose data consists of one or more descriptors. You can add items to the list by calling insertDescriptor or remove them with removeDescriptorAtIndex.

Some examples using this method:

NSAppleEventDescriptorMBS.nullDescriptor as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates and initializes a descriptor with no parameter or attribute values set.

Returns a descriptor with no parameter or attribute values set, or nil if an error occurs.

You don't typically call this method, as most NSAppleEventDescriptor instance methods can't be safely called on the returned empty descriptor.

NSAppleEventDescriptorMBS.recordDescriptor as NSAppleEventDescriptorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Apple Script MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates and initializes a descriptor for an Apple event record whose data has yet to be set.

Returns an Apple event descriptor whose data has yet to be set, or nil if an error occurs.

An Apple event record is a descriptor whose data is a set of descriptors keyed by four-character codes. You can add information to the descriptor with methods such as setAttributeDescriptor, setDescriptor, and setParamDescriptor.

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...