aes_externalobj 0.0.2

Adobe ExtendScript external object library implementation in Rust
Documentation

Adobe Extended Script ExternalObject (aes_externalobj)

A Rust implementation of Adobe ExtendScript external object interface, allowing creation of native extensions for Adobe applications.

Motivation

ExtendScript is based on JavaScript ES3, which is quite outdated. The old interface has a C/C++ based external object, which allowed you to create your own extensions. The goal of this project is to provide a Rust implementation of the ExtendScript external object interface, but with a more modern and safe Rust wrapper around the C ABI. The project currently has a basic implementation and is in development.

Installation

Add this to your Cargo.toml:

[dependencies]

aes_externalobj = "0.0.1"

Usage

To create an ExtendScript external object, you need to:

  1. Define your function signatures
  2. Implement the required functions
  3. Export them with proper C ABI compatibility

Here's a simple example that provides a function to return a greeting from Rust:

use aes_externalobj::{
    TaggedData, ES_ERR_OK,
    TYPE_STRING
};
use std::ffi::{c_char, c_long, CString};

// Define your function signatures
// Format: "FunctionName_types" where types are:
// s - string, i - integer, n - number, b - boolean, o - object
static SIGNATURES: &str = "HelloFromRust_s";

#[no_mangle]
pub extern "C" fn ESGetVersion() -> c_long {
    1 // Library version
}

#[no_mangle]
pub extern "C" fn ESInitialize(argv: *mut TaggedData, _argc: c_long) -> *mut c_char {
    let c_str = CString::new(SIGNATURES).unwrap();
    c_str.into_raw()
}

#[no_mangle]
pub extern "C" fn ESTerminate() {
    // Cleanup code here
}

// Example function that returns a greeting string
#[no_mangle]
pub extern "C" fn HelloFromRust(_argv: *mut TaggedData, _argc: c_long, retval: *mut TaggedData) -> c_long {
    unsafe {
        *retval = TaggedData::new_string("Hello from Rust!");
        ES_ERR_OK
    }
}

Then in ExtendScript you can use it like this:

// Load the external object
var ext = new ExternalObject("lib:your_library_name");

// Call the function - it will return "Hello from Rust!"
var message = ext.HelloFromRust();
alert(message); // Shows "Hello from Rust!"

// Clean up
ext.unload();

Building

Prerequisites

  • Rust 1.56 or higher

Build Commands

cargo build --release

Documentation

For detailed documentation, visit docs.rs/aes_externalobj

Roadmap

  • Basic implementation
  • Extend SoServerInterface
  • LiveObjects
  • Add JavaScript objects
  • Documentation
  • Error handling

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under dual MIT/Apache-2.0 license. See LICENSE-MIT and LICENSE-APACHE for details.

Acknowledgments

  • Adobe Systems for ExtendScript technology
  • The Rust community for excellent tools and support