Page 1 of 1

Pass Folder name (not path) to Applescript

PostPosted: Wed Apr 02, 2014 12:50 am
by miketheteacher
When a folder reaches a certain number of files, I want to trigger an applescript to send an email. Here is my Applescript:

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?

Re: Pass Folder name (not path) to Applescript

PostPosted: Wed Apr 02, 2014 2:20 pm
by Mr_Noodle
Just google around for this. It seems most of the solutions involve Finder though.