Re: TextEdit Find/replace Caps
Re: TextEdit Find/replace Caps
- Subject: Re: TextEdit Find/replace Caps
- From: hd <email@hidden>
- Date: Sun, 3 Jan 2010 18:41:26 +0000
tell application "TextEdit"
set char_count to count characters of document 1
repeat with x from 1 to char_count
set next_letter to character x of document 1
if next_letter is "a" then set character x of document 1 to "A"
end repeat
end tell
But this will probably be very slow with large documents.
Alternatively, unless you absolutely must use TextEdit, third-party text editors Tex-Edit Plus http://www.tex-edit.com/ (shareware) or TextWrangler http://www.barebones.com/products/textwrangler/ (free) both have scriptable tools to change capitalisation.
If it's a plain text file you could also use AS's file read-write commands and change the text using any number of the available GREP tools.
HTH
On 3 Jan 2010, at 09:32, ba95 wrote:
> In a simple search/replace script, in TextEdit, is it possible make the difference between lowercase and appercase (f. e. between "a" and "A").
>
> Example
> -- set TheText to my SearchReplace(TheText, "√®", "è")
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden