on write_to_file(this_data, target_file, append_data) -- (string, file path as string, boolean)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
using terms from application "Messages"
on message received theMessage from theBuddy for theChat
write_to_file(theMessage, "message.txt", False)
write_to_file(theBuddy, "person.txt", False)
return
end message received
end using terms from application "Messages"
when i attempt run this code, it says
Expected “given”, “into”, “with”, “without” or other parameter name but found identifier.
idk what to do,please help.
New contributor
A random person is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.