OK,
now it is getting complicated. The script has been modified to extract the *mailto URL* from the plist file, and to fix the separators (regular plist files do not like an unencoded "&" character, so it is replaced with "?" in the file).
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #DAFFB6;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
tell application "Finder" to set theFiles to files of folder "Macintosh HD:Users..." as alias list
repeat (count theFiles) times
set randomFile to some item of theFiles
try
tell application "System Events" -- get the poperty list item
set mailtoURL to value of property list item "URL" of property list file (randomFile as text)
end tell
set here to (offset of "?" in mailtoURL) -- find the header separator
if here is not 0 then -- fix any extra "?" separators
set textToFix to text (here + 1) thru -1 of mailtoURL
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "?"} -- break on old character
set {textToFix, AppleScript's text item delimiters} to {text items of textToFix, "&"}
set {textToFix, AppleScript's text item delimiters} to {textToFix as text, tempTID} -- assemble with new character
set mailtoURL to (text 1 thru here of mailtoURL) & textToFix
end if
tell application "Mail"
activate
mailto mailtoURL -- create the message
delay 5
tell application "System Events" to keystroke "d" using {command down, shift down} -- send it
end tell
tell application "Finder" to move randomFile to the trash
if (count theFiles) is equal to 1 then exit repeat -- skip time delay for the last item
on error -- oops, skip the error
log "the file " & quoted form of (randomFile as text) & " was skipped..." -- error message or whatever, if desired
end try
set editedList to {}
repeat with X from 1 to (count theFiles) -- remove the item from the list
if item X of theFiles is not equal to randomFile then set end of editedList to item X of theFiles
end repeat
set theFiles to editedList
delay 120
end repeat
</pre>
By the way, what is the application that creates these files?