Import Examples

Summary: Imports files, URLs, and text with various options.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2020-11-23

Description

This script show different ways to get your information into EagleFiler’s frontmost library via AppleScript.

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

tell application "EagleFiler"
    
tell library document 1
        
-- import a file into a particular folder, and add a note
        
set theFolder to library record "MyFolder" of root folder
        
set thePath to "/Users/mjt/Desktop/MyFile"
        
set theNote to "This file was on the desktop."
        
import files {POSIX file thePath} container theFolder note theNote
        
        
-- same thing, but shows how to get a reference to the record to modify it later
        
set {_record} to import files {POSIX file thePath} note theNote
        
set _record's container to theFolder
        
        
-- import URLs, creating Web archives and adding tags
        
import URLs {"https://www.apple.com", "https://c-command.com"} tag names {"mac", "software"}
        
        
-- import text, creating a new RTFD file
        
import text "This is a test."
        
        
-- Import whatever’s on the clipboard (e.g. text, rich text, or image)
        
import with clipboard
        
        
-- Find an existing record that was already imported
        
set _file to POSIX file "/Users/you/Documents/EFLibrary/Files/Folder1/Folder2/File.rtf"
        
set _record to get first library record where its file is _file
    
end tell
end tell


-- Save the script as an application (e.g. “Save PDF to MyFolder.app”) and put it in:
-- /Users/<username>/Library/PDF Services/
-- Then when you print from any application you can choose “Save PDF to MyFolder”
-- to create a new PDF file in that folder in EagleFiler.
on open _files
    
tell application "EagleFiler"
        
tell library document 1
            
set _folder to library record "MyFolder" of root folder
            
import files _files container _folder
        
end tell
    
end tell
end open