I’m trying to create a blank .dat file, using the code below.
While the code writes a blank entry when run in Applescript, it writes ‘list’ when used in my Xcode project.
It say the first ‘say’ statement, but not the second.
Why does it run differently? And where is the ‘list’ text coming from? Applescript is supposed to write an empty entry when no write statement is issued.
on writeFile9(theFileName, TheWriteItem)
try
if my runForOz then say "writing"
if (count of TheWriteItem) is 0 then set TheWriteItem to {}
tell application "Finder"
set theFileName to ((my pathtodesktop) & "ftp Downloads:" & theFileName as text)
set fRef to (open for access file theFileName with write permission)
set eof fRef to 0
try
if TheWriteItem ≠ {} then
if my runForOz then say "writing 2"
write TheWriteItem as list to fRef
end if
end try
close access fRef
end tell
on error errmsg number errnum
my setEMsgs:{errnum, "mainMessagesView", "writeFile9. Error number " & errnum & " Error " & errmsg as text, "Error Message Orange", true, "Cochin Bold", "14"}
end try
end writeFile9