3 maj 2006 kl. 11.15 skrev Jay Louvion: On 3.5.2006 4:26, entity "Malcolm Fitzgerald" <email@hidden> spake thus: > > I've got to ask why the copy sequence matters? > > malcolm Oh, and while I’m at it, there are two reasons why I wished to develop an AS solution rather than continue using the shell: The shell causes the focus to jump during the copying operation, making it virtually impossible to do another task at the same time on the machine.
Would not 'do shell script' fix that? and perhaps run it with nice? The shell can be invoked and opened more than once (by mistake), causing some pretty annoying conflicts between the processes (including incomplete copying, which is desastrous on jpegs and on our reputation). An AS app will only become frontmost if clicked again.
Lock-files? the shell does a test of existence of a magic file, and exits if it finds one; removes it when done. could perhaps contain the shells pid, so it knows if it is put there by this invocation?
anyway here's an applescript's beginner try on list/file/sorting. Could proberbly be much nicer implemented by someone else
Could perhaps give you some ideas?
-- from Matt Neuburg's the definitive guide to applescript on listInsert(L, what, ix) if ix = 1 then return {what} & L else return {item 1 of L} & listInsert(rest of L, what, ix - 1) end if end listInsert
set uf to (path to home folder as string) set L to list folder uf set s to {} repeat with f1 in L if f1 does not start with "." then set end of s to {name of (info for file (uf & f1)), modification date of (info for file (uf & f1))} end if end repeat
set t to {item 1 of s} repeat with f2 in s set cnt to 0 repeat with f3 in t set cnt to cnt + 1 if item 2 of f2 > item 2 of f3 then set t to listInsert(t, f2, cnt) exit repeat end if end repeat end repeat
-- t is now a list of lists, sorted on modification date -- not sure about item 1 though --display dialog t
repeat with f4 in t -- do something with item 1 of f4 like move it, perhapis via Finder tell? end repeat
/Björn
Björn Lundin bnl at spray dot se
|