33 lines
689 B
Bash
Executable File
33 lines
689 B
Bash
Executable File
#!/bin/zsh
|
|
|
|
# Script to execute an AppleScript or action script file
|
|
# Usage: ./run_script.zsh /path/to/your/script.scpt
|
|
|
|
# Check if a script path was provided
|
|
if [ $# -eq 0 ]; then
|
|
echo "Error: No script file specified"
|
|
echo "Usage: $0 /path/to/script.scpt"
|
|
exit 1
|
|
fi
|
|
|
|
SCRIPT_PATH="$1"
|
|
|
|
# Check if the file exists
|
|
if [ ! -f "$SCRIPT_PATH" ]; then
|
|
echo "Error: Script file not found: $SCRIPT_PATH"
|
|
exit 1
|
|
fi
|
|
|
|
# Execute the script using osascript
|
|
osascript "$SCRIPT_PATH"
|
|
|
|
# Capture the exit status
|
|
EXIT_STATUS=$?
|
|
|
|
if [ $EXIT_STATUS -ne 0 ]; then
|
|
echo "Script execution failed with status: $EXIT_STATUS"
|
|
exit $EXIT_STATUS
|
|
fi
|
|
|
|
echo "Script executed successfully"
|