C-Command Software Forum

Workflow Automations & EagleFiler

Good day,

I’m brand new to Eagle Filer. I’m trying to get a good workflow set up that’s similar to my existing ones. I typically use a 3 or 4 folder progression that I’d like to mimic, start with an Inbox, move to Active, move to Archive. I also use a “Parked” or “Someday” folder.

I’m looking for suggestions on the best ways to move files/folders between libraries (short cuts, macros, scripts), and automate moving things from Active to Archive. I currently use Hazel rules for Active to Archive. I’ve browsed to forums a bit, and it seems like a logical approach to use my existing Hazel rules to trigger an AppleScript to import to the library I want to move to. What is still a little unclear is how that impacts the database in the library I move from. Will the library just see that the files are gone and remove them from the database, or will there be issues with the library?

Any best practice recommendations or lessons learned?

I guess the first question is, are you sure you want to use multiple libraries? It would be simpler to move files to another folder in the same library.

Could you give an example of one of your Hazel rules? Is it finding files by tag or date?

The first issue is preserving the metadata (notes, custom Title or From) when moving between libraries. If you do this via drag and drop within EagleFiler, it will happen automatically. If you use an outside app (Finder, Hazel) to import the file into the other library, it will depend on whether the metadata backup is current.

Secondly, if you move/delete a file out of the library folder, EagleFiler will notice that it’s missing. When it reports the file as missing, you can click the Trash button to move it to the trash to remove the old reference from the source library.

Another option would be to use AppleScript to tell EagleFiler to trash the file.

I can live with moving the Inbox to Active, that would probably make things a little easier anyway. I don’t want to see or deal with anything in the Archive folders when I’m working with things in my Active folder. I keep just about all of my files in Archive. There are a ton of files in there.

Moves everything in the Active Folder that hasn’t been opened in the last 60 days to Archive, preserving the structure

I would lean towards scripting it. Then clicks will bug me. Any example code of finding and trashing missing files?

Awesome customer service, BTW. Response on the Sunday of a holiday weekend!


So we’ll try one library with three top-level folders: Inbox, Active, and Archive?

So if you have Active/Folder/File.pdf you want to move it to Archive/Folder/File.pdf?

I think it makes more sense to do this purely with a script. That way you could just move the existing EagleFiler record instead of telling it to import a new file and delete the old one. It’s not currently easy to write such a script because the “last opened” date is not accessible to AppleScript. But I can add that in a beta version of EagleFiler soon.

Willing to try that way as long as there is sufficient filtering to hide everything in the Archive folders from view.

Yes, this is what I’m currently doing.

That works for me. The way I was considering was to pass the file names from Hazel to the script.
Hazel detects old files
Hazel runs script
Hazel passes script file names
Script performs actions

I use that workflow for a few other things where AppleScript doesn’t quite do what I need it to.
TY -Chad

The stuff in Archive will be visible if you click on that folder, or on Records (which shows everything) or on a tag. You can scope searches to Active by clicking on that folder before searching.

That could work, too, although you would need to write some AppleScript code to map from the file path (since it sounds like they’re not all in the same folder) to the library record object.

Here’s some code to do this:

-- _file is set from Hazel
tell application "EagleFiler"
    tell library document "MyLibrary.eflibrary"
        -- Want to write
        -- return library record whose file is _file
        -- but AppleScript doesn’t like that, for some reason

        set _records to library records
        repeat with _record in _records
            if _record's file is _file then
                return _record
            end if
        end repeat
        return missing value
    end tell
end tell

You may find it too slow in a library with lots of records. I plan to add a built-in AppleScript command to do this more quickly.

Whereas, if you already know the folder, you can do something like this, which is fast:

tell application "EagleFiler"
    tell library document "MyLibrary.eflibrary"
        tell library record "Folder" of root folder
            return library record "File"
        end tell
    end tell
end tell

It turns out there’s a better way to do this:

set _file to POSIX file "/path/to/a/file/in/library"
tell application "EagleFiler"
	tell library document "MyLibrary.eflibrary"
		get first library record where its file is _file
	end tell
end tell

(The similar get first library record whose file is _file will report an error -1,700.)

Seems to be working. Have to wait out the 60 days to be sure…