iCal with attachment

Hello,

I was hoping someone could correct my code below so that I can automatically attach attachment when I am creating an iCal event.

Below is what i have. I have tried many different ways, but it seems like I am not hitting the right spot for this one!

Any help is greatly appreciated!

Thanks,

Riz





set duration to 120 -- set duration to 120 -- in minutes --
set start_time to (current date)
set end_time to (current date)

set indexing to 1
set Start_date to 1
set Start_of_entries to 1
set number_of_entries to 1


---- Create test attachment file
set whoami to do shell script "whoami"
set Attachment_file to "Users:" & whoami & ":Desktop:Test_Attachment_File.txt"
set Test_Text to "
This is a test file that is written for attachment testing"
if not (exists Attachment_file) then
	set Test_File to open for access file Attachment_file with write permission
	write Test_Text to Test_File starting at eof
	close access Test_File
end if
-----------------------------------------------------------------------



tell application "iCal"
	activate
	delay 2
	
	-- Ask user to select their calendar
	repeat
		set find_calendar to title of every calendar
		set calendar_name to choose from list find_calendar with prompt "Select Your Calendar" as text
		set calendar_name to calendar_name as text
		if not calendar_name = false then
			exit repeat
		end if
	end repeat
	
	
	-- Create a simple calendar with all possible fields
	tell calendar calendar_name
		set event_1 to make new event at end with properties {description:"Event Note " & indexing, summary:"Event Title " & indexing, location:" Location " & indexing, start date:start_time, end date:end_time + duration * minutes, url:"www.blackberry.com"}
		tell event_1
			make new display alarm at beginning of display alarms with properties {trigger interval:-30}
		end tell
		delay 2
		tell event_1
			-- make new attachment at beginning of attachments with properties {file name:Attachment_file}
			-- make new attachment with properties {file name:Attachment_file}
			-- make new file attachment at beginning of attachments with properties {file name:Attachment_file}
			-- make new file attachment at end with properties {file name:Attachment_file}
			
		end tell
		
		
	end tell
	
	
end tell






Hi,

there is no attachment element of class event in iCal.

BTW: this won’t work, a HFS path must start with a volume name


set whoami to do shell script "whoami"
set Attachment_file to "Users:" & whoami & ":Desktop:Test_Attachment_File.txt"

use this instead


set Attachment_file to ((path to desktop as text) & "Test_Attachment_File.txt")