ical mail.scpt adjustment (allow ical invite from address to change)

I’ve been pointed to this thead at the apple discussions forum to allow me to adjust the address from which an ical invite is sent (one of four found in my address book entry for myself). Can anyone point me in the right direction. I’m no scripter, my talents lay elsewhere :slight_smile:

Matthew

The ical script in question is this:


-- Mail.applescript
-- iCal

on show_mail_sbrs(subjectLine, messageText, myrecipients)
	tell application "Mail"
		set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
		repeat with i from (count of myrecipients) to 1 by -1
			tell mymail to make new to recipient at beginning of to recipients with properties {address:(item i of myrecipients)}
		end repeat
		set visible of mymail to true
		activate
	end tell
end show_mail_sbrs

on show_mail_sbr(subjectLine, messageText, myrecipient)
	tell application "Mail"
		set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
		tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
		set visible of mymail to true
		activate
	end tell
end show_mail_sbr

on send_mail_sb(subjectLine, messageText)
	tell application "Mail"
		set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
		set visible of mymail to true
		activate
	end tell
end send_mail_sb

on send_mail_sbr(subjectLine, messageText, myrecipient)
	tell application "Mail"
		set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
		tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
		send mymail
	end tell
end send_mail_sbr

on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
	set pfile to POSIX file invitationPath
	set myfile to pfile as alias
	tell application "Mail"
		set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
		tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
		tell mymail
			tell content
				make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
			end tell
		end tell
		send mymail
	end tell
end send_mail_sbrp

on send_mail_sbp(subjectLine, messageText, invitationPath)
	set pfile to POSIX file invitationPath
	set myfile to pfile as alias
	tell application "Mail"
		set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
		tell mymail
			tell content
				make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
			end tell
		end tell
		set visible of mymail to true
		activate
	end tell
end send_mail_sbp


Hi,

To open the messages in Mail so you can modify them. In this section (the fifth handler):

on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
   set pfile to POSIX file invitationPath
   set myfile to pfile as alias
   tell application "Mail"
       set mymail to (make new outgoing message at the beginning of outgoing messages with properties {subject:subjectLine, content:messageText})
       tell mymail to make new to recipient at beginning of to recipients with properties {address:myrecipient}
       tell mymail
           tell content
               make new attachment with properties {file name:myfile} at after the last word of the the last paragraph
           end tell
       end tell
       send mymail
   end tell
end send_mail_sbrp

replace:

       send mymail

with:

		-- Altered to open notifications in Mail.app without sending
		-- Original line quoted out below.
		-- send mymail
		set visible of mymail to true
		activate
		-- End Altered to open notifications 

John M