script

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayCmd

type DelayCmd struct {
	Ms int64 `json:"ms"`
}

DelayCmd represents a delay command.

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor executes a script.

func NewExecutor

func NewExecutor(s *Script) *Executor

NewExecutor creates a new script executor.

func (*Executor) Execute

func (e *Executor) Execute() (int, error)

Execute runs the script.

func (*Executor) SetInputFunc

func (e *Executor) SetInputFunc(f func(key, action string, durationTicks int64) error)

SetInputFunc sets the function to call for input commands.

func (*Executor) SetMouseFunc

func (e *Executor) SetMouseFunc(f func(action string, x, y int, button string, durationTicks int64) error)

SetMouseFunc sets the function to call for mouse commands.

func (*Executor) SetScreenshotFunc

func (e *Executor) SetScreenshotFunc(f func(output string, async bool) error)

SetScreenshotFunc sets the function to call for screenshot commands.

func (*Executor) SetWheelFunc

func (e *Executor) SetWheelFunc(f func(x, y float64) error)

SetWheelFunc sets the function to call for wheel commands.

type InputCmd

type InputCmd struct {
	Action        string `json:"action"`
	Key           string `json:"key"`
	DurationTicks int64  `json:"duration_ticks"`
}

InputCmd represents an input command.

type MouseCmd

type MouseCmd struct {
	Action        string `json:"action"`
	X             int    `json:"x"`
	Y             int    `json:"y"`
	Button        string `json:"button"`
	DurationTicks int64  `json:"duration_ticks"`
}

MouseCmd represents a mouse command.

type Node

type Node interface {
	// contains filtered or unexported methods
}

Node represents a node in the script AST.

type RepeatCmd

type RepeatCmd struct {
	Times    int    `json:"times"`
	Commands []Node `json:"commands"`
}

RepeatCmd represents a repeat block.

type RepeatCmdRaw

type RepeatCmdRaw struct {
	Times    int               `json:"times"`
	Commands []json.RawMessage `json:"commands"`
}

RepeatCmdRaw is used during parsing to hold raw JSON commands.

type ScreenshotCmd

type ScreenshotCmd struct {
	Output string `json:"output"`
	Async  bool   `json:"async"`
}

ScreenshotCmd represents a screenshot command.

type Script

type Script struct {
	Version  string `json:"version"`
	Commands []Node `json:"commands"`
}

Script is the root node of a script.

func Parse

func Parse(path string) (*Script, error)

Parse reads and parses a script file.

func ParseBytes

func ParseBytes(data []byte) (*Script, error)

ParseBytes parses a script from JSON bytes.

func ParseString

func ParseString(s string) (*Script, error)

ParseString parses a script from a JSON string.

type WheelCmd

type WheelCmd struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

WheelCmd represents a wheel command.

Jump to

Keyboard shortcuts

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