Re: TextEdit AppleScript bug
Re: TextEdit AppleScript bug
- Subject: Re: TextEdit AppleScript bug
- From: John Delacour <email@hidden>
- Date: Sun, 20 Oct 2002 23:33:55 +0100
- Mac-eudora-version: 5.3a5
At 12:30 pm -0700 20/10/02, Chuck Soper wrote:
But, is there a way to specify "UTF-8" as I would do with the open dialog?
Also, if this is possible, how would I have looked up the answer on my own?
The default text encodings for open and save are specified in the TextEdit
Preferences.
The only way to do this would be to find a way to write the
preference com.apple.textedit.plist, but TextEdit keeps the prefs in
memory all the time it's running and needs to be relaunched if you
want it to read the prefs from the plist. That said, even after
decoding the base64 in the plist, I can't discover where this
preference is stored.
If the pref is set to Automatic, the file below will open as raw
UTF-8 and if the pref is set to UTF-8 it will open properly in
Chinese, as you have discovered. There is no way to script the
preference or to "open as...". This, and a lot besides, ought to be
added to a future version but...
set f to "" & (path to current user folder) & "zili.txt"
set ls to words of "10 232 135 170 229 138 155 230 155 180 231 148 159"
open for access file f with write permission
set eof file f to 0
repeat with n in ls
write (ASCII character n) to file f
end repeat
close access file f
do shell script "cd ; open zili.txt"
_______________________________________________
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.