Pass Folder name (not path) to Applescript

When a folder reaches a certain number of files, I want to trigger an applescript to send an email. Here is my Applescript:
It is working perfectly, but theFile returns a full path HD:Users:Dad:TARGETFOLDER etc...
I want it to pass only the TARGETFOLDER to the Applescript.
If I want to display a notification, it works perfectly with this setup:
-Display notification with pattern (file)
Any help/workarounds?
- Code: Select all
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:" 10 items " & theFile & , content:"" & theFile & "", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"XXX@XX.com"}
send
end tell
end tell
It is working perfectly, but theFile returns a full path HD:Users:Dad:TARGETFOLDER etc...
I want it to pass only the TARGETFOLDER to the Applescript.
If I want to display a notification, it works perfectly with this setup:
-Display notification with pattern (file)
Any help/workarounds?