Use copied file path in terminal (from applescript and automator) I'm trying to create a simple workflow that will be used to help non-technical people use tesseract OCR. I have no problem using it myself, but others probably prefer GUIs, so I'm working on the following automator workflow (image below): https://drive.google.com/file/d/1nxiQVt7sQigQwgjpscG-0E9loCRO7Fxe/view?usp=sharing

Script:

set appName to "Terminal"

if application appName is running then
    tell application "Terminal"
        activate
        do script "tesseract /Users/jackson/Downloads/OCRTemp.jpg /Users/jackson/Downloads/OCRTemp.txt"
    end tell

else
    tell application "Terminal"
        activate
        do script "tesseract /Users/jackson/Downloads/OCRTemp.jpg /Users/jackson/Downloads/OCRTemp.txt" in front window
    end tell
end if


The problem is that in the line "tesseract /Users/jackson/Downloads/OCRTemp.jpg /Users/jackson/Downloads/OCRTemp.txt" I would like to replace the first file extension with the clipboard. Not being well versed in how to use bash, I'm not entirely sure what to do. I think part of the confusion is that I'm using an applescript to run a terminal command, so I'm not sure if I use applescript or terminal to get the variable.
No need for Automator.

Just use AppleScript (Change /opt/local/bin/tesseract to the output of which tesseract):

set myFile to (choose file with prompt "Choose a file to convert") # Get the file to convert
set myFilePOSIX to the POSIX path of myFile # Get terminal friendly path
set myLocation to (choose folder with prompt "Choose a location to save your file") # Get location to save the file
set myLocationPOSIX to the POSIX path of myLocation
tell application "Finder"
    display dialog "Choose a file name" default answer (name of file myFile as string) # Type the name the file
    set myName to the text returned of the result # Get what user typed
end tell
do shell script "/opt/local/bin/tesseract " &amp; quoted form of myFilePOSIX &amp; " " &amp; quoted form of myLocationPOSIX &amp; quoted form of myName # Do the terminal command