Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Applescript to save a text file?



On 27-Apr-04, at 3:21 PM, PiercyWorld wrote:

set my_log to "This file can not be opened by this program. Please try another format. Thank You!"
open for access my_log
save as file my_log to (path to desktop) as "log.txt"

Compare the above with the below

----
set _TempFile to ((path to desktop) & "log.txt") as text
set _Text to "This file can not be opened by this program. Please try another format. Thank You!"

try
close access file _TempFile -- Make sure the file wasn't accidentally left open
end try

open for access file _TempFile with write permission
set eof file _TempFile to 0 -- clear the file contents
write _Text to file _TempFile starting at eof
close access file _TempFile
----
_______________________________________________
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.


References: 
 >Using Applescript to save a text file? (From: PiercyWorld <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.