Hi All,
KM newbie here. I’ve made a super simple but really helpful macro that helps me automate exporting in Capture One Pro. It marks the image green, exports it, and moved to the next image. Now I’m trying to figure out a way to get KM to do the following which would allow me to selectively choose from exported images to add to a slideshow folder:
when I press a hotkey:
Find most recently added file in EXPORT folder
Make a copy of that file and paste it in SLIDESHOW folder
Since you are saying that the files are manipulated before they are exported, I assume that the most recently added file is always the most recently modified file.
Tom’s solution works perfectly if the files in question are modified in the order they are added to the source directory.
Over the years I’ve had semi-regular situations where I’ve modified a file in situ and created a false-positive, so I prefer to use the actual date-added date of the file whenever possible.
AppleScriptObjC gives us that ability since the advent of Mavericks (although Yosemite and later are easier).
I’ve altered the main part of the script to perform your task:
------------------------------------------------------------------------------
use framework "Foundation"
use scripting additions
------------------------------------------------------------------------------
# User must specify source and destination directorys.
tell application "System Events"
set sourceFolderPath to POSIX path of disk item "~/Downloads/"
set targetFolderPath to POSIX path of disk item "~/test_directory/Destination_Directory/"
end tell
set theSortKey to (current application's NSURLAddedToDirectoryDateKey)
set lastAddedFile to its filesIn:sourceFolderPath sortedBy:theSortKey returningSingleItem:true
set lastAddedFile to alias POSIX file lastAddedFile
set targetFolderPath to alias POSIX file targetFolderPath
tell application "Finder"
duplicate lastAddedFile to targetFolderPath without replacing
end tell
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
But remember – the handlers from the complete script are necessary to make it work.
The script is set to fail if a file with the same name already exists in the destination folder, although this is customizable of course.