# Automation

Automate Report creation, remotely set settings, and control licenses with the FoolCat API. You can also trigger custom scripts on specific events, start run custom processes or other apps, and integrate FoolCat into existing workflows.

## Requirements

* FoolCat Pro license
* API: FoolCat 20.1 or newer&#x20;
* Scripting: FoolCat 25.3 or newer

## API

You can tell FoolCat to do something by calling the app URL: `foolcat://`. You can call this from any app or script that can open a URL.

Copy/paste the URL below in a web browser, press `Enter`, and EditReady will open.

```
editready://open
```

You can also use a shell, copy/paste the command below, press `Enter`, and EditReady will open.

{% tabs %}
{% tab title="macOS" %}

```
open 'foolcat://open'
```

{% endtab %}

{% tab title="Windows" %}

```
start 'foolcat://open'
```

{% endtab %}
{% endtabs %}

### Activate

```
foolcat://activate?key=<your-license-key>
```

### Deactivate

```
foolcat://deactivate
```

### Create Report

{% code overflow="wrap" %}

```
foolcat://create?source=<source-path>&destination=<destination-path>&name=<report-name>&description=<report-description>
```

{% endcode %}

## Scripting

You can attach scripts (AppleScript or Python) to the following events:

* FoolCat Started
* Report Created

<figure><img src="https://1060439511-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LStRji2w1AYja1bLBFv%2Fuploads%2FFp5okmkC55CSPqRS7Yyf%2FCleanShot%202025-10-03%20at%2017.26.04.png?alt=media&#x26;token=873decf9-863c-48f3-abef-b1c99524cb3d" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
Scripting is a powerful tool. Easy to learn, but even easier to screw up. Always test your script with disposable data, and then test again. And again. Hedge does not offer support or assume responsibility for problems with or due to examples or any other script. If you’re new to scripting, find someone to help you out, or use the example scripts available here. Remember: you are solely responsible.
{% endhint %}

### FoolCat Started

Fires once when launching FoolCat. Has no payload.

### Report Created

Fires when a Report has been created, and has the following payload:

{% code overflow="wrap" %}

```
03/10/2025, 10:55:21 - Report Created: {
  "ReportCreated_status" = "Success";  
  "ReportCreated_error" = "none";
  "ReportCreated_pdfPath" = "/Volumes/Hedge/A001/Reports.pdf";  
  "ReportCreated_htmlPath" = "/Volumes/Hedge/A001/Reports.html";
}
```

{% endcode %}

### Python

When a Python script is executed, the event payload is passed as a JSON string in the first command-line argument (sys.argv\[1]). You can parse it into a dictionary as follows:

```
import sys
import json

# Load the event payload from the first argument
payload = json.loads(sys.argv[1])

# Example: access fields from the payload
print(payload.get("FileConversionCompleted_status"))
```

### AppleScript

When an AppleScript script is executed, the event payload is injected into the script by finding key names, e.g. "{FileConversionCompleted\_status}" , and replacing them with values. You can test this as follows:

```
display alert "{ReportCreated_status}"
```

### Event Log

All events and script execution results are recorded in the Event Log. You can find the log file at:

{% code overflow="wrap" %}

```
/Users/[your-username]/Library/Application Support/FoolCat/Event Log/FoolCatEvents.log
```

{% endcode %}
