Intermittent file permission error message I can't figure out
Here is a script I have been working on to move data from a Filemaker database to iCal. I have tested individual elements and they worked. But when I put them together I am getting file permission errors that were not there before. Help!
Here is the applescript code:
(* gets date and event data from my Filemaker application ...working just fine*)
tell (application "FileMaker Pro")
activate
go to database "*TODOLIST"
go to layout "Appointment Entry"
go to current record
set fmitems to cell "ICALEXPORT" of current record
display dialog fmitems
end tell
(*Parses data to variables needed to complete an iCal event *)
set AppleScript's text item delimiters to {" *"}
set stdate to text item 3 of fmitems
set enddate to text item 1 of fmitems
set calitem to text item 2 of fmitems
(*identifies the existing file that will be used to import to iCal*)
set ifilepath to (path to desktop as Unicode text) & " **ImportiCal.ics"
set ifile to open for access file ifilepath with write permission
(*
This is where I am getting "file permission error" message. I have checked the permissions on the file and it is unlocked with read and write permissions. *)
set eof ifile to 0
set begincal to "BEGIN:VCALENDAR
"
set endcal to "END:VCALENDAR
"
set begevent to "BEGIN:VEVENT
"
set endevent to "END:VEVENT
"
set dts to "DTSTART;TZID=US/Pacific:"
set dte to "DTEND;TZID=US/Pacific:"
set Summ to "SUMMARY:"
set DTstart to (dts & stdate)
set DTend to (dte & enddate)
set Summary to (Summ & calitem)
set content to (begincal & begevent & DTend & "
" & DTstart & "
" & Summary & "
" & endevent & endcal)
display dialog content
write content to ifile
close access ifile
Here is the applescript code:
(* gets date and event data from my Filemaker application ...working just fine*)
tell (application "FileMaker Pro")
activate
go to database "*TODOLIST"
go to layout "Appointment Entry"
go to current record
set fmitems to cell "ICALEXPORT" of current record
display dialog fmitems
end tell
(*Parses data to variables needed to complete an iCal event *)
set AppleScript's text item delimiters to {" *"}
set stdate to text item 3 of fmitems
set enddate to text item 1 of fmitems
set calitem to text item 2 of fmitems
(*identifies the existing file that will be used to import to iCal*)
set ifilepath to (path to desktop as Unicode text) & " **ImportiCal.ics"
set ifile to open for access file ifilepath with write permission
(*
set eof ifile to 0
set begincal to "BEGIN:VCALENDAR
"
set endcal to "END:VCALENDAR
"
set begevent to "BEGIN:VEVENT
"
set endevent to "END:VEVENT
"
set dts to "DTSTART;TZID=US/Pacific:"
set dte to "DTEND;TZID=US/Pacific:"
set Summ to "SUMMARY:"
set DTstart to (dts & stdate)
set DTend to (dte & enddate)
set Summary to (Summ & calitem)
set content to (begincal & begevent & DTend & "
" & DTstart & "
" & Summary & "
" & endevent & endcal)
display dialog content
write content to ifile
close access ifile
iMac 2gb, Powerbook 1.25 ghz