Re: my first script
Re: my first script
- Subject: Re: my first script
- From: Andy Satori <email@hidden>
- Date: Tue, 21 Jan 2003 22:02:49 -0500
I guess that makes my first script a little over ambitious then :-)
This takes uses an iCal calender of Todo items for the past week and
Send an email to my boss with a list of what I've cleared from my todo
list, feel free to alter and adjust at will (critiques of style are
also welcomed :-). It only took me a month to figure out how to deal
with the unassigned completion date. (exists)
Andy
-- begin script --
set beginWeek to (current date) - 7 * days
set endWeek to (current date)
-- get the calender
set iCalendars to {}
tell application "iCal"
set theCals to calendars whose writable is true
repeat with i from 1 to count of theCals
copy title of item i of theCals to end of iCalendars
end repeat
end tell
set theCalName to "MyCalenderName"
set i to 1
repeat with anitem in iCalendars
if item i of iCalendars is equal to theCalName then
set theNum to i
exit repeat
end if
set i to i + 1
end repeat
set currentCal to item theNum of theCals
-- get the todo items from the landamerica calender
set completeTasks to ""
set openTasks to ""
tell application "iCal"
set theTasks to todos of currentCal
repeat with aTask in theTasks
if exists (completion date of aTask) then
set completeTasks to " -- " & completeTasks & summary of aTask &
return
else
set openTasks to " -- " & openTasks & summary of aTask & return
end if
end repeat
end tell
set theTaskList to "Current Open and Complete Tasks" & return
set theTaskList to theTaskList & "for the week prior to " & (current
date) & return & return
set theTaskList to theTaskList & "Completed Tasks" & return &
completeTasks & return & return
set theTaskList to theTaskList & "Open Tasks" & return & openTasks &
return & return
-- create a mail message
tell application "Mail"
set theMessage to make new outgoing message with properties
{sender:"My Name <email@hidden>", visible:false}
set subject of theMessage to "Weekly Status Update"
set content of theMessage to theTaskList
tell theMessage
make new to recipient at end of to recipients with properties
{name:"My Boss", address:"email@hidden"}
send
end tell
end tell
-- end script --
On Tuesday, January 21, 2003, at 08:46 PM, Michael Grant wrote:
On 1/21/03 6:32 PM, "Andrew Oliver" <email@hidden> wrote:
Try telling the Finder to come to the front before trying to mount the
server. This is done with the simple addition of the 'activate'
command:
tell application "Finder"
activate
open location "afp://at/name_of_server"
end tell
Sometimes you want actions to happen in the background, so most apps
will
not automatically come to the front before executing the commands.
Of course, your first script is SUPPOSED to be:
display dialog "Hello World!"
Michael
--
"Weaseling out of things is important to learn. It's what separates us
from
the animals. Except the weasel."
- Homer Simpson
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.