Re: Editing a text file using Applescript and Text Edit or Text Wrangler
Re: Editing a text file using Applescript and Text Edit or Text Wrangler
- Subject: Re: Editing a text file using Applescript and Text Edit or Text Wrangler
- From: hd <email@hidden>
- Date: Tue, 27 Oct 2009 18:18:43 +0000
You can do it using AppleScript without using an external editor.
There are several ways. Here's one (this is pseudocode, not an
AppleScript).
open for access the file with write permission
read the file, write contents to a variable
append a return character and then your new text to the text variable
clear the file
write the full text variable into the file
close access the file
If you want to use an external editor, TextWrangler and Tex-Edit Plus
are both highly scriptable. TextEdit… well.
There are lots of scripts for Tex-Edit Plus at http://dougscripts.com/texedit/
Rather than positioning the insertion point, the approach is to tell
the application to make a new paragraph at the end of the front
document, and then set that paragraph to the text you want to append.
Hope this gets you started.
On 27 Oct, 2009, at 17:46, Derek Nugent wrote:
Is it possible to edit and save a text file using Applescript and
Text Edit or Text Wrangler...
I'm trying to add a line of text to the end of a plain text document
but I'm having trouble moving the insertion point to the end of the
document and then saving the document.
Any progress would be good right now...
Many thanks in advance
Best regards
Derek Nugent
email: email@hidden
email@hidden
web: http://www.dereknugent.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden