Re: 'sort' command-alternative?
Re: 'sort' command-alternative?
- Subject: Re: 'sort' command-alternative?
- From: Rob Jorgensen <email@hidden>
- Date: Thu, 3 Oct 2002 19:30:58 -0400
At 11:22 PM +0100 10/3/02, John Delacour wrote:
At 2:31 pm -0400 3/10/02, Rips Ethan J wrote:
b. if there's an alternative, such as a sort command in a
shell script that
can be called by Applescript.
Here's a script that returns a sorted list of the the names of
running processes. You can adapt it to any use. You can also sort
by number with a slight addition.
tell app "Finder" to set ls to name of processes
set AppleScript's text item delimiters to {return}
set ls to ls as string -- turn the list into paragraphs
set AppleScript's text item delimiters to {""}
do shell script "perl -e '
$return = qq(\\015) ;
$list = qq(" & ls & ") ;
@array = split /$return/, $list;
for (sort @array) { print qq($_$return) } '"
paragraphs of result
When I run this, everything is sorted alphabetically except the last
item: loginwindow
It follows Virex 7.1. Is that the expected behavior?
--
Rob Jorgensen
Ohio, USA
_______________________________________________
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.