• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trying to get the path to every file in a folder - Help!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to get the path to every file in a folder - Help!


  • Subject: Trying to get the path to every file in a folder - Help!
  • From: Geoffrey Dudgeon <email@hidden>
  • Date: Thu, 23 Dec 2004 13:48:03 -0500

Hey everyone!! I'm trying to write an applescript that will take a folder and email all of its contents as attachments of separate emails. The problem I've run into is in creating a list of the paths of every file. Getting a path compiles but returns an applescript error. Meanwhile, getting a container compiles and runs without error, but obviously isn't the command I want.

Does anyones know how I should solve this problem?
Is there a way to get the paths without returning an applescript error?
Or should I approach the problem by getting the container and somehow appending the name of the file?

Any help would be MUCH appreciated. Happy Holidays!!

-Geoff

Here's the code:


tell
application "Finder"


--the user inputs the source folder
set sourceFolder to (choose folder with prompt "Select a folder to begin:")
set filesList to path of every file in sourceFolder


--here's the other email information
set theSubject to "Testing AppleScript Batch Mailer v0.1"
set theBody to "This applescript will attach a file of the source folder to this email."
set theName to "Geoffrey Dudgeon"
set theAddress to "email@hidden"
set theSender to "Batch Mailer"


--creates the email and sends it on its way
tell application "Mail"
repeat with theAttachment in filesList
set newMessage to make new outgoing message with properties {theSubject, theBody & return & return}
tell newMessage
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties {theName, theAddress}
tell content
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
--send
end tell
end repeat
end tell
end tell
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Trying to get the path to every file in a folder - Help!
      • From: Andrew Oliver <email@hidden>
    • Re: Trying to get the path to every file in a folder - Help!
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Finder - getting file type
  • Next by Date: Re: Trying to get the path to every file in a folder - Help!
  • Previous by thread: Re: Finder - getting file type
  • Next by thread: Re: Trying to get the path to every file in a folder - Help!
  • Index(es):
    • Date
    • Thread