Re: sort lines in TextWrangler
Re: sort lines in TextWrangler
- Subject: Re: sort lines in TextWrangler
- From: Axel Luttgens <email@hidden>
- Date: Sun, 11 Nov 2012 12:20:52 +0100
Le 11 nov. 2012 à 11:20, "koenig.yvan" a écrit :
> Hello
> I have a text file with about 90,000 lines so I assumed that it would be a good idea to use TextWrangler to sort the lines.
>
> After reading the dictionary, I wrote :
>
> set leDocument to (path to desktop as text) & "essai.txt"
>
> tell application "TextWrangler"
> activate
> open leDocument
> sort lines of text document 1 with sort ignoring leading space and replacing target
> close text document 1 with saving
> end tell
>
> My understanding was that the output option [with replacing target]
> would replace the document contents by the sorted one.
> Alas it doesn’t.
>
> [...]
Hello Yvan,
Looking here at BBEdit's dictionary (should be similar to TextWrangler's one), it appears that things such as "sort ignoring leading space" and "replacing target" are described as properties, as if sorting options and output options were objects.
So, assuming the front document is a text document, the syntax expected by BBEdit appears to go along these lines:
tell application "BBEdit"
sort lines of front document sorting options {sort ignoring leading space:true} output options {replacing target:true}
end tell
HTH,
Axel
_______________________________________________
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