a few questions
a few questions
- Subject: a few questions
- From: Jim Brandt <email@hidden>
- Date: Fri, 2 Nov 2001 05:36:53 -0600
I asked these questions on Oct 17th and no one responded so I posting
them again.
I'm working on converting my most important OneClick functions to AS
so I can move to OS X and still get some work done. I'm relatively
new to coding AS.
I have several questions. First, the goal.
I have a folder into which I drop files I need to email to myself at
work. I don't necessarily want them to be sent immediately, but
rather to sit there until I'm ready to send them all at once (thus,
no folder action - rather, an on-demand script).
Here's what I have so far:
--------------------------------------
tell application "Finder"
set sourceFolder to alias "Macintosh HD:To_Be_Sent:"
set theList to (every item of sourceFolder whose file type is
not in {"fold"})
--a list for later
set copyList to {}
if (count of the theList) = 0 then
display dialog "Nothing to send"
error number -128
end if
--get the correct personality
open {"Macintosh HD:Applications (Mac OS 9):Eudora Pro
Folder:Jim:Jim's Settings" as alias}
tell application "Eudora"
repeat with n from 1 to the count of the theList
set copyList to aliasList & ((item n of
theList) as alias)
set filename to name of (item n of theList)
set newMsg to make new message at end of
mailbox "Out" of mail folder ""
set field "Subject:" of newMsg to filename
set field "To:" of newMsg to "me_at_work"
attach to newMsg documents ((item n of
theList) as alias)
queue newMsg
end repeat
connect with sending without checking
end tell
end tell
--------------------------------------
Now, the questions:
1) How can I tell when Eudora has finished sending all the messages?
In OneClick, I did this with " Wait NOT Process(":CSOm").Exists".
Does AS have something equivalent? I have more to do in the script,
but it is dependent on the files being sent first.
2) The copyList list is being built to move the files, once they're
sent, to a different folder. Is there an easy way to build a list of
files and move them from one folder to another, or do you have to go
through the list and rename them one at a time?
3) If I have several large files to send, the above script times out
with an AppleEvent timeout. Is there a way to keep Applescript
waiting on Eudora until Eudora has completed it's tasks?
4) Where do I find example scripts for specific applications (like
Eudora)? I learn best by seeing an example and modifying it for my
own use. Unfortunately, the majority of what I've found so far is for
Quark Express, which I don't even own.
5) Is there a way to do the equivalent of Drag and Drop. I wish to
build a list of filenames to be worked on by a program. Again, I do
this in Oneclick by building a list and then issuing the command
"Open List, Program".
Sorry for the length of this message, but learning is sometimes a
lengthy process.
Jim Brandt