Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > AppleScript :)

AppleScript :)
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2006
Status: Offline
Reply With Quote
Nov 27, 2006, 08:36 PM
 
I need some help.

Im trying to write a apple script in script editor.(Wait!)

Previously I used automator to do some tasks for me.

the tasks:

Get specified finder items
New mail message
Send outgoing mail

very simple huh
sorta

problem, my mail server only allows so much mb in a message to be sent at once. but i need this mail server because i need to recieve and send attachments that are executable(which gmail doesn't allow)

So this means if I get two files that I need to email in the same message

I would have to use the automator tasks as follows:

Get specified finder items
new mail message
send outgoing

Get specified finder items
new mail message
send outgoing

Heres what I need:

First off I got pretty much all of the script written except for what I need.

What I want to do is put both files in a folder then call up an applescript and tell it

Get specified finder items --/ call the folder that I specified
Get contents of folder --/ looks in the folder and says hey I have two files
Then have it say file 1 of 2 send to bob@spambob.com
send
Then say file 2 of 2 send to bob@spambob.com
send

If this helps, im seeing something like(yes i know it sorta looks like applescript, i just trying to save space)

Tell application "finder"
get folder (macintosh hd blah blah blah)
get contents

get folder with item number one --/getitem 1 of 2
Tell application "mail"
set newMessage
something here --/call the get folder command above and then call get folder with itiem number 2 and send..

Im really sorry if this is long, im really interested and applescript and am trying to learn. Like I said I don;t need someone to write the whole script I just need the part where Applescript can call file 1 of 2 in folder and send mail then call item 2 of 2 in folder and send mail.

Thank YOU
     
Fresh-Faced Recruit
Join Date: Nov 2006
Status: Offline
Reply With Quote
Nov 27, 2006, 08:37 PM
 
I also need it so no matter if i put 2 files in folder or 10 files in folder, it will send each one individually
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Nov 27, 2006, 09:05 PM
 
I think this is basically what you're looking for:
Code:
tell application "Finder" set selectedFolder to choose folder set fileList to items of selectedFolder repeat with i from 1 to (count of fileList) set currentFile to item i of fileList (* Do what you want with currentFile *) end repeat end tell
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Fresh-Faced Recruit
Join Date: Nov 2006
Status: Offline
Reply With Quote
Nov 28, 2006, 12:16 AM
 
This is where im at but now i get an error saying in mail You have not specified any recipients.

tell application "Finder"
set selectedFolder to choose folder
set fileList to items of selectedFolder
repeat with i from 1 to (count of fileList)
set currentFile to item i of fileList as alias
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:"Your File", content:"is attached."}
tell newMessage
set visible to true
make new to recipient with properties {address:"bob@spambob.com"}
-- try
make new attachment with properties {file name:currentFile} at after the last paragraph of content
-- end try
end tell
activate
send newMessage
end tell
delay 5
end repeat
end tell

What is wrong now????
(Last edited by virustrapp; Nov 28, 2006 at 03:28 AM. )
     
   
Thread Tools
Forum Links
Forum 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 On
Top
Privacy Policy
All times are GMT -5. The time now is 03:52 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2