Date: Mon, 07 Jul 2014 15:11:29 +0200 From: Emmanuel LEVY …
You already got several useful replies,
Yes and I’m thankful for everyone on the list! you may also want to know that the shell command "ls" accepts a "-t" option to sort files by modification date, so that you would get the last modified file with:
first paragraph of (do shell script "ls -t " & (quoted form of (posix path of (alias "MacHD:Users:okn:Documents:_Output:"))))
All the best! Emmanuel
Thank you Emmanuel! --
When I run:
set _path to POSIX path of (path to downloads folder as text) set lastModifiedFile to first paragraph of (do shell script "ls -t " & (quoted form of (POSIX path of (alias "MacHD:Users:okn:Documents:_Output:")))) --this part works by itself: the files are sorted!
then this is ok. But when I tell TextEdit:
set _path to POSIX path of (path to downloads folder as text) set lastModifiedFile to first paragraph of (do shell script "ls -t " & (quoted form of (POSIX path of (alias "MacHD:Users:okn:Documents:_Output:")))) --this part works by itself: the files are sorted! tell application "TextEdit" open lastModifiedFile end tell -- AS displays the file as Valiable Value, but then: -- error: The doc "AE911….txt does not exist.
I get the error: The doc "AE911….txt does not exist,” although AS displays the file as Variable Value.
So how to tell AS to open the last modified file?
with best regards, Omar K N Stockholm, Sweden ( I’ve still problem with the correct path, when not such obvious folders as downloads folder) |