New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Ľ Advice and insight from world-class Apple enthusiasts Ľ Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Applescript guru? help debug my script?


Post Reply New Thread Subscribe

 
Thread Tools
Turk182

 
Member Since: Jan 30, 2009
Posts: 48
Turk182 is an unknown at this point

Turk182 is offline
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
QUOTE Thanks
deer dance

 
deer dance's Avatar
 
Member Since: Jan 23, 2009
Location: Indiana
Posts: 162
deer dance has a little shameless behaviour in the past
Mac Specs: Soon to own

deer dance is offline
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.


Proud Python Programmer/HTML Expert
Believer in Mac OS 7
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
Turk182

 
Member Since: Jan 30, 2009
Posts: 48
Turk182 is an unknown at this point

Turk182 is offline
Quote:
Originally Posted by deer dance View Post
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
QUOTE Thanks
Turk182

 
Member Since: Jan 30, 2009
Posts: 48
Turk182 is an unknown at this point

Turk182 is offline
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:"contact1@gmail.com"}, recipient type:to recipient}, {address:{display name:"Contact 2", address:"contact2@gmail.com"}, 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.
QUOTE Thanks
Turk182

 
Member Since: Jan 30, 2009
Posts: 48
Turk182 is an unknown at this point

Turk182 is offline
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.
QUOTE Thanks

Post Reply New Thread Subscribe


« Default path changed | cin, cout recognized with <stdio.h>, not with <stdio> »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Applescript to input terminal Password db2six9 OS X - Operating System 2 12-01-2008 11:36 PM
Applescript runs continuously through launchd plist rothnd OS X - Development and Darwin 1 10-24-2008 04:20 AM
Convert Excel VB script to Applescript? pingwin77 OS X - Apps and Games 1 07-03-2008 12:30 PM
apple script to greet me off stand by jakeroberts OS X - Development and Darwin 0 04-29-2007 01:34 PM
[ANN] New comprehensive AppleScript book hanaan OS X - Development and Darwin 0 11-06-2004 08:28 PM

All times are GMT -4. The time now is 12:40 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?