appleevents

package
v3.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package appleevents sends typed Apple Events without compiling or executing scripts.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("native Apple Events require macOS with cgo")

Functions

func Available

func Available() bool

func Send

func Send(ctx context.Context, event Event) (Value, Stats, error)

Types

type Error

type Error struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	Attempted bool   `json:"attempted"`
	Cause     error  `json:"-"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type Event

type Event struct {
	Class   string           `json:"class"`
	ID      string           `json:"id"`
	Params  map[string]Value `json:"params,omitempty"`
	Timeout time.Duration    `json:"-"`
}

type Sender

type Sender func(context.Context, Event) (Value, Stats, error)

Sender allows operation tests to supply a descriptor-level fake transport.

type Stats

type Stats struct {
	Events    int64   `json:"events"`
	ElapsedMS float64 `json:"elapsedMs"`
	Attempted bool    `json:"attempted"`
}

type Value

type Value struct {
	Kind    string           `json:"kind"`
	Code    string           `json:"code,omitempty"`
	Text    string           `json:"text,omitempty"`
	Number  int64            `json:"number,omitempty"`
	Real    float64          `json:"real,omitempty"`
	Boolean bool             `json:"boolean,omitempty"`
	Items   []Value          `json:"items,omitempty"`
	Fields  map[string]Value `json:"fields,omitempty"`
	Data    string           `json:"data,omitempty"`
}

Value is a portable description of an Apple Event descriptor. Opaque replies retain a flattened descriptor so returned object references can be reused.

func All

func All(class string, container Value) Value

func Bool

func Bool(b bool) Value

func ByID

func ByID(class string, id Value, container Value) Value

func ByName

func ByName(class, name string, container Value) Value

func ByTest

func ByTest(class string, test, container Value) Value

ByTest selects objects whose comparison or logical test evaluates to true.

func Comparison

func Comparison(operator string, left, right Value) Value

Comparison describes a public Apple Event comparison record (cmpd).

func CurrentContainer

func CurrentContainer() Value

CurrentContainer refers to the collection currently resolving a relative selector.

func Date

func Date(t time.Time) Value

func Enum

func Enum(code string) Value

func Examined

func Examined() Value

Examined refers to the object currently being evaluated by a test selector.

func File

func File(path string) Value

func Index

func Index(class string, index int, container Value) Value

func Insertion

func Insertion(object Value, position string) Value

Insertion describes a native insertion location relative to an object.

func Int

func Int(n int64) Value

func List

func List(items ...Value) Value

func Logical

func Logical(operator string, terms ...Value) Value

Logical combines comparison tests in a public logical record (logi).

func Null

func Null() Value

func Object

func Object(class, form string, key, container Value) Value

func Ordinal

func Ordinal(code string) Value

Ordinal describes an absolute collection position such as all or first.

func Property

func Property(code string, container Value) Value

func Range

func Range(class string, start, end int, container Value) Value

Range selects a contiguous inclusive range of one-based collection indexes. Its endpoints resolve against the current range container, as Mail requires.

func Record

func Record(fields map[string]Value) Value

func RoundTrip

func RoundTrip(value Value) (Value, error)

func String

func String(s string) Value

func TypeCode

func TypeCode(code string) Value

func (Value) BoolValue

func (v Value) BoolValue() bool

func (Value) IntValue

func (v Value) IntValue() int64

func (Value) StringValue

func (v Value) StringValue() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL