Trouble setting path to a jpg in a folder

I’m trying to set up an AppleScript that will get a path from a txt file(mockUPPath.txt) on the Desktop which in theory will allow me to attach a jpg. The name of the folder and jpg will change so I can’t hard code it. I also get the body of the email from another text file on the Desktop which I managed to get working. I can get it to build the email but not find and attach the jpg.

The text in the mockUPPath.txt file looks like this: Name_Mock-up/555.jpg.
The jpg 555.jpg is in a folder “Name_Mock-up” on the Desktop
This is what I have so far (below), anyone know where I’m going wrong?

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set AppleScript's text item delimiters to return
set theFile to ((path to desktop as text) & "mockUPText.txt")
set theData to paragraphs of (read file theFile)

set myPath to ((path to desktop as text) & "mockUPPath.txt")
set thePath to paragraphs of (read file myPath)
set newPath to (POSIX path of (path to desktop folder)) & thePath


set theMessageSubject to "Test email"
set theRecipient to ""
set theMessageContent to theData
set theMessageAttachment to newPath

tell application "Mail"
	set theMessage to make new outgoing message with properties {visible:true, subject:theMessageSubject, content:theMessageContent & linefeed & linefeed}
	tell theMessage
		make new to recipient at end of to recipients with properties {address:theRecipient}
		make new attachment with properties {file name:theMessageAttachment as alias} at after the last word of the last paragraph
	end tell
end tell

The first thing to try is to remove paragraphs of in both cases.

I was able to do that without any issues but I’m getting an error.
Can’t make “/Users/myName/Desktop/Name_Mock-up/555.JPG” into type alias.

The problem is you are passing a POSIX path string into the as alias conversion. as alias expects an HFS path string or a file reference object. Try making this change to convert your POSIX path string into a POSIX file reference which as alias understands:

set theMessageAttachment to newPath


set theMessageAttachment to newPath as POSIX file

If this works, you may be able to remove as alias to simplify things further.

It worked thank you!