
Originally Posted by
alex
1. at the time the file is written on disk is it safe to trigger a script that would lead to modifying the file name? Or should there be a delay?
What matters is whether EagleFiler has imported the file. If you’re importing via script, you can do something like this:
Code:
tell application "EagleFiler"
tell library document 1
set {_record} to import files {POSIX file _path}
-- A
end tell
end tell
When it gets to A, the file has been completely imported, and you have a reference to it in _record.
If the import is happening indirectly, by moving the file into EagleFiler’s library folder, you would need to use the scan for new files script command to tell EagleFiler to look for it, and then you’d have to know the name of the file in order to get the AppleScript library record object for it.

Originally Posted by
alex
2. is there a way to retrieve an EF record based on the file name? I assume it should be something using the library record basename but I have to confess I don't know how to select that in a script without having to iterate over all records :-(.
Here are some ways to do it:
Code:
tell application "EagleFiler"
tell library document 1
-- Search whole library, assuming filename is unique
set _record to first library record whose filename is "Foo.txt"
-- Search directly inside top-level folder Bar
set _folder to library record "Bar" of root folder
set _record to first library record of _folder whose filename is "Foo.txt"
end tell
end tell