Re: last modified file - how to catch?
Re: last modified file - how to catch?
- Subject: Re: last modified file - how to catch?
- From: Thomas Fischer <email@hidden>
- Date: Mon, 07 Jul 2014 18:11:39 +0200
Hello Omar,
the objects in AppleScript are unfriendly beasts that cannot easily be carried from one application (like the Finder) to another (like TextEdit). I can't go deeply into this right now, but path to folder "_Output" of folder "Documents" of home as text)
is formally a Finder path, but "home" is not defined (on my machine, OS X 10.6.8) Better to start with choose folder to get an alias and feed that into the rest of the script. Similarly with set _fldr to folder "MacHD:Users:okn:Documents:_Output"
This won't give you a Finder folder, actually it is just a string, but some applications are willing to take it as a proxy for a folder. Finder won't. But you can do this: tell application "Finder"
set _fldr to folder "MacHD:Users:okn:Documents:_Output"
set lastFile to (last item of (sort files of _fldr by modification date)) of alias # get lastFile # not necessary end tell
You'll see Finder's version of a file if you omit the "of alias" above. The alias is acceptable to other applications, the Finder version usually not.
5.)
Lastly, how to enter a variable result into the dialog, below is of course a text string only?
display dialog "Latest file found [lastFile]" buttons {"OK”}
You just add the variable into the string: display dialog "Latest file found " & <last file's name sting> & "!" buttons {"OK”}
or something similar.
Best Thomas (from Göttingen, also hot!) |
_______________________________________________
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