• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Putting a list of files in a particular order
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Putting a list of files in a particular order


  • Subject: Re: Putting a list of files in a particular order
  • From: kai <email@hidden>
  • Date: Wed, 3 May 2006 18:52:48 +0100


On 3 May 2006, at 12:02, Jay Louvion wrote:

Ideally I would like to sort that out using a native AS solution...

In which case something like this might help, Jay:

-------------

to sort_items of main_list by sort_list
	script o
		property l : main_list
		property s : sort_list
	end script
	repeat with i from 2 to count o's l
		set v to o's s's item i
		set w to o's l's item i
		repeat with i from i to 2 by -1
			set j to i - 1
			tell o's s's item j to if v < it then
				set o's s's item i to it
				set o's l's item i to o's l's item j
			else
				set o's s's item i to v
				set o's l's item i to w
				exit repeat
			end if
		end repeat
		if i is 2 and v < o's s's item 1 then
			set o's s's item 1 to v
			set o's l's item 1 to w
		end if
	end repeat
end sort_items

set source_folder to choose folder (* or specify a folder path/alias *)
tell application "Finder" to set {file_list, mod_date} to {it, modification date} of (files of folder ¬
source_folder's entire contents whose name extension is "jpg" and locked is false)
sort_items of file_list by mod_date
file_list -- do something with sorted file_list (list of Finder references)


-------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Putting a list of files in a particular order (From: Jay Louvion <email@hidden>)

  • Prev by Date: Re: Using perl to extract tagged text - again
  • Next by Date: Re: Using perl to extract tagged text - again
  • Previous by thread: Re: Putting a list of files in a particular order
  • Next by thread: Re: Putting a list of files in a particular order
  • Index(es):
    • Date
    • Thread