Local and cloud-based workflows for extracting and updating text layers in PSD files via ExtendScript and Adobe PS API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
No EOL
1.5 KiB
Bash
Executable file
57 lines
No EOL
1.5 KiB
Bash
Executable file
#!/bin/bash
|
|
# Script to run the comparison JSX script in Photoshop
|
|
|
|
# Change to the script directory
|
|
cd "$(dirname "$0")"
|
|
|
|
# Path to the JSX script
|
|
JSX_SCRIPT="test/compare_layers.jsx"
|
|
|
|
# Check if the script exists
|
|
if [ ! -f "$JSX_SCRIPT" ]; then
|
|
echo "Error: JSX script not found at $JSX_SCRIPT"
|
|
exit 1
|
|
fi
|
|
|
|
# Function to run the script in Photoshop
|
|
run_in_photoshop() {
|
|
local psd_file="$1"
|
|
local jsx_script="$2"
|
|
|
|
# Construct absolute paths
|
|
local abs_psd_file="$(cd "$(dirname "$psd_file")"; pwd)/$(basename "$psd_file")"
|
|
local abs_jsx_script="$(cd "$(dirname "$jsx_script")"; pwd)/$(basename "$jsx_script")"
|
|
|
|
echo "Opening PSD file: $abs_psd_file"
|
|
echo "Running JSX script: $abs_jsx_script"
|
|
|
|
# Create and run the AppleScript
|
|
osascript <<EOF
|
|
tell application "Adobe Photoshop"
|
|
activate
|
|
open POSIX file "$abs_psd_file"
|
|
do javascript file "$abs_jsx_script"
|
|
end tell
|
|
EOF
|
|
}
|
|
|
|
# Check if an argument was provided
|
|
if [ $# -lt 1 ]; then
|
|
echo "Usage: $0 /path/to/original.psd"
|
|
echo "This will open the original PSD and then prompt for the processed PSD to compare."
|
|
exit 1
|
|
fi
|
|
|
|
# Get the input PSD file
|
|
PSD_FILE="$1"
|
|
|
|
# Check if the file exists
|
|
if [ ! -f "$PSD_FILE" ]; then
|
|
echo "Error: PSD file not found at $PSD_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
# Run the script in Photoshop
|
|
run_in_photoshop "$PSD_FILE" "$JSX_SCRIPT"
|
|
|
|
echo "Comparison complete! Check the text_layer_comparison.txt file in the same folder as the original PSD." |