#!/usr/bin/osascript

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title my custom glitch effect
# @raycast.mode compact

# Optional parameters:
# @raycast.icon 🤖

# Documentation:
# @raycast.description for autoglitch images
# @raycast.author antonoratom
# @raycast.authorURL https://raycast.com/antonoratom

log "Hello World!"

-- AppleScript section to get the selected file in Finder
tell application "Finder"
    set selectedFiles to selection
    if selectedFiles is {} then
        display dialog "No file selected in Finder."
        return
    end if

    set selectedFile to item 1 of selectedFiles
    set filePath to POSIX path of (selectedFile as alias)
end tell

-- Shell script section to execute the Python script
do shell script "/usr/bin/python3 /Users/anton/Documents/GitHub/raycast/villains-3/glitch_effect.py " & quoted form of filePath
