Import PDFs

Summary: Imports only the PDF files from a folder.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2019-10-02

Description

This script prompts you for a folder and then imports only the (top-level) files that are PDF documents.

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

Script

tell application "Finder"
    
set _folder to choose folder with prompt "Import PDF files from folder:" without multiple selections allowed
    
set _names to list folder _folder without invisibles
    
set _chosenFiles to {}
    
repeat with _name in _names
        
set _path to (_folder's POSIX path) & _name
        
set _file to _path as POSIX file
        
if kind of (info for _file) contains "PDF" then
            
copy _file to end of _chosenFiles
        
end if
    
end repeat
end tell
tell application "EagleFiler"
    
tell library document 1
        
import files _chosenFiles
    
end tell
end tell