0
晚上好, 我想了解爲什麼我可以在Applescript Editor中運行下面的腳本,但無法在Xcode Cocoa-Applescript應用程序中成功運行它。Applescript在腳本編輯器中工作,但不在Xcode 5中
有人可以解釋爲什麼這個函數不能在Xcode中運行,而我需要做什麼才能讓它正常運行?
set this_data to ((current date) as string) & space & "WHY DOESN'T THIS LOG!!!!" & return
set this_file to (((path to desktop folder) as string) & "MY LOG FILE")
my write_to_file(this_data, this_file, true)
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
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