9.6 Use the Selection
Often, you want to work with the currently selected files or folders in Catalogs or Albums of NeoFinder.
Here are some examples on how to read some attributes of the selected items, and how to change the EXIF date of these items from the XMP date and the file creation date.
Use the Selection
First, just try to get the names of all selected items in NeoFinder.
Copy this script into the Apple "Script Editor" or Script Debugger, and make sure you can see the Event log.
tell application "NeoFinder"
set myList to selected items
repeat with theItem in myList
set myName to name of theItem
log {myName}
end repeat
end tell
In the Apple "Script Editor", this will look like this:
For our test, there were three photo files selected in NeoFinder, and we can see the names in the Events log.
Copy metadata as text-with-tab for Excel to the clipboard
The next example uses the current selection to create a text-with-tab string of some metadata from the selected file, and copy it to the global macOS clipboard, so you can paste it into Microsoft Excel or Apples "Numbers" app
property resultData : "" -- initialize the result with a zero string
tell application "NeoFinder"
set myList to selected items
repeat with theItem in myList
set myName to name of theItem
set mySize to size of theItem
set myPath to path of theItem
set myHeight to media height of theItem
set myWidth to media width of theItem
set resultData to resultData & myName & tab & mySize & tab & myPath & tab & myWidth & "x" & myHeight & return
end repeat
end tell
set the clipboard to resultData -- place the result in the global clipboard
In this case, we copy the name, size, path, and media width and height and build a custom string from this, combining the separate fields with the "tab" character, and end each line with the "return" separator character.
Copy XMP Date to EXIF Date
You can use AppleScript to add abilities that NeoFinder doesn't currently have. In this example, the script copies the XMP date of all selected files to the EXIF date. While NeoFinder can already copy or move metadata between fields, that is currently limited to text-only data, so it won't be available for date values.
tell application "NeoFinder"
set myList to selected items
repeat with theItem in myList
set myDate to xmp Date of theItem
set exif Capture Date of theItem to myDate
end repeat
end tell
Please keep in mind that this will actually physically write the EXIF date into the actual selected files, so try this first with some test copies in a separate cataloged folder, to see how that works.
9.1 The NeoFinder AppleScript dictionary
9.2 The Scripts menu and folder
9.3 Find by AppleScript
9.4 Change the preferences of NeoFinder
9.5 Cataloging and updating
9.6 Use the Selection