Attach File to Email and Set Subject to File Name

I have been using this Apple Script to email attachments to pre-defined email addressed. However, the current script sets the file name to include the entire path of the file + file name + extension.
Is there anyway to tweak the script to only include the file name in the subject line?
Is there anyway to tweak the script to only include the file name in the subject line?
- Code: Select all
tell application "Mail"
set theAttachment1 to (POSIX path of theFile)
set theNewMessage to make new outgoing message with properties {subject:theAttachment1, visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"office@email.com"}
make new attachment with properties {file name:theAttachment1} at first paragraph
end tell
end tell