similar get list problem
I am attempting to run an old Claris Emailer applescript, which ran on OS 9.2.2 to a Mail application running on OS 10.3.9. I've encountered several problems. When I try to change the first line from "Claris Emailer" to "Mail" I get the error message"Expected end of line but found number". The error refers to the number 2 in the second line (set inboxFolder to folder 2 -- "In box").
Also, the applescript shows some event and class errors:
set subFolder to («event FrBlfbss» thesubject without «class mpts» given «class ford»:2)
set imgFolderAlias to «class cfol» "WATERMARKED_IMAGES" of «class cdis» "untitled"
Any help would be most welcome. Here is the script...
**********************
tell application "Claris Emailer"
set inboxFolder to folder 2 -- "In box"
repeat until (count of messages in inboxFolder) is 0
try
-- Get the message
set msg to (message 1 of inboxFolder)
-- Grab the subject, sender's name and email, and body for later use in the script
set thesubject to (subject of msg)
set thesender to (sender of msg)
set senderName to (display name of thesender)
set senderEmail to (address of thesender)
set theBody to (content of msg)
-- The subject should always be 6 characters long (the image id)
-- If not, its probably not an image request, so just ignore it
if length of thesubject is 6 then
-- Store information about this request in our FileMaker database for future reference
tell application "FileMaker Pro"
set recordRef to create new record at database "EmailDatabase2"
set data (cell "Name" of recordRef) to senderName
set data (cell "Email" of recordRef) to senderEmail
set data (cell "ImgRqst" of recordRef) to thesubject
set data (cell "Message" of recordRef) to theBody
end tell
-- Attempt to locate the image id found in the subject and attach that image in the reply
-- If we can't find it, send a reply stating so
try
tell application "Finder"
-- Parse the image id so we can determine which folder the image should be in
set subFolder to («event FrBlfbss» thesubject without «class mpts» given «class ford»:2)
-- Set the path to the Images folder.
-- THIS MUST BE SET IN THE CORRECT FORMAT OR THE SCRIPT WILL FAIL!!
set imgFolderAlias to «class cfol» "WATERMARKED_IMAGES" of «class cdis» "untitled"
set imgFolderPath to imgFolderAlias as string
set imgPath to (imgFolderPath & subFolder & ":" & thesubject & ".JPG")
-- This is where we actually determine if the image exists
-- If not, the 'on error' code will execute next
set imgAlias to imgPath as alias
set fileList to {imgAlias as string}
end tell
-- Create a new message, assemble it, and hold it in the 'Outbox' until the next connection
set newsubject to "Image: " & thesubject
set msgReply to "
************
You may obtain a non-watermarked version by calling 701-947-5932 (888-966-5932 in USA) or, by emailing
painet@stellarnet.com , with the subject of the email being COMP REQUESTED and the body of the email containing the image IDs requested. Explain why you would like the mon-watermarked versions.
As a service we have provided you this copyrighted image for COMPING/VIEWING purposes ONLY. The image may be saved and used in layouts or other printed forms, including multimedia use, for review and evaluation only.
COMPING/VIEWING is defined as using the image, in your layout or artwork, for viewing by ten or fewer people.
For viewing of this image by more than 10 people, licensing rights must be purchased.
To purchase licensing rights to this image, or a larger version of this image, search for the 6-character Image Name at:
www.painetworks.com
When the image is found, click on the Shopping Cart link, to the right of the thumbnail image, to access the order page.
Note: If the original Image Name has been changed, open the image in Photoshop. Go to File:File Info:Section:Keywords. The Image Name will be the top keyword.
You may purchase licensing rights to images by calling 1-888-966-5932 (701-947-5932), by emailing us at
painet@stellarnet.com, or online at
http://www.painetworks.com/cgi-bin/purchasemulti.cgi
Licensing rights and fees can be seen at
http://www.painetworks.com/cgi-bin/purchasemulti.cgi
************
Note that not all images are full screen size. Approximately one-half of one percent are the same 300 pixel version seen online. However, you can order up to 55Mb (8 x 12 inches @ 300 dpi) versions of these images online at
http://www.painetworks.com/cgi-bin/purchasemulti.cgi, or by calling 888-966-5932 (701-947-5932), or by emailing
painet@stellarnet.com..
************
Painet Inc.
PO Box 431
New Rockford, ND 58356
tel: (701) 947-5932
tel: (888) 966-5932
fax: (701) 947-5933
************
Copyrights and all rights are reserved by the photographer represented. No part of this digital image may be used, reproduced or transmitted in any form or by any means, electronic, optical, mechanical, or otherwise, including without limitation, use on the internet, without the express permission of the photographer. Photographer's permission is expressly granted upon receipt and payment of a Painet Inc. invoice listing the image ID and the agreed upon license fee for image use rights.
For more detailed copyright information, see the US Copyright Office pages
http://lcweb.loc.gov/copyright/
"
make new outgoing message with properties {subject:newsubject ¬
, recipient:{address:thesender, recipient type:to recipient} ¬
, file:fileList, scheduled:true, compress enclosures:false, enclosure encoding:base64 ¬
, content:msgReply}
-- The image was found, make a note of it
tell application "FileMaker Pro"
set data (cell "WasFound" of recordRef) to "Found"
end tell
on error
tell application "Claris Emailer"
-- We couldn't find the file, send a reply stating so
-- Create a new message, assemble it, and hold it in the 'Outbox' until the next connection
set newsubject to "Image Not Found: " & thesubject
set msgReply to "The image you requested could not be found on our system!"
make new outgoing message with properties {subject:newsubject ¬
, recipient:{address:thesender, recipient type:to recipient} ¬
, content:msgReply}
-- The image was NOT found, make a note of it
-- By default, the Found field is NOT checked, so we'll just leave it that way
end tell
end try
end if
-- We're done with this email, delete it and start processing the next email
delete msg
-- The delay here is to allow the processor to do its work in the other applications as well rather than letting Claris be a hog
on error
-- An error occured...
-- There are a few reasons that can cause this...
-- 1) The appropriate FileMaker database was not open or frontmost when the script tried to enter data
-- 2) There was an unexpected error with the email itself
-- 3) Claris did somthing unexpected
display dialog ¬
¬
"An error occured while processing an email. ¬
Please edit this script and read the comments at the bottom for hints as to why this happened!" buttons {"End Script", "OK"} ¬
default button "OK" giving up after 2
if button returned is "End Script" then
return
end if
end try
end repeat
-- Were all done with this batch, if were not already connected and doing something, connect, send the replies, and check for new mail
if not connection in progress then
connect to "Image Request" with sending and checking
end if
end tell