Applescript guru? help debug my script?

Joined
Jan 30, 2009
Messages
48
Reaction score
0
Points
6
I have this Applescript that when it runs, it is suppose to grab an image with a set name from a set location, create a new email in Entourage, place a subject line, place the image as an attachment, use my email address a the to:, and send it off to me..

currently, I only have it correctly creating the email, adding the subject line. BUT it does not attach the image, use my email address, send it off. it just puts this half finished email into the Drafts folder.. better progress than expected... but

where are my errors?

on send_email(email_to) ---
-- set email_to to someoneisomeplace.net--"
-- set email_from to someonessomeplacek.net--"
set image_name to "Defaultt.jpg"

set image_path to ((path to home folder) as string) & image_name

set image_file to image_path as alias

tell application "Microsoft Entourage"
activate
set new_message to make new outgoing message with properties {subject:"Here is your proof!"}
tell new_message
-- set visible to true --
-- set sender to email_from --
make new to recipient at end of to recipients with properties {address:email_to}
make new attachment with properties {name:image_file} at after the last paragraph
-- activate --
end tell
send new_message
end tell

tell application "Finder"
-- delete image_path --
end tell
end send_email
 
Joined
Jan 23, 2009
Messages
162
Reaction score
1
Points
18
Location
Indiana
Your Mac's Specs
Soon to own
I'm not saying this to be mean, but, "Do it yourself."

You'll never learn if you have someone else fix it for you.
Now, if it's one little thing that you just can't figure out, then ask for help, but when you ask soemone to de-bug an entire script, it's mostly laziness.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
I have to agree with deer dance.

One thing you can try is to place print commands (or the AS equivalent) after each variable to see if they really contain what you think.
 
OP
T
Joined
Jan 30, 2009
Messages
48
Reaction score
0
Points
6
I'm not saying this to be mean, but, "Do it yourself."

You'll never learn if you have someone else fix it for you.
Now, if it's one little thing that you just can't figure out, then ask for help, but when you ask soemone to de-bug an entire script, it's mostly laziness.

you must be kidding? what, am I 10 years old here? I have come this far, but am stuck. if you don't want to help, no worries.. but don't waste a post telling me something like this. it adds absolutely nothing. be rest assured, I am working on debugging it still... laziness... wow, your the master of the obvious and making assumptions here
 
OP
T
Joined
Jan 30, 2009
Messages
48
Reaction score
0
Points
6
just to prove making progress.. on my own and not being lazy

I took a different tact that is getting me closer

set thesubject to "here is your proof!"
set theBody to "here is your visual proof."
set theAttachment_name to "Default.jpg"
set theAttachment_path to ((path to home folder) as string) & theAttachment_name
set theAttachment_file to theAttachment_path as alias

tell application "Microsoft Entourage"
set theRecipients to {{address:{display name:"Contact 1", address:"[email protected]"}, recipient type:to recipient}, {address:{display name:"Contact 2", address:"[email protected]"}, recipient type:cc recipient}}
set theMessage to make new outgoing message with properties {recipient:theRecipients, subject:thesubject, content:theBody, attachment:theAttachment_file}
open theMessage
end tell

tell application "Microsoft Entourage"
send theMessage
end tell


now.. I have the email composed, the attachment is found in proper 'home' folder and correctly placed/attached, subject line set, contact addresses set.. so my final issue seems to be just getting the email to send. it creates and composes the email, but is waiting for it to manually be sent as it seems my final "tell" is not sending the email. I have used the Entourage script dictionary, but I am failing to see how to get the script syntax that finishes it off by sending the email.
 
OP
T
Joined
Jan 30, 2009
Messages
48
Reaction score
0
Points
6
SOLVED IT.. all by my lonesome

On a hunch, I removed the syntax "open theMessage" and replaced it with "send theMessage" and removed the entire final 'tell' since I already had the script working with Entourage and did not need to reopen it or open the message itself.. just send it off.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top