Saving a file as plain text
Saving a file as plain text
- Subject: Saving a file as plain text
- From: Edward Finkler <email@hidden>
- Date: Mon, 25 Feb 2002 20:05:58 -0500
I'm working on an application in Project Builder. One of my functions saves
the contents of a scroll view to a file. It seems to work fine, except that
the file doesn't appear to be saved as plain text. When I open the file in
TextEdit, there are spaces in front of every character. When I view it in
the terminal using less, I get ^@ control characters in front of ever
character.
Any thoughts?
Here's the portion of the script doing the saving:
on clicked theObject
--display dialog "Save Not Implemented"
set savetext to contents of text view 1 of scroll view "scrollEZCodes"
of window "main"
set savefile to (choose file name with prompt "Save EZCodes") as text
write_to_file(savetext, savefile, false)
end clicked
(* Got this from the Essential SubRoutines help module from Apple *)
on write_to_file(this_data, target_file, append_data)
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
display dialog this_data
if append_data is false then
set eof of the open_target_file to 0
end if
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
--
---[Ed]---
i need assertion devils inside my eye won't let up any motion
i need a surgeon devils inside won't cut me any slack
http://www.funkatron.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.